mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-04 22:48:49 +00:00
qtdemux: push new caps events when caps change
Whenever the demuxer has a new caps on a stream, it should set the new_caps variable to true and a new caps event will be pushed before the next buffer
This commit is contained in:
parent
725faab590
commit
a0e934e72e
1 changed files with 14 additions and 1 deletions
|
@ -200,6 +200,8 @@ struct _QtDemuxStream
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
guint32 fourcc;
|
guint32 fourcc;
|
||||||
|
|
||||||
|
gboolean new_caps;
|
||||||
|
|
||||||
/* if the stream has a redirect URI in its headers, we store it here */
|
/* if the stream has a redirect URI in its headers, we store it here */
|
||||||
gchar *redirect_uri;
|
gchar *redirect_uri;
|
||||||
|
|
||||||
|
@ -447,6 +449,8 @@ static void gst_qtdemux_stream_free (GstQTDemux * qtdemux,
|
||||||
QtDemuxStream * stream);
|
QtDemuxStream * stream);
|
||||||
static void gst_qtdemux_stream_clear (QtDemuxStream * stream);
|
static void gst_qtdemux_stream_clear (QtDemuxStream * stream);
|
||||||
static GstFlowReturn qtdemux_prepare_streams (GstQTDemux * qtdemux);
|
static GstFlowReturn qtdemux_prepare_streams (GstQTDemux * qtdemux);
|
||||||
|
static void qtdemux_do_allocation (GstQTDemux * qtdemux,
|
||||||
|
QtDemuxStream * stream);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_qtdemux_class_init (GstQTDemuxClass * klass)
|
gst_qtdemux_class_init (GstQTDemuxClass * klass)
|
||||||
|
@ -1702,6 +1706,7 @@ gst_qtdemux_setcaps (GstQTDemux * demux, GstCaps * caps)
|
||||||
if (!stream->caps || !gst_caps_is_equal_fixed (mediacaps, stream->caps)) {
|
if (!stream->caps || !gst_caps_is_equal_fixed (mediacaps, stream->caps)) {
|
||||||
GST_DEBUG_OBJECT (demux, "We have a new caps %" GST_PTR_FORMAT,
|
GST_DEBUG_OBJECT (demux, "We have a new caps %" GST_PTR_FORMAT,
|
||||||
mediacaps);
|
mediacaps);
|
||||||
|
stream->new_caps = TRUE;
|
||||||
}
|
}
|
||||||
gst_caps_replace (&stream->caps, (GstCaps *) mediacaps);
|
gst_caps_replace (&stream->caps, (GstCaps *) mediacaps);
|
||||||
structure = gst_caps_get_structure (mediacaps, 0);
|
structure = gst_caps_get_structure (mediacaps, 0);
|
||||||
|
@ -4047,6 +4052,10 @@ gst_qtdemux_loop_state_movie (GstQTDemux * qtdemux)
|
||||||
}
|
}
|
||||||
|
|
||||||
stream = qtdemux->streams[index];
|
stream = qtdemux->streams[index];
|
||||||
|
if (stream->new_caps) {
|
||||||
|
gst_qtdemux_configure_stream (qtdemux, stream);
|
||||||
|
qtdemux_do_allocation (qtdemux, stream);
|
||||||
|
}
|
||||||
|
|
||||||
/* fetch info for the current sample of this stream */
|
/* fetch info for the current sample of this stream */
|
||||||
if (G_UNLIKELY (!gst_qtdemux_prepare_current_sample (qtdemux, stream, &offset,
|
if (G_UNLIKELY (!gst_qtdemux_prepare_current_sample (qtdemux, stream, &offset,
|
||||||
|
@ -4751,6 +4760,10 @@ gst_qtdemux_chain (GstPad * sinkpad, GstObject * parent, GstBuffer * inbuf)
|
||||||
if (G_UNLIKELY (stream == NULL || i == demux->n_streams))
|
if (G_UNLIKELY (stream == NULL || i == demux->n_streams))
|
||||||
goto unknown_stream;
|
goto unknown_stream;
|
||||||
|
|
||||||
|
if (stream->new_caps) {
|
||||||
|
gst_qtdemux_configure_stream (demux, stream);
|
||||||
|
}
|
||||||
|
|
||||||
/* Put data in a buffer, set timestamps, caps, ... */
|
/* Put data in a buffer, set timestamps, caps, ... */
|
||||||
outbuf = gst_adapter_take_buffer (demux->adapter, demux->neededbytes);
|
outbuf = gst_adapter_take_buffer (demux->adapter, demux->neededbytes);
|
||||||
GST_DEBUG_OBJECT (demux, "stream : %" GST_FOURCC_FORMAT,
|
GST_DEBUG_OBJECT (demux, "stream : %" GST_FOURCC_FORMAT,
|
||||||
|
@ -5578,7 +5591,7 @@ gst_qtdemux_configure_stream (GstQTDemux * qtdemux, QtDemuxStream * stream)
|
||||||
gst_pad_push_event (stream->pad, gst_event_new_stream_start (stream_id));
|
gst_pad_push_event (stream->pad, gst_event_new_stream_start (stream_id));
|
||||||
g_free (stream_id);
|
g_free (stream_id);
|
||||||
gst_pad_set_caps (stream->pad, stream->caps);
|
gst_pad_set_caps (stream->pad, stream->caps);
|
||||||
|
stream->new_caps = FALSE;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue