mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-10-22 02:13:46 +00:00
ext/ogg/gstoggparse.c: Set caps on pushed buffers; fix up refcounting of caps objects.
Original commit message from CVS: * ext/ogg/gstoggparse.c: (gst_ogg_parse_dispose), (gst_ogg_parse_append_header), (gst_ogg_parse_chain): Set caps on pushed buffers; fix up refcounting of caps objects.
This commit is contained in:
parent
6de67fa3c2
commit
107c7bf894
2 changed files with 32 additions and 6 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2006-10-20 Michael Smith <msmith@fluendo.com>
|
||||||
|
|
||||||
|
* ext/ogg/gstoggparse.c: (gst_ogg_parse_dispose),
|
||||||
|
(gst_ogg_parse_append_header), (gst_ogg_parse_chain):
|
||||||
|
Set caps on pushed buffers; fix up refcounting of caps objects.
|
||||||
|
|
||||||
2006-10-19 Tim-Philipp Müller <tim at centricular dot net>
|
2006-10-19 Tim-Philipp Müller <tim at centricular dot net>
|
||||||
|
|
||||||
* gst/typefind/gsttypefindfunctions.c: (mmsh_type_find),
|
* gst/typefind/gsttypefindfunctions.c: (mmsh_type_find),
|
||||||
|
|
|
@ -89,6 +89,8 @@ struct _GstOggParse
|
||||||
gboolean last_page_not_bos; /* Set if we've seen a non-BOS page */
|
gboolean last_page_not_bos; /* Set if we've seen a non-BOS page */
|
||||||
|
|
||||||
ogg_sync_state sync; /* Ogg page synchronisation */
|
ogg_sync_state sync; /* Ogg page synchronisation */
|
||||||
|
|
||||||
|
GstCaps *caps; /* Our src caps */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstOggParseClass
|
struct _GstOggParseClass
|
||||||
|
@ -269,6 +271,11 @@ gst_ogg_parse_dispose (GObject * object)
|
||||||
ogg_sync_clear (&ogg->sync);
|
ogg_sync_clear (&ogg->sync);
|
||||||
gst_ogg_parse_delete_all_streams (ogg);
|
gst_ogg_parse_delete_all_streams (ogg);
|
||||||
|
|
||||||
|
if (ogg->caps) {
|
||||||
|
gst_caps_unref (ogg->caps);
|
||||||
|
ogg->caps = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (G_OBJECT_CLASS (parent_class)->dispose)
|
if (G_OBJECT_CLASS (parent_class)->dispose)
|
||||||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
||||||
}
|
}
|
||||||
|
@ -302,11 +309,13 @@ static void
|
||||||
gst_ogg_parse_append_header (GValue * array, GstBuffer * buf)
|
gst_ogg_parse_append_header (GValue * array, GstBuffer * buf)
|
||||||
{
|
{
|
||||||
GValue value = { 0 };
|
GValue value = { 0 };
|
||||||
|
/* We require a copy to avoid circular refcounts */
|
||||||
|
GstBuffer *buffer = gst_buffer_copy (buf);
|
||||||
|
|
||||||
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_IN_CAPS);
|
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_IN_CAPS);
|
||||||
|
|
||||||
g_value_init (&value, GST_TYPE_BUFFER);
|
g_value_init (&value, GST_TYPE_BUFFER);
|
||||||
gst_value_set_buffer (&value, buf);
|
gst_value_set_buffer (&value, buffer);
|
||||||
gst_value_array_append_value (array, &value);
|
gst_value_array_append_value (array, &value);
|
||||||
g_value_unset (&value);
|
g_value_unset (&value);
|
||||||
|
|
||||||
|
@ -548,7 +557,9 @@ gst_ogg_parse_chain (GstPad * pad, GstBuffer * buffer)
|
||||||
|
|
||||||
g_value_unset (&array);
|
g_value_unset (&array);
|
||||||
|
|
||||||
// gst_caps_free(caps);
|
if (ogg->caps)
|
||||||
|
gst_caps_unref (ogg->caps);
|
||||||
|
ogg->caps = caps;
|
||||||
|
|
||||||
GST_LOG_OBJECT (ogg, "Set \"streamheader\" caps with %d buffers "
|
GST_LOG_OBJECT (ogg, "Set \"streamheader\" caps with %d buffers "
|
||||||
"(one per page)", count);
|
"(one per page)", count);
|
||||||
|
@ -556,9 +567,11 @@ gst_ogg_parse_chain (GstPad * pad, GstBuffer * buffer)
|
||||||
/* Now, we do the same thing, but push buffers... */
|
/* Now, we do the same thing, but push buffers... */
|
||||||
for (l = ogg->oggstreams; l != NULL; l = l->next) {
|
for (l = ogg->oggstreams; l != NULL; l = l->next) {
|
||||||
GstOggStream *stream = (GstOggStream *) l->data;
|
GstOggStream *stream = (GstOggStream *) l->data;
|
||||||
|
GstBuffer *buf = GST_BUFFER (stream->headers->data);
|
||||||
|
|
||||||
result = gst_pad_push (ogg->srcpad,
|
gst_buffer_set_caps (buf, caps);
|
||||||
GST_BUFFER (stream->headers->data));
|
|
||||||
|
result = gst_pad_push (ogg->srcpad, buf);
|
||||||
if (result != GST_FLOW_OK)
|
if (result != GST_FLOW_OK)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -567,8 +580,11 @@ gst_ogg_parse_chain (GstPad * pad, GstBuffer * buffer)
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
for (j = 1; j < g_slist_length (stream->headers); j++) {
|
for (j = 1; j < g_slist_length (stream->headers); j++) {
|
||||||
result = gst_pad_push (ogg->srcpad,
|
GstBuffer *buf =
|
||||||
GST_BUFFER (g_slist_nth_data (stream->headers, j)));
|
GST_BUFFER (g_slist_nth_data (stream->headers, j));
|
||||||
|
gst_buffer_set_caps (buf, caps);
|
||||||
|
|
||||||
|
result = gst_pad_push (ogg->srcpad, buf);
|
||||||
if (result != GST_FLOW_OK)
|
if (result != GST_FLOW_OK)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -597,6 +613,7 @@ gst_ogg_parse_chain (GstPad * pad, GstBuffer * buffer)
|
||||||
GstBuffer *buf;
|
GstBuffer *buf;
|
||||||
|
|
||||||
buf = GST_BUFFER (k->data);
|
buf = GST_BUFFER (k->data);
|
||||||
|
gst_buffer_set_caps (buf, caps);
|
||||||
result = gst_pad_push (ogg->srcpad, buf);
|
result = gst_pad_push (ogg->srcpad, buf);
|
||||||
if (result != GST_FLOW_OK)
|
if (result != GST_FLOW_OK)
|
||||||
return result;
|
return result;
|
||||||
|
@ -607,11 +624,14 @@ gst_ogg_parse_chain (GstPad * pad, GstBuffer * buffer)
|
||||||
stream->unknown_pages = NULL;
|
stream->unknown_pages = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gst_buffer_set_caps (pagebuffer, caps);
|
||||||
|
|
||||||
result = gst_pad_push (ogg->srcpad, GST_BUFFER (pagebuffer));
|
result = gst_pad_push (ogg->srcpad, GST_BUFFER (pagebuffer));
|
||||||
if (result != GST_FLOW_OK)
|
if (result != GST_FLOW_OK)
|
||||||
return result;
|
return result;
|
||||||
} else {
|
} else {
|
||||||
/* Normal data page, submit buffer */
|
/* Normal data page, submit buffer */
|
||||||
|
gst_buffer_set_caps (pagebuffer, ogg->caps);
|
||||||
result = gst_pad_push (ogg->srcpad, GST_BUFFER (pagebuffer));
|
result = gst_pad_push (ogg->srcpad, GST_BUFFER (pagebuffer));
|
||||||
if (result != GST_FLOW_OK)
|
if (result != GST_FLOW_OK)
|
||||||
return result;
|
return result;
|
||||||
|
|
Loading…
Reference in a new issue