matroska: Add initial VP9 support
authorSebastian Dröge <slomo@circular-chaos.org>
Fri, 21 Jun 2013 11:11:32 +0000 (13:11 +0200)
committerSebastian Dröge <slomo@circular-chaos.org>
Fri, 21 Jun 2013 16:22:13 +0000 (18:22 +0200)
gst/matroska/matroska-demux.c
gst/matroska/matroska-ids.h
gst/matroska/matroska-mux.c
gst/matroska/webm-mux.c

index 2a717f6..c586f55 100644 (file)
@@ -3423,7 +3423,8 @@ gst_matroska_demux_parse_blockgroup_or_simpleblock (GstMatroskaDemux * demux,
       if ((is_simpleblock && !(flags & 0x80)) || referenceblock) {
         delta_unit = TRUE;
         invisible_frame = ((flags & 0x08)) &&
-            (strcmp (stream->codec_id, GST_MATROSKA_CODEC_ID_VIDEO_VP8) == 0);
+            (!strcmp (stream->codec_id, GST_MATROSKA_CODEC_ID_VIDEO_VP8) ||
+            !strcmp (stream->codec_id, GST_MATROSKA_CODEC_ID_VIDEO_VP9));
       }
     }
 
@@ -5065,6 +5066,9 @@ gst_matroska_demux_video_caps (GstMatroskaTrackVideoContext *
   } else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_VP8)) {
     caps = gst_caps_new_empty_simple ("video/x-vp8");
     *codec_name = g_strdup_printf ("On2 VP8");
+  } else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_VP9)) {
+    caps = gst_caps_new_empty_simple ("video/x-vp9");
+    *codec_name = g_strdup_printf ("On2 VP9");
   } else {
     GST_WARNING ("Unknown codec '%s', cannot build Caps", codec_id);
     return NULL;
index c1b2936..f19a6d2 100644 (file)
 #define GST_MATROSKA_CODEC_ID_VIDEO_SNOW         "V_SNOW"
 #define GST_MATROSKA_CODEC_ID_VIDEO_DIRAC        "V_DIRAC"
 #define GST_MATROSKA_CODEC_ID_VIDEO_VP8          "V_VP8"
+#define GST_MATROSKA_CODEC_ID_VIDEO_VP9          "V_VP9"
 
 #define GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L1       "A_MPEG/L1"
 #define GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L2       "A_MPEG/L2"
index cad509d..d31b1ab 100644 (file)
@@ -961,7 +961,8 @@ gst_matroska_mux_video_pad_setcaps (GstPad * pad, GstCaps * caps)
 
   /* set vp8 defaults or let user override it */
   if (GST_MATROSKAMUX_PAD_CAST (pad)->frame_duration_user == FALSE
-      && (!strcmp (mimetype, "video/x-vp8")))
+      && (!strcmp (mimetype, "video/x-vp8")
+          || !strcmp (mimetype, "video/x-vp9")))
     GST_MATROSKAMUX_PAD_CAST (pad)->frame_duration =
         DEFAULT_PAD_FRAME_DURATION_VP8;
 
@@ -1136,6 +1137,8 @@ skip_details:
     gst_matroska_mux_set_codec_id (context, GST_MATROSKA_CODEC_ID_VIDEO_DIRAC);
   } else if (!strcmp (mimetype, "video/x-vp8")) {
     gst_matroska_mux_set_codec_id (context, GST_MATROSKA_CODEC_ID_VIDEO_VP8);
+  } else if (!strcmp (mimetype, "video/x-vp9")) {
+    gst_matroska_mux_set_codec_id (context, GST_MATROSKA_CODEC_ID_VIDEO_VP9);
   } else if (!strcmp (mimetype, "video/mpeg")) {
     gint mpegversion;
 
@@ -3262,8 +3265,9 @@ gst_matroska_mux_write_data (GstMatroskaMux * mux, GstMatroskaPad * collect_pad,
           GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)));
       is_video_keyframe = TRUE;
     } else if (GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_DECODE_ONLY) &&
-        !strcmp (collect_pad->track->codec_id,
-            GST_MATROSKA_CODEC_ID_VIDEO_VP8)) {
+        (!strcmp (collect_pad->track->codec_id, GST_MATROSKA_CODEC_ID_VIDEO_VP8)
+            || !strcmp (collect_pad->track->codec_id,
+                GST_MATROSKA_CODEC_ID_VIDEO_VP9))) {
       GST_LOG_OBJECT (mux,
           "have VP8 video invisible frame, " "ts=%" GST_TIME_FORMAT,
           GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)));
index 9f04b33..19aa245 100644 (file)
@@ -62,10 +62,11 @@ static GstStaticPadTemplate webm_src_templ = GST_STATIC_PAD_TEMPLATE ("src",
     );
 
 static GstStaticPadTemplate webm_videosink_templ =
-GST_STATIC_PAD_TEMPLATE ("video_%u",
+    GST_STATIC_PAD_TEMPLATE ("video_%u",
     GST_PAD_SINK,
     GST_PAD_REQUEST,
-    GST_STATIC_CAPS ("video/x-vp8, " COMMON_VIDEO_CAPS)
+    GST_STATIC_CAPS ("video/x-vp8, " COMMON_VIDEO_CAPS ";"
+        "video/x-vp9, " COMMON_VIDEO_CAPS)
     );
 
 static GstStaticPadTemplate webm_audiosink_templ =