diff --git a/libarmbox/Makefile.am b/libarmbox/Makefile.am index ee99e6a..065cd26 100644 --- a/libarmbox/Makefile.am +++ b/libarmbox/Makefile.am @@ -15,7 +15,8 @@ AM_LDFLAGS = \ @SWRESAMPLE_LIBS@ \ -lpthread -lasound -lrt \ -lgstreamer-1.0 \ - -lgsttag-1.0 + -lgsttag-1.0 \ + -lgstmpegts-1.0 libarmbox_la_SOURCES = \ hardware_caps.c \ diff --git a/libarmbox/init.cpp b/libarmbox/init.cpp index fc1129f..26b98c7 100644 --- a/libarmbox/init.cpp +++ b/libarmbox/init.cpp @@ -10,6 +10,7 @@ #include #include "pwrmngr.h" +#include #include "lt_debug.h" #define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_INIT, NULL, args) @@ -26,6 +27,16 @@ void init_td_api() { cCpuFreqManager f; f.SetCpuFreq(0); /* CPUFREQ == 0 is the trigger for leaving standby */ + char buffer[64]; + sprintf(buffer, "%x", 0); + proc_put("/proc/stb/fb/dst_top", buffer, strlen(buffer)); + proc_put("/proc/stb/fb/dst_left", buffer, strlen(buffer)); + sprintf(buffer, "%x", 576); + proc_put("/proc/stb/fb/dst_height", buffer, strlen(buffer)); + sprintf(buffer, "%x", 720); + proc_put("/proc/stb/fb/dst_width", buffer, strlen(buffer)); + sprintf(buffer, "%x", 1); + proc_put("/proc/stb/fb/dst_apply", buffer, strlen(buffer)); } initialized = true; lt_info("%s end\n", __FUNCTION__); diff --git a/libarmbox/playback_gst.cpp b/libarmbox/playback_gst.cpp index f2f1b2b..4f85985 100644 --- a/libarmbox/playback_gst.cpp +++ b/libarmbox/playback_gst.cpp @@ -50,6 +50,7 @@ extern cDemux * videoDemux; #include #include +#include #include typedef enum @@ -76,6 +77,9 @@ gchar * uri = NULL; GstTagList * m_stream_tags = NULL; static int end_eof = 0; #define HTTP_TIMEOUT 30 +// taken from record.h +#define REC_MAX_APIDS 20 +int real_apids[REC_MAX_APIDS]; gint match_sinktype(const GValue *velement, const gchar *type) { @@ -83,6 +87,25 @@ gint match_sinktype(const GValue *velement, const gchar *type) return strcmp(g_type_name(G_OBJECT_TYPE(element)), type); } +void processMpegTsSection(GstMpegtsSection* section) +{ + for (unsigned int i = 0; i < REC_MAX_APIDS; i++) { + real_apids[i] = 0; + } + int cnt = 0; + if (section->section_type == GST_MPEGTS_SECTION_PMT) { + const GstMpegtsPMT* pmt = gst_mpegts_section_get_pmt(section); + for (guint i = 0; i < pmt->streams->len; ++i) { + const GstMpegtsPMTStream* stream = static_cast(g_ptr_array_index(pmt->streams, i)); + if (stream->stream_type == 0x05 || stream->stream_type >= 0x80) { + lt_info_c( "%s:%s Audio Stream pid: %d\n", FILENAME, __FUNCTION__, stream->pid); + real_apids[cnt] = stream->pid; + cnt++; + } + } + } +} + void playbinNotifySource(GObject *object, GParamSpec *unused, gpointer user_data) { GstElement *source = NULL; @@ -269,7 +292,14 @@ GstBusSyncReply Gst_bus_call(GstBus * bus, GstMessage *msg, gpointer user_data) lt_debug_c( "%s:%s - GST_MESSAGE_INFO: update info tags\n", FILENAME, __FUNCTION__); //FIXME: how shall playback handle this event??? break; } - + case GST_MESSAGE_ELEMENT: + { + GstMpegtsSection* section = gst_message_parse_mpegts_section(msg); + if (section) { + processMpegTsSection(section); + gst_mpegts_section_unref(section); + } + } case GST_MESSAGE_STATE_CHANGED: { if(GST_MESSAGE_SRC(msg) != GST_OBJECT(m_gst_playbin)) @@ -853,7 +883,7 @@ void cPlayback::FindAllPids(int *apids, unsigned int *ac3flags, unsigned int *nu for (i = 0; i < n_audio; i++) { // apids - apids[i]=i; + apids[i]= real_apids[i] ? real_apids[i] : i; GstPad * pad = 0; g_signal_emit_by_name (m_gst_playbin, "get-audio-pad", i, &pad);