diff options
author | Tim-Philipp Müller <tim.muller@collabora.co.uk> | 2011-02-02 17:23:43 +0000 |
---|---|---|
committer | Tim-Philipp Müller <tim.muller@collabora.co.uk> | 2011-02-02 17:34:41 +0000 |
commit | 2eac43bd73ff405c6883c1c2476a90a123b52159 (patch) | |
tree | 598b5eb73e1efae84d42ab31313c2553a275d98d | |
parent | 440002a137640db2c5d6613d9bf56dfff997eb07 (diff) |
oggmux: keep IN_CAPS flag check for header buffers as fallback
In case the ogg mapper doesn't handle all the accepted input formats
(although it really should). Saves us error handling for that case
though. Also log caps properly.
https://bugzilla.gnome.org/show_bug.cgi?id=629196
-rw-r--r-- | ext/ogg/gstoggmux.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/ext/ogg/gstoggmux.c b/ext/ogg/gstoggmux.c index 984b89035..6dfbf612c 100644 --- a/ext/ogg/gstoggmux.c +++ b/ext/ogg/gstoggmux.c @@ -775,25 +775,34 @@ gst_ogg_mux_queue_pads (GstOggMux * ogg_mux) if (pad->state == GST_OGG_PAD_STATE_CONTROL) { /* and we have one */ ogg_packet packet; + gboolean is_header; + packet.packet = GST_BUFFER_DATA (buf); packet.bytes = GST_BUFFER_SIZE (buf); + + if (GST_BUFFER_OFFSET_END_IS_VALID (buf)) packet.granulepos = GST_BUFFER_OFFSET_END (buf); - if (packet.granulepos == -1) + else packet.granulepos = 0; /* if we're not yet in data mode, ensure we're setup on the first packet */ if (!pad->have_type) { pad->have_type = gst_ogg_stream_setup_map (&pad->map, &packet); if (!pad->have_type) { - pad->map.caps = - gst_caps_new_simple ("application/x-unknown", NULL); + GST_ERROR_OBJECT (pad, "mapper didn't recognise input stream " + "(pad caps: %" GST_PTR_FORMAT ")", GST_PAD_CAPS (pad)); + } else { + GST_DEBUG_OBJECT (pad, "caps detected: %" GST_PTR_FORMAT, + pad->map.caps); } - GST_DEBUG_OBJECT (ogg_mux, "New pad has caps: %s", - gst_caps_to_string (pad->map.caps)); } + if (pad->have_type) + is_header = gst_ogg_stream_packet_is_header (&pad->map, &packet); + else /* fallback (FIXME 0.11: remove IN_CAPS hack) */ + is_header = GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_IN_CAPS); - if (gst_ogg_stream_packet_is_header (&pad->map, &packet)) { + if (is_header) { GST_DEBUG_OBJECT (ogg_mux, "got header buffer in control state, ignoring"); /* just ignore */ |