]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
transcode: add vp9_vaapi codec support
authorJaroslav Kysela <perex@perex.cz>
Mon, 16 Oct 2017 16:08:43 +0000 (18:08 +0200)
committerJaroslav Kysela <perex@perex.cz>
Mon, 16 Oct 2017 16:08:43 +0000 (18:08 +0200)
Makefile.ffmpeg
src/transcoding/codec/codec.c
src/transcoding/codec/codecs/libs/vaapi.c

index 91d1dd97b3a3153568fa8f3cc2e1036f120971ea..e85bdde11f601ebc79afdef50e00f23c0ad28df8 100644 (file)
@@ -554,7 +554,7 @@ endif
 ifeq (yes,$(CONFIG_VAAPI))
 
 EXTLIBS  += vaapi
-ENCODERS += h264_vaapi hevc_vaapi vp8_vaapi
+ENCODERS += h264_vaapi hevc_vaapi vp8_vaapi vp9_vaapi
 HWACCELS += mpeg2_vaapi h264_vaapi hevc_vaapi vp9_vaapi
 FILTERS  += deinterlace_vaapi scale_vaapi
 FFMPEG_DIFFS += ffmpeg.vaapi_encode.diff
index 5b5bc60125ffcb86751cad883004aa00c6ad016a..16434ce69000c9ad2aa829ecadee32b4e41046cf 100644 (file)
@@ -62,6 +62,7 @@ extern TVHCodec tvh_codec_libopus;
 extern TVHCodec tvh_codec_vaapi_h264;
 extern TVHCodec tvh_codec_vaapi_hevc;
 extern TVHCodec tvh_codec_vaapi_vp8;
+extern TVHCodec tvh_codec_vaapi_vp9;
 #endif
 
 #if ENABLE_NVENC
@@ -282,6 +283,7 @@ tvh_codecs_register()
     tvh_codec_register(&tvh_codec_vaapi_h264);
     tvh_codec_register(&tvh_codec_vaapi_hevc);
     tvh_codec_register(&tvh_codec_vaapi_vp8);
+    tvh_codec_register(&tvh_codec_vaapi_vp9);
 #endif
 
 #if ENABLE_NVENC
index b5da9907cc74f73b175aa6dc8cc870f8fa4be71c..fd2af241d7e607a453f34effe4bf855fdf8ebae2 100644 (file)
@@ -306,3 +306,45 @@ TVHVideoCodec tvh_codec_vaapi_vp8 = {
     .profile_init = tvh_codec_profile_video_init,
     .profile_destroy = tvh_codec_profile_video_destroy,
 };
+
+/* vp9_vaapi =============================================================== */
+
+static const AVProfile vaapi_vp9_profiles[] = {
+    { FF_PROFILE_UNKNOWN },
+};
+
+static int
+tvh_codec_profile_vaapi_vp9_open(tvh_codec_profile_vaapi_t *self,
+                                  AVDictionary **opts)
+{
+    // bit_rate or qp
+    if (self->bit_rate) {
+        AV_DICT_SET_BIT_RATE(opts, self->bit_rate);
+    }
+    else {
+        AV_DICT_SET_QP(opts, self->qp, 25);
+    }
+    // force zero here, until encoder is fixed
+    AV_DICT_SET_INT(opts, "bf", 0, 0);
+    return 0;
+}
+
+
+static const codec_profile_class_t codec_profile_vaapi_vp9_class = {
+    {
+        .ic_super      = (idclass_t *)&codec_profile_vaapi_class,
+        .ic_class      = "codec_profile_vaapi_vp9",
+        .ic_caption    = N_("vaapi_vp9")
+    },
+    .open = (codec_profile_open_meth)tvh_codec_profile_vaapi_vp9_open,
+};
+
+
+TVHVideoCodec tvh_codec_vaapi_vp9 = {
+    .name     = "vp9_vaapi",
+    .size     = sizeof(tvh_codec_profile_vaapi_t),
+    .idclass  = &codec_profile_vaapi_vp9_class,
+    .profiles = vaapi_vp9_profiles,
+    .profile_init = tvh_codec_profile_video_init,
+    .profile_destroy = tvh_codec_profile_video_destroy,
+};