Changeset 792
- Timestamp:
- 08/03/07 13:49:53 (10 years ago)
- Location:
- branches/dvb-si-1
- Files:
-
- 1 removed
- 17 modified
-
. (modified) (1 prop)
-
ChangeLog (modified) (1 diff)
-
Makefile.am (modified) (1 diff)
-
autogen.sh (modified) (1 diff)
-
common (deleted)
-
configure.ac (modified) (4 diffs)
-
src/flutspmtinfo.c (modified) (5 diffs)
-
src/flutspmtinfo.h (modified) (2 diffs)
-
src/flutspmtstreaminfo.c (modified) (9 diffs)
-
src/flutspmtstreaminfo.h (modified) (1 diff)
-
src/gstdvbtables.c (modified) (5 diffs)
-
src/gstmpegdefs.h (modified) (1 diff)
-
src/gstmpegdemux.c (modified) (16 diffs)
-
src/gstmpegdesc.c (modified) (3 diffs)
-
src/gstmpegtsdemux.c (modified) (31 diffs)
-
src/gstmpegtsdemux.h (modified) (3 diffs)
-
src/gstpesfilter.c (modified) (3 diffs)
-
src/gstpesfilter.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/dvb-si-1
- Property svn:externals set to
-
branches/dvb-si-1/ChangeLog
r637 r792 1 2007-08-03 Zaheer Abbas Merali <zaheerabbas at merali dot org> 2 3 * src/flutspmtinfo.c (PROP_DESCRIPTORS, fluts_pmt_info_class_init, 4 fluts_pmt_info_init, fluts_pmt_info_finalize, 5 fluts_pmt_info_get_property, fluts_pmt_info_add_descriptor): 6 * src/flutspmtinfo.h (descriptors, streams, FluTsPmtInfo): 7 * src/flutspmtstreaminfo.c (PROP_LANGUAGES, PROP_STREAM_TYPE, 8 PROP_DESCRIPTORS, fluts_pmt_stream_info_class_init, 9 fluts_pmt_stream_info_init, fluts_pmt_stream_info_finalize, 10 fluts_pmt_stream_info_new, fluts_pmt_stream_info_add_language, 11 fluts_pmt_stream_info_add_descriptor, 12 fluts_pmt_stream_info_get_property): 13 * src/flutspmtstreaminfo.h (stream_type, descriptors, 14 FluTsPmtStreamInfo): 15 * src/gstdvbtables.c (gst_fluts_stream_parse_dvb_sdt, 16 gst_fluts_stream_parse_dvb_nit, gst_fluts_stream_parse_dvb_eit, 17 fluts_dvb_tables_build_si_info): 18 * src/gstmpegdefs.h (ID_RESERVED_STREAM_1, ID_RESERVED_STREAM_2, 19 ID_EXTENDED_METADATA, ID_EXTENDED_STREAM_ID, ID_RESERVED_STREAM_3): 20 * src/gstmpegdemux.c (video_template, audio_template, 21 gst_flups_demux_class_init, gst_flups_demux_init, 22 gst_flups_demux_send_data, gst_flups_demux_mark_discont, 23 gst_flups_demux_sink_event, gst_flups_demux_src_event, 24 gst_flups_demux_src_query, gst_flups_demux_parse_pack_start, 25 gst_flups_demux_data_cb, gst_flups_demux_chain): 26 * src/gstmpegdesc.c (gst_mpeg_descriptor_nth): 27 * src/gstmpegtsdemux.c (HAVE_ADAPTER_TAKE_BUF, video_template, 28 audio_template, private_template, gst_fluts_is_dirac_stream, 29 gst_fluts_stream_is_video, gst_fluts_demux_fill_stream, 30 gst_fluts_demux_send_new_segment, GST_FLOW_IS_SUCCESS, 31 gst_fluts_demux_data_cb, gst_fluts_demux_get_stream_for_PID, 32 gst_fluts_activate_pmt, gst_fluts_stream_parse_pmt, 33 gst_fluts_demux_parse_adaptation_field, gst_fluts_demux_parse_stream, 34 gst_fluts_demux_parse_transport_packet, gst_fluts_demux_sink_event, 35 GST_BUFFER_IS_DISCONT, fluts_demux_build_pmt_info): 36 * src/gstmpegtsdemux.h (FLUTS_STREAM_FLAG_PMT_VALID, 37 FLUTS_STREAM_FLAG_IS_VIDEO, last_PCR_difference, discont_PCR, 38 discont_difference, base_time, last_time, PMT_pid): 39 * src/gstpesfilter.c (gst_pes_filter_init, gst_pes_filter_is_sync, 40 gst_pes_filter_parse): 41 * src/gstpesfilter.h (gather_pes, allow_unbounded): 42 Merge from trunk. 43 Most of the work done by: Allesandro Decina. 44 1 45 2007-02-11 Zaheer Abbas Merali <zaheerabbas at merali dot org> 2 46 -
branches/dvb-si-1/Makefile.am
r412 r792 1 SUBDIRS = m4src common1 SUBDIRS = src common 2 2 3 3 EXTRA_DIST = autogen.sh gst-fluendo-mpegdemux.spec -
branches/dvb-si-1/autogen.sh
r399 r792 47 47 # aclocal 48 48 if test -f acinclude.m4; then rm acinclude.m4; fi 49 tool_run "$aclocal" "-I m4 $ACLOCAL_FLAGS"49 tool_run "$aclocal" "-I common/m4 $ACLOCAL_FLAGS" 50 50 51 51 tool_run "$libtoolize" "--copy --force" -
branches/dvb-si-1/configure.ac
r564 r792 1 AC_ INIT1 AC_PREREQ(2.52) 2 2 3 dnl the fourth (nano) number should be 0 for a release, 1 for trunk, 3 dnl please read gstreamer/docs/random/autotools before changing this file 4 5 dnl initialize autoconf 6 dnl fill in your package name and version here 7 dnl the fourth (nano) number should be 0 for a release, 1 for CVS, 4 8 dnl and 2... for a prerelease 5 dnl releases only do Wall, cvs and prerelease doesWerror too6 A S_VERSION(gst-fluendo-mpegdemux, GST_PLUGIN_VERSION, 0, 10, 8, 1,7 GST_PLUGIN_TRUNK="no", GST_PLUGIN_TRUNK="no")9 dnl releases only do -Wall, cvs and prerelease does -Werror too 10 AC_INIT(GStreamer Fluendo MPEG Demuxer, 0.10.12.1,, 11 gst-fluendo-mpegdemux) 8 12 9 dnl AM_MAINTAINER_MODE provides the option to enable maintainer mode 13 AG_GST_INIT 14 15 dnl initialize automake 16 AM_INIT_AUTOMAKE 17 18 dnl define PACKAGE_VERSION_* variables 19 AS_VERSION 20 21 dnl check if this is a release version 22 AS_NANO(GST_CVS="no", GST_CVS="yes") 23 24 dnl define the output header for config 25 AM_CONFIG_HEADER([config.h]) 26 27 dnl AM_MAINTAINER_MODE only provides the option to configure to enable it 10 28 AM_MAINTAINER_MODE 11 29 12 AM_INIT_AUTOMAKE($PACKAGE, $VERSION) 13 14 AM_CONFIG_HEADER(config.h) 30 dnl sets host_* variables 31 AC_CANONICAL_HOST 15 32 16 33 dnl make aclocal work in maintainer mode 17 AC_SUBST(ACLOCAL_AMFLAGS, "-I m4")34 AC_SUBST(ACLOCAL_AMFLAGS, "-I common/m4") 18 35 19 dnl check for tools 36 dnl *** check for arguments to configure *** 37 38 AG_GST_ARG_PROFILING 39 AG_GST_ARG_VALGRIND 40 AG_GST_ARG_GCOV 41 42 dnl *** checks for programs *** 43 20 44 AC_PROG_CC 21 45 AC_PROG_LIBTOOL 22 46 23 dnl decide on error flags 24 AS_COMPILER_FLAG(-Wall, GST_WALL="yes", GST_WALL="no") 25 26 if test "x$GST_WALL" = "xyes"; then 27 GST_ERROR="$GST_ERROR -Wall" 28 29 if test "x$GST_PLUGIN_TRUNK" = "xyes"; then 30 AS_COMPILER_FLAG(-Werror, 31 GST_ERROR="$GST_ERROR -Werror", 32 GST_ERROR="$GST_ERROR") 33 fi 34 fi 47 AC_PATH_PROG(VALGRIND_PATH, valgrind, no) 48 AM_CONDITIONAL(HAVE_VALGRIND, test ! "x$VALGRIND_PATH" = "xno") 49 50 dnl define an ERROR_CFLAGS Makefile variable 51 AG_GST_SET_ERROR_CFLAGS($GST_CVS) 35 52 36 53 dnl Check for pkgconfig first … … 45 62 dnl And we can also ask for the right version of gstreamer 46 63 47 GST_REQUIRED=0.10.5.1 64 GST_REQ=0.10.3 65 GSTPB_REQ=0.10.3 48 66 49 67 GST_MAJORMINOR=0.10 50 PKG_CHECK_MODULES(GST, \51 gstreamer-$GST_MAJORMINOR >= $GST_REQUIRED,52 HAVE_GST=yes,HAVE_GST=no)53 68 54 dnl Give error and exit if we don't have gstreamer 55 if test "x$HAVE_GST" = "xno"; then 56 AC_MSG_ERROR(you need gstreamer development packages installed !) 57 fi 58 59 PKG_CHECK_MODULES(GST_BASE, \ 60 gstreamer-base-$GST_MAJORMINOR >= $GST_REQUIRED, 61 HAVE_GST_BASE=yes,HAVE_GST_BASE=no) 62 63 dnl Give error and exit if we don't have gstreamer 64 if test "x$HAVE_GST_BASE" = "xno"; then 65 AC_MSG_ERROR(you need gstreamer base development packages installed !) 66 fi 69 AG_GST_CHECK_GST($GST_MAJORMINOR, [$GST_REQ]) 70 AG_GST_CHECK_GST_BASE($GST_MAJORMINOR, [$GST_REQ]) 67 71 68 72 GST_CFLAGS="$GST_CFLAGS $GST_ERROR" … … 76 80 AC_SUBST(GST_MAJORMINOR) 77 81 78 dnl set the plugindir where plugins should be installed 79 plugindir="\$(libdir)/gstreamer-$GST_MAJORMINOR" 80 AC_SUBST(plugindir) 82 AG_GST_SET_PLUGINDIR 81 83 82 84 dnl set proper LDFLAGS for plugins … … 86 88 AC_OUTPUT( 87 89 Makefile 88 m4/Makefile89 90 src/Makefile 90 91 common/Makefile 92 common/m4/Makefile 91 93 gst-fluendo-mpegdemux.spec 92 94 ) -
branches/dvb-si-1/src/flutspmtinfo.c
r585 r792 33 33 PROP_VERSION_NO, 34 34 PROP_PCR_PID, 35 PROP_DESCRIPTORS, 35 36 PROP_STREAMINFO 36 37 }; … … 81 82 "Version number of this program information", 0, G_MAXUINT8, 1, 82 83 G_PARAM_READABLE)); 84 85 g_object_class_install_property (gobject_klass, PROP_DESCRIPTORS, 86 g_param_spec_value_array ("descriptors", 87 "Descriptors", 88 "Value array of strings containing program descriptors", 89 g_param_spec_boxed ("descriptor", 90 "descriptor", 91 "", 92 G_TYPE_GSTRING, 93 G_PARAM_READABLE), 94 G_PARAM_READABLE)); 83 95 } 84 96 … … 87 99 { 88 100 pmt_info->streams = g_value_array_new (0); 101 pmt_info->descriptors = g_value_array_new (0); 89 102 } 90 103 … … 109 122 110 123 g_value_array_free (info->streams); 124 g_value_array_free (info->descriptors); 111 125 112 126 G_OBJECT_CLASS (parent_class)->finalize (object); … … 144 158 g_value_set_uint (value, pmt_info->version_no); 145 159 break; 160 case PROP_DESCRIPTORS: 161 g_value_set_boxed (value, pmt_info->descriptors); 162 break; 146 163 default: 147 164 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, spec); 148 165 break; 149 166 } 167 } 168 169 void 170 fluts_pmt_info_add_descriptor (FluTsPmtInfo *pmt_info, 171 const gchar *descriptor, guint length) 172 { 173 GValue value = {0}; 174 GString *string; 175 176 g_return_if_fail (FLUTS_IS_PMT_INFO (pmt_info)); 177 178 string = g_string_new_len (descriptor, length); 179 180 g_value_init (&value, G_TYPE_GSTRING); 181 g_value_take_boxed (&value, string); 182 g_value_array_append (pmt_info->descriptors, &value); 183 g_value_unset (&value); 150 184 } 151 185 -
branches/dvb-si-1/src/flutspmtinfo.h
r585 r792 39 39 guint8 version_no; 40 40 41 GValueArray *descriptors; 41 42 GValueArray *streams; 42 43 } FluTsPmtInfo; … … 44 45 FluTsPmtInfo *fluts_pmt_info_new (guint16 program_no, guint16 pcr_pid, guint8 version); 45 46 void fluts_pmt_info_add_stream (FluTsPmtInfo *pmt_info, FluTsPmtStreamInfo *stream); 47 void fluts_pmt_info_add_descriptor (FluTsPmtInfo *pmt_info, 48 const gchar *descriptor, guint length); 46 49 47 50 GType fluts_pmt_info_get_type (void); -
branches/dvb-si-1/src/flutspmtstreaminfo.c
r598 r792 31 31 PROP_0, 32 32 PROP_PID, 33 PROP_LANGUAGES 33 PROP_LANGUAGES, 34 PROP_STREAM_TYPE, 35 PROP_DESCRIPTORS, 34 36 }; 35 37 … … 41 43 static void fluts_pmt_stream_info_get_property (GObject * object, guint prop_id, 42 44 GValue * value, GParamSpec * spec); 45 static void fluts_pmt_stream_info_finalize (GObject *object); 43 46 44 47 static void … … 54 57 gobject_klass->set_property = fluts_pmt_stream_info_set_property; 55 58 gobject_klass->get_property = fluts_pmt_stream_info_get_property; 59 gobject_klass->finalize = fluts_pmt_stream_info_finalize; 56 60 57 61 g_object_class_install_property (gobject_klass, PROP_PID, … … 63 67 "Value array of the languages of this stream", 64 68 g_param_spec_string("language", "language", "language", "", 65 G_PARAM_READABLE), 66 G_PARAM_READABLE)); 69 G_PARAM_READABLE), 70 G_PARAM_READABLE)); 71 72 g_object_class_install_property (gobject_klass, PROP_STREAM_TYPE, 73 g_param_spec_uint ("stream-type", 74 "Stream type", 75 "Stream type", 76 0, 77 G_MAXUINT8, 78 0, 79 G_PARAM_READABLE)); 80 81 g_object_class_install_property (gobject_klass, PROP_DESCRIPTORS, 82 g_param_spec_value_array ("descriptors", 83 "Descriptors", 84 "Value array of strings containing stream descriptors", 85 g_param_spec_boxed ("descriptor", 86 "descriptor", 87 "", 88 G_TYPE_GSTRING, 89 G_PARAM_READABLE), 90 G_PARAM_READABLE)); 67 91 } 68 92 … … 71 95 { 72 96 pmt_stream_info->languages = g_value_array_new ( 0 ); 97 pmt_stream_info->descriptors = g_value_array_new (0); 73 98 } 74 99 75 FluTsPmtStreamInfo *fluts_pmt_stream_info_new (guint16 pid) 100 static void 101 fluts_pmt_stream_info_finalize (GObject *object) 102 { 103 FluTsPmtStreamInfo *info = FLUTS_PMT_STREAM_INFO (object); 104 105 g_value_array_free (info->languages); 106 g_value_array_free (info->descriptors); 107 } 108 109 FluTsPmtStreamInfo *fluts_pmt_stream_info_new (guint16 pid, guint8 type) 76 110 { 77 111 FluTsPmtStreamInfo *info; … … 79 113 80 114 info->pid = pid; 115 info->stream_type = type; 81 116 return info; 82 117 } … … 92 127 g_value_take_string (&v, language); 93 128 g_value_array_append (pmt_info->languages, &v); 129 g_value_unset (&v); 130 } 131 132 void 133 fluts_pmt_stream_info_add_descriptor (FluTsPmtStreamInfo *pmt_info, 134 const gchar *descriptor, guint length) 135 { 136 GValue value = {0}; 137 GString *string; 138 139 g_return_if_fail (FLUTS_IS_PMT_STREAM_INFO (pmt_info)); 140 141 string = g_string_new_len (descriptor, length); 142 143 g_value_init (&value, G_TYPE_GSTRING); 144 g_value_take_boxed (&value, string); 145 g_value_array_append (pmt_info->descriptors, &value); 146 g_value_unset (&value); 94 147 } 95 148 … … 115 168 116 169 switch (prop_id) { 170 case PROP_STREAM_TYPE: 171 g_value_set_uint (value, si->stream_type); 172 break; 117 173 case PROP_PID: 118 174 g_value_set_uint (value, si->pid); … … 120 176 case PROP_LANGUAGES: 121 177 g_value_set_boxed (value, si->languages); 178 break; 179 case PROP_DESCRIPTORS: 180 g_value_set_boxed (value, si->descriptors); 122 181 break; 123 182 default: -
branches/dvb-si-1/src/flutspmtstreaminfo.h
r598 r792 36 36 guint16 pid; 37 37 GValueArray *languages; /* null terminated 3 character ISO639 language code */ 38 guint8 stream_type; 39 GValueArray *descriptors; 38 40 } FluTsPmtStreamInfo; 39 41 40 FluTsPmtStreamInfo *fluts_pmt_stream_info_new (guint16 pid );42 FluTsPmtStreamInfo *fluts_pmt_stream_info_new (guint16 pid, guint8 type); 41 43 void fluts_pmt_stream_info_add_language(FluTsPmtStreamInfo* si, gchar* language); 42 44 -
branches/dvb-si-1/src/gstdvbtables.c
r635 r792 183 183 } 184 184 else { 185 GST_DEBUG("oi transport_stream_id: %d hash: %d", transport_stream_id,186 g_direct_hash(transport_stream_id));187 185 SDT = (GstFluTSDVBSDT*)g_hash_table_lookup(demux->dvb_tables->other_ts_sdt_tables, 188 transport_stream_id);186 GINT_TO_POINTER ((gint) transport_stream_id)); 189 187 if (SDT == NULL) { 190 188 SDT = g_new0(GstFluTSDVBSDT, 1); 191 189 new_sdt = TRUE; 192 190 g_hash_table_insert (demux->dvb_tables->other_ts_sdt_tables, 193 (gpointer)(guint)transport_stream_id, SDT);191 GINT_TO_POINTER ((gint) transport_stream_id), SDT); 194 192 } 195 193 } … … 369 367 else { 370 368 NIT = (GstFluTSDVBNIT*)g_hash_table_lookup(demux->dvb_tables->other_network_nit_tables, 371 (gpointer)(guint)network_id);369 GINT_TO_POINTER ((gint) network_id)); 372 370 if (NIT == NULL) { 373 371 NIT = g_new(GstFluTSDVBNIT, 1); 374 372 new_nit = TRUE; 375 373 g_hash_table_insert (demux->dvb_tables->other_network_nit_tables, 376 (gpointer)(guint)network_id, NIT);374 GINT_TO_POINTER ((gint) network_id), NIT); 377 375 } 378 376 } … … 557 555 GST_DEBUG_OBJECT (demux, "EIT Tables: 0x%x service_id: %u", demux->dvb_tables->eit_tables, service_id); 558 556 EIT = (GstFluTSDVBEIT*)g_hash_table_lookup(demux->dvb_tables->eit_tables, 559 (gpointer)service_id);557 GINT_TO_POINTER ((gint) service_id)); 560 558 if (EIT == NULL) { 561 559 EIT = g_new0(GstFluTSDVBEIT, 1); 562 560 new_eit = TRUE; 563 561 g_hash_table_insert (demux->dvb_tables->eit_tables, 564 (gpointer)service_id, EIT);562 GINT_TO_POINTER ((gint) service_id), EIT); 565 563 } 566 564 GST_DEBUG_OBJECT (demux, "EIT version_number: %d", version_number); … … 703 701 /* go through EIT for this service */ 704 702 EIT = (GstFluTSDVBEIT*)g_hash_table_lookup(demux->dvb_tables->eit_tables, 705 (gpointer)entry->service_id);703 GINT_TO_POINTER ((gint) entry->service_id)); 706 704 if (EIT) { 707 705 guint j=0; … … 713 711 GstFluTSDVBEITEventEntry*, j++)) != NULL) { 714 712 GST_DEBUG_OBJECT(demux," EIT Event id: %u, start&duration: %" G_GUINT64_FORMAT, event->event_id, event->start_duration); 715 si_event = fluts_si_event_new(event->event_id, event->scrambled, event->start_duration);713 si_event = fluts_si_event_new(event->event_id, event->scrambled, (guint8 *) event->start_duration); 716 714 fluts_si_service_info_add_event(service, si_event); 717 715 } -
branches/dvb-si-1/src/gstmpegdefs.h
r613 r792 64 64 #define ID_ITU_TREC_H222_TYPE_E_STREAM 0x000001F8 65 65 #define ID_ANCILLARY_STREAM 0x000001F9 66 #define ID_RESERVED_STREAM_START 0x000001FA 67 #define ID_RESERVED_STREAM_END 0x000001FE 66 #define ID_RESERVED_STREAM_1 0x000001FA 67 #define ID_RESERVED_STREAM_2 0x000001FB 68 #define ID_EXTENDED_METADATA 0x000001FC 69 #define ID_EXTENDED_STREAM_ID 0x000001FD 70 #define ID_RESERVED_STREAM_3 0x000001FE 68 71 #define ID_PROGRAM_STREAM_DIRECTORY 0x000001FF 69 72 -
branches/dvb-si-1/src/gstmpegdemux.c
r613 r792 90 90 91 91 static GstStaticPadTemplate video_template = 92 GST_STATIC_PAD_TEMPLATE ("video_%02 d",92 GST_STATIC_PAD_TEMPLATE ("video_%02x", 93 93 GST_PAD_SRC, 94 94 GST_PAD_SOMETIMES, … … 98 98 99 99 static GstStaticPadTemplate audio_template = 100 GST_STATIC_PAD_TEMPLATE ("audio_%02 d",100 GST_STATIC_PAD_TEMPLATE ("audio_%02x", 101 101 GST_PAD_SRC, 102 102 GST_PAD_SOMETIMES, … … 203 203 g_param_spec_enum ("sync", "Sync", "The synchronisation method", 204 204 GST_TYPE_FLUPS_DEMUX_SYNC, 205 GST_FLUPS_DEMUX_SYNC_ AUTO, G_PARAM_READWRITE));205 GST_FLUPS_DEMUX_SYNC_SCR, G_PARAM_READWRITE)); 206 206 207 207 gstelement_class->change_state = gst_flups_demux_change_state; … … 221 221 g_malloc0 (sizeof (GstFluPSStream *) * (GST_FLUPS_DEMUX_MAX_STREAMS)); 222 222 223 demux-> cur_sync_method = GST_FLUPS_DEMUX_SYNC_AUTO;223 demux->sync_method = demux->cur_sync_method = GST_FLUPS_DEMUX_SYNC_SCR; 224 224 } 225 225 … … 460 460 461 461 if (demux->cur_sync_method == GST_FLUPS_DEMUX_SYNC_AUTO) { 462 if (((demux->base_dts > demux->base_scr) && 463 (demux->base_dts - demux->base_scr > CLOCK_FREQ)) || 464 (demux->base_scr - demux->base_dts > CLOCK_FREQ)) { 462 gint64 diff; 463 if (demux->base_dts > demux->base_scr) 464 diff = demux->base_dts - demux->base_scr; 465 else 466 diff = demux->base_scr - demux->base_dts; 467 468 if (diff > CLOCK_FREQ) { 465 469 /* Use DTS as the sync method */ 466 470 if (demux->cur_sync_method != GST_FLUPS_DEMUX_SYNC_DTS) { … … 530 534 /* Set the buffer discont flag, and clear discont state on the stream */ 531 535 if (stream->discont) { 536 GST_DEBUG_OBJECT (demux, "marking discont buffer"); 532 537 GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DISCONT); 533 538 … … 553 558 gst_buffer_unref (buf); 554 559 return GST_FLOW_OK; 560 } 561 } 562 563 static void 564 gst_flups_demux_mark_discont (GstFluPSDemux * demux) 565 { 566 gint id; 567 568 /* mark discont on all streams */ 569 for (id = 0; id < GST_FLUPS_DEMUX_MAX_STREAMS; id++) { 570 GstFluPSStream *stream = demux->streams[id]; 571 572 if (stream) { 573 GST_DEBUG_OBJECT (demux, "marking stream as discont"); 574 stream->discont = TRUE; 575 } 555 576 } 556 577 } … … 674 695 675 696 gst_segment_init (&demux->sink_segment, GST_FORMAT_UNDEFINED); 697 gst_flups_demux_mark_discont (demux); 676 698 gst_adapter_clear (demux->adapter); 677 699 gst_pes_filter_drain (&demux->filter); … … 786 808 787 809 bcur = cur * demux->mux_rate / GST_SECOND; 788 bstop = stop * demux->mux_rate / GST_SECOND; 810 if (stop != -1) 811 bstop = stop * demux->mux_rate / GST_SECOND; 812 else 813 bstop = -1; 789 814 790 815 bevent = gst_event_new_seek (rate, GST_FORMAT_BYTES, flags, cur_type, … … 822 847 823 848 demux = GST_FLUPS_DEMUX (gst_pad_get_parent (pad)); 849 850 GST_LOG_OBJECT (demux, "Have query of type %d on pad %" GST_PTR_FORMAT, 851 GST_QUERY_TYPE (query), pad); 824 852 825 853 switch (GST_QUERY_TYPE (query)) { … … 855 883 gst_query_parse_duration (query, &format, NULL); 856 884 885 if ((peer = gst_pad_get_peer (demux->sinkpad)) == NULL) { 886 GST_DEBUG_OBJECT (demux, "duration not possible, no peer"); 887 goto not_supported; 888 } 889 890 /* For any format other than bytes, see if upstream knows first */ 891 if (format == GST_FORMAT_BYTES) { 892 GST_DEBUG_OBJECT (demux, "duration not supported for format %d", 893 format); 894 gst_object_unref (peer); 895 goto not_supported; 896 } 897 898 if (gst_pad_query (peer, query)) { 899 gst_object_unref (peer); 900 res = TRUE; 901 break; 902 } 903 904 /* Upstream didn't know, so we can only answer TIME queries from 905 * here on */ 857 906 if (format != GST_FORMAT_TIME) { 858 907 GST_DEBUG_OBJECT (demux, "duration not supported for format %d", 859 908 format); 909 gst_object_unref (peer); 860 910 goto not_supported; 861 911 } 912 862 913 if (demux->mux_rate == -1) { 863 914 GST_DEBUG_OBJECT (demux, "duration not possible, no mux_rate"); 864 goto not_supported; 865 } 866 867 if ((peer = gst_pad_get_peer (demux->sinkpad)) == NULL) { 868 GST_DEBUG_OBJECT (demux, "duration not possible, no peer"); 915 gst_object_unref (peer); 869 916 goto not_supported; 870 917 } … … 888 935 } 889 936 default: 937 res = gst_pad_query_default (pad, query); 890 938 break; 891 939 } … … 1030 1078 1031 1079 if (demux->current_scr == G_MAXUINT64) { 1032 gint id;1033 1034 1080 /* take new base_scr */ 1035 1081 demux->base_scr = scr; … … 1050 1096 1051 1097 /* mark discont on all streams */ 1052 for (id = 0; id < GST_FLUPS_DEMUX_MAX_STREAMS; id++) { 1053 GstFluPSStream *stream = demux->streams[id]; 1054 1055 if (stream) 1056 stream->discont = TRUE; 1057 } 1098 gst_flups_demux_mark_discont (demux); 1099 1058 1100 /* Reset the sync method, so that it will switch again 1059 1101 * if it's AUTO */ … … 1374 1416 * to send to it, unless we're processing a discont (which resets 1375 1417 * the not-linked status and tries again */ 1376 if (demux->current_stream->discont) 1418 if (demux->current_stream->discont) { 1419 GST_DEBUG_OBJECT (demux, "stream is discont"); 1377 1420 demux->current_stream->notlinked = FALSE; 1421 } 1378 1422 1379 1423 if (demux->current_stream->notlinked == FALSE) { … … 1470 1514 1471 1515 gst_pes_filter_drain (&demux->filter); 1516 1517 /* mark discont on all streams */ 1518 gst_flups_demux_mark_discont (demux); 1519 1472 1520 demux->current_scr = G_MAXUINT64; 1473 1521 demux->bytes_since_scr = 0; -
branches/dvb-si-1/src/gstmpegdesc.c
r613 r792 164 164 guint8 *current; 165 165 guint size; 166 guint j = 0;167 166 168 167 g_return_val_if_fail (desc != NULL, NULL); … … 174 173 length = desc->data_length; 175 174 176 while ( TRUE) {177 if (i == j)175 while (length > 0) { 176 if (i == 0) 178 177 return current; 179 178 … … 182 181 current += size; 183 182 length -= size; 184 j++; 183 i--; 184 185 185 } 186 186 return NULL; -
branches/dvb-si-1/src/gstmpegtsdemux.c
r635 r792 23 23 #endif 24 24 25 #include <linux/dvb/ca.h> 26 #include <sys/types.h> 27 #include <sys/stat.h> 28 #include <sys/ioctl.h> 29 #include <fcntl.h> 30 25 31 #include <string.h> 26 32 #include <stdlib.h> … … 32 38 #include "flutssiinfo.h" 33 39 #include "gstdvbtables.h" 40 41 #if ((GST_VERSION_MAJOR > 0) || \ 42 (GST_VERSION_MAJOR == 0 && GST_VERSION_MINOR > 10) || \ 43 (GST_VERSION_MAJOR == 0 && GST_VERSION_MINOR == 10 && \ 44 GST_VERSION_MICRO >= 6)) 45 #define HAVE_ADAPTER_TAKE_BUF 46 #endif 34 47 35 48 GST_DEBUG_CATEGORY_STATIC (gstflutsdemux_debug); … … 100 113 101 114 static GstStaticPadTemplate video_template = 102 GST_STATIC_PAD_TEMPLATE ("video_%0 2d",115 GST_STATIC_PAD_TEMPLATE ("video_%04x", 103 116 GST_PAD_SRC, 104 117 GST_PAD_SOMETIMES, … … 106 119 107 120 static GstStaticPadTemplate audio_template = 108 GST_STATIC_PAD_TEMPLATE ("audio_%0 2d",121 GST_STATIC_PAD_TEMPLATE ("audio_%04x", 109 122 GST_PAD_SRC, 110 123 GST_PAD_SOMETIMES, … … 112 125 113 126 static GstStaticPadTemplate private_template = 114 GST_STATIC_PAD_TEMPLATE ("private_% d",127 GST_STATIC_PAD_TEMPLATE ("private_%04x", 115 128 GST_PAD_SRC, 116 129 GST_PAD_SOMETIMES, … … 135 148 static GstStateChangeReturn gst_fluts_demux_change_state (GstElement * element, 136 149 GstStateChange transition); 150 151 static FluTsPmtInfo *fluts_demux_build_pmt_info (GstFluTSDemux *demux, 152 guint16 pmt_pid); 137 153 138 154 static GstElementClass *parent_class = NULL; … … 412 428 413 429 static gboolean 430 gst_fluts_is_dirac_stream (GstFluTSStream * stream) 431 { 432 gboolean is_dirac = FALSE; 433 434 if (stream->stream_type != ST_VIDEO_DIRAC) 435 return FALSE; 436 437 if (stream->ES_info != NULL) { 438 guint8 *dirac_desc; 439 /* Check for a Registration Descriptor to confirm this is dirac */ 440 dirac_desc = gst_mpeg_descriptor_find (stream->ES_info, 441 DESC_REGISTRATION); 442 if (dirac_desc != NULL && DESC_LENGTH (dirac_desc) >= 4) { 443 if (DESC_REGISTRATION_format_identifier (dirac_desc) == 444 0x64726163) /* 'drac' in hex */ { 445 is_dirac = TRUE; 446 } 447 } else { 448 /* Check for old mapping as originally specified too */ 449 dirac_desc = gst_mpeg_descriptor_find (stream->ES_info, 450 DESC_DIRAC_TC_PRIVATE); 451 if (dirac_desc != NULL && DESC_LENGTH (dirac_desc) == 0) 452 is_dirac = TRUE; 453 } 454 } 455 456 return is_dirac; 457 } 458 459 static gboolean 460 gst_fluts_stream_is_video (GstFluTSStream * stream) 461 { 462 switch (stream->stream_type) { 463 case ST_VIDEO_MPEG1: 464 case ST_VIDEO_MPEG2: 465 case ST_VIDEO_MPEG4: 466 case ST_VIDEO_H264: 467 return TRUE; 468 case ST_VIDEO_DIRAC: 469 return gst_fluts_is_dirac_stream (stream); 470 } 471 472 return FALSE; 473 } 474 475 static gboolean 414 476 gst_fluts_demux_fill_stream (GstFluTSStream * stream, guint8 id, 415 477 guint8 stream_type) … … 469 531 name = g_strdup_printf ("video_%04x", stream->PID); 470 532 caps = gst_caps_new_simple ("video/x-h264", NULL); 533 break; 471 534 case ST_VIDEO_DIRAC: 472 /* Check for the empty 0xAC descriptor to be sure */ 473 { 474 gboolean is_dirac = FALSE; 475 476 if (stream->ES_info != NULL) { 477 guint8 *dirac_desc; 478 dirac_desc = gst_mpeg_descriptor_find (stream->ES_info, 479 DESC_DIRAC_TC_PRIVATE); 480 if (dirac_desc != NULL && DESC_LENGTH (dirac_desc) == 0) 481 is_dirac = TRUE; 482 } 483 if (is_dirac) { 484 template = klass->video_template; 485 name = g_strdup_printf ("video_%04x", stream->PID); 486 caps = gst_caps_new_simple ("video/x-dirac", NULL); 487 } 535 if (gst_fluts_is_dirac_stream (stream)) { 536 template = klass->video_template; 537 name = g_strdup_printf ("video_%04x", stream->PID); 538 caps = gst_caps_new_simple ("video/x-dirac", NULL); 488 539 } 489 540 break; … … 502 553 name = g_strdup_printf ("audio_%04x", stream->PID); 503 554 caps = gst_caps_new_simple ("audio/x-lpcm", NULL); 555 break; 504 556 case ST_PS_DVD_SUBPICTURE: 505 break;506 case ST_PS_TIMECODE:507 /* Check for the 0xAC descriptor with video_PID */508 {509 gboolean is_timecode = FALSE;510 guint16 video_pid;511 if (stream->ES_info != NULL) {512 guint8 *desc;513 desc = gst_mpeg_descriptor_find (stream->ES_info,514 DESC_DIRAC_TC_PRIVATE);515 if (desc != NULL && DESC_LENGTH (desc) == 2) {516 is_timecode = TRUE;517 video_pid = DESC_TIMECODE_video_pid (desc);518 }519 }520 if (is_timecode) {521 template = klass->private_template;522 name = g_strdup_printf ("private_%04x", stream->PID);523 caps = gst_caps_new_simple ("application/x-mpeg-timecode",524 "video-pid", video_pid, NULL);525 }526 }527 557 break; 528 558 default: … … 639 669 } 640 670 671 #ifndef GST_FLOW_IS_SUCCESS 672 #define GST_FLOW_IS_SUCCESS(ret) ((ret) >= GST_FLOW_OK) 673 #endif 674 641 675 static GstFlowReturn 642 676 gst_fluts_demux_combine_flows (GstFluTSDemux * demux, GstFluTSStream * stream, … … 693 727 pts = filter->pts; 694 728 time = MPEGTIME_TO_GSTTIME (pts) + stream->base_time; 695 696 /* handle wrap arounds sanely */ 697 if (stream->last_time > 0 && time < stream->last_time && 698 stream->last_time - time > MPEGTIME_TO_GSTTIME(G_MAXUINT32)) { 699 /* wrap around occurred */ 700 stream->base_time = stream->base_time + 701 MPEGTIME_TO_GSTTIME((guint64)(1) << 33); 702 time = MPEGTIME_TO_GSTTIME (pts) + stream->base_time; 703 GST_DEBUG_OBJECT (demux, 704 "timestamps wrapped around, compensating with new base time: %" 705 G_GUINT64_FORMAT "last time: %" G_GUINT64_FORMAT " time: %" 706 G_GUINT64_FORMAT, stream->base_time, stream->last_time, time); 707 g_signal_emit (demux, gst_fluts_demux_signals[SIGNAL_WRAPAROUND], 0); 708 stream->last_time = time; 709 } 710 else if (stream->last_time > 0 && time > stream->last_time && 711 time - stream->last_time > MPEGTIME_TO_GSTTIME(G_MAXUINT32) && 712 stream->base_time > 0) { 713 /* had a previous wrap around */ 714 time = time - MPEGTIME_TO_GSTTIME((guint64)(1) << 33); 715 GST_DEBUG_OBJECT (demux, 716 "timestamps wrapped around earlier but we have an out of pts: %" 717 G_GUINT64_FORMAT ", translated to: %" G_GUINT64_FORMAT, pts, time); 718 g_signal_emit (demux, 719 gst_fluts_demux_signals[SIGNAL_WRAPAROUND_OUTOFORDER], 0); 720 } 729 730 if ((stream->last_time > 0 && stream->last_time < time && 731 time - stream->last_time > GST_SECOND * 60 * 10) || ( 732 stream->last_time > time && 733 stream->last_time - time > GST_SECOND * 60 * 10)) { 734 /* check first to see if we're in middle of detecting a discont in PCR. 735 * if we are we're not sure what timestamp the buffer should have, best 736 * to drop. */ 737 if (stream->PMT_pid <= FLUTS_MAX_PID && demux->streams[stream->PMT_pid] && 738 demux->streams[demux->streams[stream->PMT_pid]->PMT.PCR_PID] && 739 demux->streams[demux->streams[stream->PMT_pid]->PMT.PCR_PID]->discont_PCR) { 740 GST_WARNING_OBJECT(demux, "middle of discont, dropping"); 741 goto bad_timestamp; 742 } 743 /* check for wraparounds */ 744 else if (stream->last_time > 0 && time < stream->last_time && 745 stream->last_time - time > MPEGTIME_TO_GSTTIME(G_MAXUINT32)) { 746 /* wrap around occurred */ 747 if (stream->base_time + MPEGTIME_TO_GSTTIME((guint64)(1) << 33) + 748 MPEGTIME_TO_GSTTIME(pts) > stream->last_time + GST_SECOND * 60 * 10) { 749 GST_DEBUG_OBJECT (demux, 750 "looks like we have a corrupt packet because its pts is a lot lower than" 751 " the previous pts but not a wraparound"); 752 goto bad_timestamp; 753 } 754 stream->base_time = stream->base_time + 755 MPEGTIME_TO_GSTTIME((guint64)(1) << 33); 756 time = MPEGTIME_TO_GSTTIME (pts) + stream->base_time; 757 GST_DEBUG_OBJECT (demux, 758 "timestamps wrapped around, compensating with new base time: %" 759 GST_TIME_FORMAT "last time: %" GST_TIME_FORMAT " time: %" 760 GST_TIME_FORMAT, GST_TIME_ARGS(stream->base_time), 761 GST_TIME_ARGS(stream->last_time), GST_TIME_ARGS(time)); 762 stream->last_time = time; 763 } 764 else if (stream->last_time > 0 && time > stream->last_time && 765 time - stream->last_time > MPEGTIME_TO_GSTTIME(G_MAXUINT32) && 766 stream->base_time > 0) { 767 /* had a previous wrap around */ 768 if (time - MPEGTIME_TO_GSTTIME((guint64)(1) << 33) + GST_SECOND * 60 * 10 769 < stream->last_time) { 770 GST_DEBUG_OBJECT (demux, 771 "looks like we have a corrupt packet because its pts is a lot higher than" 772 " the previous pts but not because of a wraparound or pcr discont"); 773 goto bad_timestamp; 774 } 775 GST_DEBUG_OBJECT (demux, 776 "timestamps wrapped around earlier but we have an out of pts: %" 777 G_GUINT64_FORMAT ", as %" GST_TIME_FORMAT " translated to: %" GST_TIME_FORMAT " and last_time of %" 778 GST_TIME_FORMAT, pts, GST_TIME_ARGS(time), GST_TIME_ARGS(time - MPEGTIME_TO_GSTTIME((guint64)(1) << 33)), 779 GST_TIME_ARGS(stream->last_time)); 780 time = time - MPEGTIME_TO_GSTTIME((guint64)(1) << 33); 781 } 782 else { 783 /* we must have a corrupt packet */ 784 GST_WARNING_OBJECT (demux, "looks like we have a corrupt packet because" 785 " its timestamp is buggered timestamp: %" GST_TIME_FORMAT " compared to" 786 " last timestamp: %" GST_TIME_FORMAT, 787 GST_TIME_ARGS(time), GST_TIME_ARGS(stream->last_time)); 788 goto bad_timestamp; 789 } 790 } 721 791 else { /* do not set last_time if a packet with pts from before wrap 722 792 around arrived after the wrap around occured */ … … 729 799 730 800 GST_LOG_OBJECT (demux, "setting PTS to (%" G_GUINT64_FORMAT ") time: %" 731 G _GUINT64_FORMAT " on buffer 0x%x first buffer: %d", pts, time, buffer,732 first);801 GST_TIME_FORMAT " on buffer 0x%x first buffer: %d base_time: %" 802 GST_TIME_FORMAT, pts, GST_TIME_ARGS(time), buffer, first, GST_TIME_ARGS(stream->base_time)); 733 803 734 804 GST_BUFFER_TIMESTAMP (buffer) = time; … … 744 814 stream->stream_type = ST_VIDEO_MPEG2; 745 815 stream->flags &= ~FLUTS_STREAM_FLAG_STREAM_TYPE_UNKNOWN; 816 stream->flags |= FLUTS_STREAM_FLAG_IS_VIDEO; 817 GST_DEBUG_OBJECT (demux, "Found stream 0x%04x without PMT with video " 818 "start_code. Treating as video", stream->PID); 746 819 } else if ((filter->start_code & 0xFFFFFFE0) == PACKET_AUDIO_START_CODE) { 747 820 /* it is mpeg audio */ 748 821 stream->stream_type = ST_AUDIO_MPEG2; 749 822 stream->flags &= ~FLUTS_STREAM_FLAG_STREAM_TYPE_UNKNOWN; 823 GST_DEBUG_OBJECT (demux, "Found stream 0x%04x without PMT with audio " 824 "start_code. Treating as audio", stream->PID); 750 825 } else { 751 826 GST_LOG_OBJECT (demux, "Stream start code on pid 0x%04x is: 0x%x", … … 785 860 return gst_fluts_demux_combine_flows (demux, stream, GST_FLOW_NOT_LINKED); 786 861 } 862 bad_timestamp: 863 { 864 gst_buffer_unref (buffer); 865 return gst_fluts_demux_combine_flows (demux, stream, GST_FLOW_OK); 866 } 867 787 868 } 788 869 … … 816 897 stream->base_PCR = -1; 817 898 stream->last_PCR = -1; 899 stream->last_PCR_difference = -1; 818 900 stream->PMT.version_number = -1; 819 901 stream->PAT.version_number = -1; 902 stream->PMT_pid = FLUTS_MAX_PID + 1; 820 903 stream->flags |= FLUTS_STREAM_FLAG_STREAM_TYPE_UNKNOWN; 821 904 … … 901 984 gst_fluts_activate_pmt (GstFluTSDemux *demux, GstFluTSStream * stream) 902 985 { 986 guint i; 987 903 988 GST_DEBUG_OBJECT (demux, "activating PMT 0x%08x", stream->PID); 904 989 … … 1009 1094 * base_PCR. */ 1010 1095 gst_fluts_demux_get_stream_for_PID (demux, PMT->PCR_PID); 1011 1096 1012 1097 if ((data[0] & 0x0c) != 0x00) 1013 1098 goto wrong_pilen; … … 1065 1150 ES_stream->stream_type = stream_type; 1066 1151 ES_stream->flags &= ~FLUTS_STREAM_FLAG_STREAM_TYPE_UNKNOWN; 1152 1067 1153 /* init base and last time */ 1068 1154 ES_stream->base_time = 0; … … 1071 1157 /* parse descriptor */ 1072 1158 ES_stream->ES_info = gst_mpeg_descriptor_parse (data, ES_info_length); 1159 1160 /* Recognise video streams based on stream_type */ 1161 if (gst_fluts_stream_is_video (ES_stream)) 1162 ES_stream->flags |= FLUTS_STREAM_FLAG_IS_VIDEO; 1163 1073 1164 /* set adaptor */ 1074 1165 gst_pes_filter_init (&ES_stream->filter, NULL); … … 1076 1167 (GstPESFilterData) gst_fluts_demux_data_cb, 1077 1168 (GstPESFilterResync) gst_fluts_demux_resync_cb, ES_stream); 1169 if (ES_stream->flags & FLUTS_STREAM_FLAG_IS_VIDEO) 1170 ES_stream->filter.allow_unbounded = TRUE; 1171 ES_stream->PMT_pid = stream->PID; 1078 1172 } 1079 1173 … … 1271 1365 guint8 length; 1272 1366 guint8 * data_end; 1367 gint i; 1368 GstFluTSStream *pmt_stream; 1273 1369 1274 1370 demux = stream->demux; … … 1286 1382 1287 1383 GST_DEBUG_OBJECT (demux, "flags 0x%02x", flags); 1288 1384 /* discontinuity flag */ 1385 if (flags & 0x80) { 1386 GST_DEBUG_OBJECT (demux, "discontinuity flag set"); 1387 } 1289 1388 /* PCR_flag */ 1290 1389 if (flags & 0x10) { … … 1292 1391 guint16 pcr2; 1293 1392 guint64 pcr, pcr_ext; 1294 1393 gboolean valid_pcr = TRUE; 1394 1295 1395 pcr1 = GST_READ_UINT32_BE (data); 1296 1396 pcr2 = GST_READ_UINT16_BE (data + 4); … … 1300 1400 if (pcr_ext) 1301 1401 pcr = (pcr * 300 + pcr_ext % 300) / 300; 1302 GST_DEBUG_OBJECT (demux, "have PCR %" G_GUINT64_FORMAT " on PID 0x%04x", 1303 pcr, stream->PID); 1304 stream->last_PCR = pcr; 1402 GST_DEBUG_OBJECT (demux, "have PCR %" G_GUINT64_FORMAT " on PID 0x%04x " 1403 "and last pcr is %" G_GUINT64_FORMAT, 1404 pcr, stream->PID, stream->last_PCR); 1405 /* pcr has been converted into units of 90Khz ticks 1406 * so assume discont if last pcr was > 900000 (10 second) lower */ 1407 if (stream->last_PCR != -1 && 1408 (pcr - stream->last_PCR > 900000 || 1409 pcr < stream->last_PCR)) { 1410 GstClockTimeDiff base_time_difference; 1411 GST_DEBUG_OBJECT (demux, 1412 "looks like we have a discont, this pcr should really be approx: %" 1413 G_GUINT64_FORMAT, stream->last_PCR + stream->last_PCR_difference); 1414 if (stream->discont_PCR == FALSE) { 1415 if (pcr > stream->last_PCR) { 1416 base_time_difference = -MPEGTIME_TO_GSTTIME((pcr - 1417 (stream->last_PCR + stream->last_PCR_difference))); 1418 } 1419 else { 1420 base_time_difference = MPEGTIME_TO_GSTTIME((stream->last_PCR + 1421 stream->last_PCR_difference) - pcr); 1422 } 1423 stream->discont_PCR = TRUE; 1424 stream->discont_difference = base_time_difference; 1425 valid_pcr = FALSE; 1426 } 1427 else { 1428 GstClockTimeDiff base_time_difference; 1429 /* need to check pmt pid in case this pcr is before it's 1430 * associated with a pmt */ 1431 if (stream->PMT_pid <= FLUTS_MAX_PID) { 1432 /* checking the pcr discont is similar this second time 1433 * if similar, update the es pids 1434 * if not, assume it's a false discont due to corruption 1435 * or other */ 1436 if (pcr > stream->last_PCR) { 1437 base_time_difference = -MPEGTIME_TO_GSTTIME((pcr - 1438 (stream->last_PCR + stream->last_PCR_difference))); 1439 } 1440 else { 1441 base_time_difference = MPEGTIME_TO_GSTTIME((stream->last_PCR + 1442 stream->last_PCR_difference) - pcr); 1443 } 1444 if ((base_time_difference - stream->discont_difference > 0 && 1445 base_time_difference - stream->discont_difference < GST_SECOND * 10) || 1446 (stream->discont_difference - base_time_difference > 0 && 1447 stream->discont_difference -base_time_difference < GST_SECOND * 10)) { 1448 GST_DEBUG_OBJECT (demux, "Updating base_time on all es pids belonging" 1449 " to PMT 0x%02x", stream->PMT_pid); 1450 pmt_stream = demux->streams[stream->PMT_pid]; 1451 for (i = 0; i <= pmt_stream->PMT.entries->len; i++) { 1452 GstFluTSPMTEntry *cur_entry = 1453 &g_array_index(pmt_stream->PMT.entries, GstFluTSPMTEntry, i); 1454 GST_DEBUG_OBJECT (demux, "Updating base time on pid 0x%02x by %" 1455 G_GINT64_FORMAT, cur_entry->PID, stream->discont_difference); 1456 if (cur_entry->PID <= FLUTS_MAX_PID && demux->streams[cur_entry->PID]) { 1457 demux->streams[cur_entry->PID]->base_time += 1458 stream->discont_difference; 1459 } 1460 } 1461 stream->base_PCR = pcr; 1462 } 1463 else { 1464 GST_DEBUG_OBJECT(demux, "last PCR discont looked to be bogus: " 1465 "previous discont difference %" G_GINT64_FORMAT " now %" G_GINT64_FORMAT, 1466 stream->discont_difference, 1467 base_time_difference); 1468 valid_pcr = FALSE; 1469 } 1470 1471 } 1472 stream->discont_PCR = FALSE; 1473 stream->discont_difference = 0; 1474 } 1475 } 1476 else if (stream->last_PCR != -1) stream->last_PCR_difference = pcr - stream->last_PCR; 1477 GST_DEBUG_OBJECT (demux, "last PCR difference: %" G_GUINT64_FORMAT, stream->last_PCR_difference); 1478 if (valid_pcr) stream->last_PCR = pcr; 1305 1479 data += 6; 1306 1480 } … … 1611 1785 adaptation_field_control = (data[2] & 0x30) >> 4; 1612 1786 continuity_counter = data[2] & 0x0f; 1787 1788 if (PID == 0xa2) { 1789 GST_DEBUG ("scrambling %d indicator %d", 1790 transport_scrambling_control, payload_unit_start_indicator); 1791 1792 if (payload_unit_start_indicator) { 1793 GST_DEBUG ("break"); 1794 } 1795 } 1613 1796 1614 1797 data += 3; … … 1748 1931 1749 1932 if (payload_unit_start_indicator) { 1933 if (PID == 0xa2) { 1934 GST_DEBUG ("asd"); 1935 } 1750 1936 GST_DEBUG_OBJECT (demux, "new PES start for PID 0x%04x", PID); 1751 1937 gst_pes_filter_drain (&stream->filter); … … 1753 1939 GST_LOG_OBJECT (demux, "Elementary packet of size %u for PID 0x%04x", 1754 1940 datalen, PID); 1941 1755 1942 if (datalen > 0) { 1756 1943 es_buf = gst_buffer_create_sub (buf, data - GST_BUFFER_DATA (buf), … … 1806 1993 1807 1994 /* we consumed the sync byte */ 1995 #ifdef HAVE_ADAPTER_TAKE_BUF 1808 1996 buf = gst_adapter_take_buffer (demux->adapter, 187); 1809 1997 g_return_val_if_fail (buf != NULL, GST_FLOW_ERROR); 1998 #else 1999 /* Compatibility path for GStreamer < 0.10.6 */ 2000 buf = gst_buffer_new_and_alloc (187); 2001 g_return_val_if_fail (buf != NULL, GST_FLOW_ERROR); 2002 2003 data = gst_adapter_peek (demux->adapter, 187); 2004 g_return_val_if_fail (data != NULL, GST_FLOW_ERROR); 2005 memcpy (GST_BUFFER_DATA (buf), data, 187); 2006 #endif 1810 2007 1811 2008 data = GST_BUFFER_DATA (buf); … … 1933 2130 return TRUE; 1934 2131 } 2132 2133 #ifndef GST_BUFFER_IS_DISCONT 2134 #define GST_BUFFER_IS_DISCONT(buffer) (GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DISCONT)) 2135 #endif 1935 2136 1936 2137 static GstFlowReturn … … 2045 2246 2046 2247 for (i = 0; i < PMT->entries->len; i++) { 2248 GstFluTSStream *stream; 2047 2249 FluTsPmtStreamInfo *stream_info; 2048 2250 GstFluTSPMTEntry *cur_entry = 2049 2251 &g_array_index(PMT->entries, GstFluTSPMTEntry, i); 2050 2252 2051 stream_info = fluts_pmt_stream_info_new (cur_entry->PID); 2052 if (demux->streams[cur_entry->PID]->ES_info) { 2253 stream = demux->streams [cur_entry->PID]; 2254 stream_info = fluts_pmt_stream_info_new (cur_entry->PID, stream->stream_type); 2255 2256 if (stream->ES_info) { 2053 2257 int i; 2054 2258 /* add languages */ 2055 2259 guint8 *iso639_languages = gst_mpeg_descriptor_find( 2056 demux->streams[cur_entry->PID]->ES_info, DESC_ISO_639_LANGUAGE);2260 stream->ES_info, DESC_ISO_639_LANGUAGE); 2057 2261 if (iso639_languages) { 2058 2262 for(i=0;i<DESC_ISO_639_LANGUAGE_codes_n(iso639_languages);i++) { … … 2061 2265 fluts_pmt_stream_info_add_language(stream_info, g_strndup(language_n, 3)); 2062 2266 } 2267 } 2268 2269 for (i = 0; i < gst_mpeg_descriptor_n_desc (stream->ES_info); ++i) { 2270 guint8 *desc = gst_mpeg_descriptor_nth (stream->ES_info, i); 2271 2272 /* add the whole descriptor, tag + length + DESC_LENGTH bytes */ 2273 fluts_pmt_stream_info_add_descriptor (stream_info, 2274 desc, 2 + DESC_LENGTH (desc)); 2063 2275 } 2064 2276 } -
branches/dvb-si-1/src/gstmpegtsdemux.h
r613 r792 82 82 typedef enum _FluTsStreamFlags { 83 83 FLUTS_STREAM_FLAG_STREAM_TYPE_UNKNOWN = 0x01, 84 FLUTS_STREAM_FLAG_PMT_VALID = 0x02 84 FLUTS_STREAM_FLAG_PMT_VALID = 0x02, 85 FLUTS_STREAM_FLAG_IS_VIDEO = 0x04 85 86 } FluTsStreamFlags; 86 87 … … 99 100 guint64 base_PCR; 100 101 guint64 last_OPCR; 102 guint64 last_PCR_difference; 103 gboolean discont_PCR; 104 GstClockTimeDiff discont_difference; 101 105 102 106 /* for PAT streams */ … … 119 123 GstMPEGDescriptor *ES_info; 120 124 /* needed because 33bit mpeg timestamps wrap around every (approx) 26.5 hrs */ 121 GstClockTime base_time;125 GstClockTimeDiff base_time; 122 126 GstClockTime last_time; 127 /* pid of PMT that this stream belongs to */ 128 guint16 PMT_pid; 123 129 }; 124 130 #ifndef __GST_FLUTS_DEMUX_DVBTABLES_H__ -
branches/dvb-si-1/src/gstpesfilter.c
r588 r792 46 46 filter->state = STATE_HEADER_PARSE; 47 47 filter->gather_pes = FALSE; 48 filter->allow_unbounded = FALSE; 48 49 } 49 50 … … 85 86 return ((sync & 0xfffffffc) == 0x000001bc) || 86 87 ((sync & 0xffffffe0) == 0x000001c0) || 88 ((sync & 0xfffffff0) == 0x000001f0) || 87 89 ((sync & 0xfffffff0) == 0x000001e0); 88 90 } … … 127 129 * streams, but actually a 0 sized packet in program streams or 128 130 * for anything except video packets */ 131 132 /* FIXME: Remove this hack that is checking start_code. Instead, we need 133 * a callback that a start_code has been collected, giving the caller a chance 134 * to set the allow_unbounded flag if they want */ 129 135 if (filter->length == 0 && 130 (filter->start_code & 0xFFFFFFF0) == PACKET_VIDEO_START_CODE) { 136 ((filter->start_code & 0xFFFFFFF0) == PACKET_VIDEO_START_CODE || 137 filter->allow_unbounded)) { 131 138 GST_DEBUG ("id 0x%02x, unbounded length", filter->id); 132 139 filter->unbounded_packet = TRUE; -
branches/dvb-si-1/src/gstpesfilter.h
r588 r792 46 46 * outputting */ 47 47 gboolean gather_pes; 48 /* Whether unbounded packets are allowed in this 49 * stream */ 50 gboolean allow_unbounded; 48 51 49 52 gboolean first;
