[gst-devel] Muxing subtitles to matroska [Was: Re: dvdsrc status update, sundry questions]
Michal Benes
michal.benes at itonis.tv
Wed Dec 13 09:43:59 CET 2006
Mark Nauwelaerts píše v St 13. 12. 2006 v 00:03 +0100:
> Wim Taymans wrote:
> > On Fri, 2006-12-08 at 17:42 -0700, Jason Gerard DeRose wrote:
> >> Hello everyone,
> > Hi,
> >>
> >> 3) Is 'videomixer' suitable for overlaying the decoded subtitles? Once I
> >> have dvdsubdec working again, is 'videomixer' what should be used?
> >
> > For DVD I would create a subtitle mixer that takes video on one pad and
> > the encoded subpicture on another pad. The element is purely chain
> > based, for each video picture received it blends (while unpacking) the
> > current subtitle on top of it (with matching timestamps, of course).
> > When you connect the demuxers subtitle pad directly to the subtitle
> > decoder/mixer and the raw video path of the video decoder to the mixer
> > video path, you will get the subpicture before the video frames it
> > applies to. You can insert an order-preserving queue (like decodebin2
> > does) to make sure none of the video/subtitle streams run ahead of
> > eachother (multiqueue).
>
> Small question on this.
> It seems that this (new) mixer element (with the techniques as given above) has
> much to do with "programming around" the limitations of collectpads (in dealing
> with sparse streams like subtitles) that is used in e.g. videomixer (?)
>
> Could it be helpful / somehow possible to (re-)use the techniques given above in
> a sort of upgraded collectpads that could then also be of use to muxers that
> might be interested/capable in muxing subtitles, e.g. a matroskamux ?
Hi Mark,
I have a simple hack that does this. However it is a hack, therefore I
never tried to commit it upstream. The technique is according to
docs/design/part-sparsestreams.txt
Since collectpads is not yet handling update NEWSEGMENTS properly, I
handle them in matroskamux. I catch the update NEWSEGMENT events at
sinks and transform them to empty buffers (which I call "filler
buffers"). Collectpads class is happy with these buffers and calls
gst_matroska_mux_collected method (in which I discard filler buffers
again)
This is the relevant part of gst_matroska_mux_handle_sink_event
case GST_EVENT_NEWSEGMENT:
{
gint64 start, stop, time;
gdouble rate;
GstFormat format;
gboolean update;
gst_event_parse_new_segment (event, &update, &rate, &format,
&start, &stop, &time);
/* Send a filler buffer to the pad
if an update new-segment event has been received. */
if (update && (format == GST_FORMAT_TIME)) {
GstBuffer *buffer = gst_buffer_new_and_alloc (0);
GST_BUFFER_TIMESTAMP (buffer) = time;
gst_pad_chain (pad, buffer);
}
break;
}
Unfortunately, I am not able to post the complete patch, because it is
mixed with my other hack and it would be complicated to separate these
two.
Michal
More information about the gstreamer-devel
mailing list