[gst-cvs] gst-plugins-base: ogg: Some more minor adjustments for the VP8 Ogg mapping

Sebastian Dröge slomo at kemper.freedesktop.org
Wed May 19 23:55:21 PDT 2010


Module: gst-plugins-base
Branch: master
Commit: 563a96ef1a466248ead802c8ce5ea89604d00e5f
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-base/commit/?id=563a96ef1a466248ead802c8ce5ea89604d00e5f

Author: Sebastian Dröge <sebastian.droege at collabora.co.uk>
Date:   Thu May 20 08:52:49 2010 +0200

ogg: Some more minor adjustments for the VP8 Ogg mapping

---

 ext/ogg/gstoggdemux.c  |    8 ++++----
 ext/ogg/gstoggstream.c |   27 ++++++++++-----------------
 2 files changed, 14 insertions(+), 21 deletions(-)

diff --git a/ext/ogg/gstoggdemux.c b/ext/ogg/gstoggdemux.c
index 3b69d99..c05da7f 100644
--- a/ext/ogg/gstoggdemux.c
+++ b/ext/ogg/gstoggdemux.c
@@ -466,7 +466,7 @@ gst_ogg_demux_chain_peer (GstOggPad * pad, ogg_packet * packet,
       }
     }
   } else if (pad->map.is_vp8) {
-    if (packet->bytes >= 7 && memcmp (packet->packet, "OggVP8 ", 7) == 0) {
+    if (packet->bytes >= 7 && memcmp (packet->packet, "OVP80\2 ", 7) == 0) {
       GstTagList *tags;
 
       buf = gst_buffer_new ();
@@ -475,7 +475,7 @@ gst_ogg_demux_chain_peer (GstOggPad * pad, ogg_packet * packet,
       GST_BUFFER_SIZE (buf) = packet->bytes;
 
       tags = gst_tag_list_from_vorbiscomment_buffer (buf,
-          (const guint8 *) "OggVP8 ", 7, NULL);
+          (const guint8 *) "OVP80\2 ", 7, NULL);
       gst_buffer_unref (buf);
       buf = NULL;
 
@@ -490,8 +490,8 @@ gst_ogg_demux_chain_peer (GstOggPad * pad, ogg_packet * packet,
       /* We don't push header packets for VP8 */
       cret = gst_ogg_demux_combine_flows (ogg, pad, GST_FLOW_OK);
       goto done;
-    } else if (packet->b_o_s || (packet->bytes >= 4
-            && memcmp (packet->packet, "/VP8 ", 4) == 0)) {
+    } else if (packet->b_o_s || (packet->bytes >= 6
+            && memcmp (packet->packet, "OVP80\1", 4) == 0)) {
       /* We don't push header packets for VP8 */
       cret = gst_ogg_demux_combine_flows (ogg, pad, GST_FLOW_OK);
       goto done;
diff --git a/ext/ogg/gstoggstream.c b/ext/ogg/gstoggstream.c
index 32ed839..53db77b 100644
--- a/ext/ogg/gstoggstream.c
+++ b/ext/ogg/gstoggstream.c
@@ -495,17 +495,17 @@ setup_vp8_mapper (GstOggStream * pad, ogg_packet * packet)
 {
   gint width, height, par_n, par_d, fps_n, fps_d;
 
-  if (packet->bytes < 24) {
+  if (packet->bytes < 26) {
     GST_DEBUG ("Failed to parse VP8 BOS page");
     return FALSE;
   }
 
-  width = GST_READ_UINT16_BE (packet->packet + 6);
-  height = GST_READ_UINT16_BE (packet->packet + 8);
-  par_n = GST_READ_UINT24_BE (packet->packet + 10);
-  par_d = GST_READ_UINT24_BE (packet->packet + 13);
-  fps_n = GST_READ_UINT32_BE (packet->packet + 16);
-  fps_d = GST_READ_UINT32_BE (packet->packet + 20);
+  width = GST_READ_UINT16_BE (packet->packet + 8);
+  height = GST_READ_UINT16_BE (packet->packet + 10);
+  par_n = GST_READ_UINT24_BE (packet->packet + 12);
+  par_d = GST_READ_UINT24_BE (packet->packet + 15);
+  fps_n = GST_READ_UINT32_BE (packet->packet + 18);
+  fps_d = GST_READ_UINT32_BE (packet->packet + 22);
 
   pad->is_vp8 = TRUE;
   pad->granulerate_n = fps_n;
@@ -595,16 +595,9 @@ granulepos_to_key_granule_vp8 (GstOggStream * pad, gint64 granulepos)
 static gboolean
 is_header_vp8 (GstOggStream * pad, ogg_packet * packet)
 {
-  /* stream info */
-  if (packet->bytes > 4 && packet->packet[0] == 0x2f &&
+  if (packet->bytes > 6 && packet->packet[0] == 0x4F &&
       packet->packet[1] == 0x56 && packet->packet[2] == 0x50 &&
-      packet->packet[3] == 0x38)
-    return TRUE;
-  /* comment */
-  if (packet->bytes > 7 && packet->packet[0] == 0x4f &&
-      packet->packet[1] == 0x67 && packet->packet[2] == 0x67 &&
-      packet->packet[3] == 0x56 && packet->packet[4] == 0x50 &&
-      packet->packet[5] == 0x38 && packet->packet[6] == 0x20)
+      packet->packet[3] == 0x38 && packet->packet[4] == 0x30)
     return TRUE;
   return FALSE;
 }
@@ -1643,7 +1636,7 @@ static const GstOggMap mappers[] = {
     granulepos_to_key_granule_dirac
   },
   {
-    "/VP8\1", 5, 4,
+    "OVP80\1", 6, 4,
     "video/x-vp8",
     setup_vp8_mapper,
     granulepos_to_granule_vp8,





More information about the Gstreamer-commits mailing list