gstmpegtsdemux: add temporary **HACK** for dvb subs testing so dvbsuboverlay gets...
authorMart Raudsepp <mart.raudsepp@collabora.co.uk>
Mon, 29 Nov 2010 20:10:17 +0000 (20:10 +0000)
committerEdward Hervey <edward.hervey@collabora.co.uk>
Wed, 8 Dec 2010 15:30:09 +0000 (16:30 +0100)
<tpm> leio, what's the mpegts demux hack about?
<leio> my libdvbsub code can't handle cut packets
<leio> so the hack instructs the demuxer to gather full packets before pushing down, but it applies that to more PES packet types than just dvbsub, but I'm not sure if that's a bad thing
<leio> either way, needs a cleaner solution, either in demuxer, or I need to handle cut packets
<tpm> ok, but really it should be fixed in the overlay, right?
<tpm> or a parser be inserted
<leio> the problem is that I don't know from the first packet beforehand if it is a cut one or no
<leio> not
<leio> err, first buffer
<leio> just when I receive the next one I see if it has a valid timestamp on it or not
<leio> so I can't very well queue it up in the chain either, I might be blocking the very last subtitle for no reason or something
<tpm> but you could just drop/ignore packets until you find one, right?
<leio> find what?
<tpm> a complete packet?
<leio> the problem isn't that they aren't complete
<leio> the problem is that they are cut across multiple GstBuffers by the demuxer without the hack
<tpm> sure, I understand that
<tpm> but you can't easily determine if a GstBuffer contains he start fragment of a packet or not?
<leio> I guess I could parse the packet and see if its length is enough, just like the libdvbsub code eventually does too
<leio> I can, it has a timestamp if it's the first chunk
<leio> I just never know if I need to wait for more, without some parsing
<tpm> ah ok
<leio> while the demuxer could just give me an uncut one in the first place
<leio> like it always does for program streams
<leio> that gather_pes is always set in gstmpegdemux, but not in gstmpegtsdemux

gst/mpegdemux/gstmpegtsdemux.c

index 865dce2..0dd8d7d 100644 (file)
@@ -1469,7 +1469,15 @@ gst_mpegts_stream_parse_pmt (GstMpegTSStream * stream,
           ES_stream->flags |= MPEGTS_STREAM_FLAG_IS_VIDEO;
 
         /* set adaptor */
+        GST_LOG ("Initializing PES filter for PID %u", ES_stream->PID);
         gst_pes_filter_init (&ES_stream->filter, NULL, NULL);
+        if (ES_stream->stream_type == ST_PRIVATE_DATA) {
+          GST_FIXME ("Stream type is ST_PRIVATE_DATA, setting "
+              "filter->gather_pes as a HACK");
+          /* FIXME: There's another place where pes filters could get
+           * initialized. Might need similar temporary hack there as well */
+          ES_stream->filter.gather_pes = TRUE;
+        }
         gst_pes_filter_set_callbacks (&ES_stream->filter,
             (GstPESFilterData) gst_mpegts_demux_data_cb,
             (GstPESFilterResync) gst_mpegts_demux_resync_cb, ES_stream);
@@ -2298,6 +2306,7 @@ gst_mpegts_demux_parse_stream (GstMpegTSDemux * demux, GstMpegTSStream * stream,
         }
 
         /* Initialise our PES filter */
+        GST_LOG ("Initializing PES filter for PID %u", stream->PID);
         gst_pes_filter_init (&stream->filter, NULL, NULL);
         gst_pes_filter_set_callbacks (&stream->filter,
             (GstPESFilterData) gst_mpegts_demux_data_cb,