libav: add support for VVC/H.266 decoder

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7637>
This commit is contained in:
Carlos Bentzen 2024-10-09 23:16:31 +02:00 committed by GStreamer Marge Bot
parent df7a8c8c40
commit 4b0d555056
2 changed files with 31 additions and 0 deletions

View file

@ -1035,6 +1035,7 @@ gst_ffmpeg_codecid_is_known (enum AVCodecID codec_id)
case AV_CODEC_ID_CYUV:
case AV_CODEC_ID_H264:
case AV_CODEC_ID_HEVC:
case AV_CODEC_ID_VVC:
case AV_CODEC_ID_INDEO5:
case AV_CODEC_ID_INDEO4:
case AV_CODEC_ID_INDEO3:
@ -1798,6 +1799,30 @@ gst_ffmpeg_codecid_to_caps (enum AVCodecID codec_id,
}
break;
case AV_CODEC_ID_VVC:
if (!encode) {
caps =
gst_ff_vid_caps_new (context, NULL, codec_id, encode,
"video/x-h266", "alignment", G_TYPE_STRING, "au", NULL);
GValue arr = { 0, };
GValue item = { 0, };
g_value_init (&arr, GST_TYPE_LIST);
g_value_init (&item, G_TYPE_STRING);
g_value_set_string (&item, "vvc1");
gst_value_list_append_value (&arr, &item);
g_value_set_string (&item, "vvi1");
gst_value_list_append_value (&arr, &item);
g_value_set_string (&item, "byte-stream");
gst_value_list_append_value (&arr, &item);
g_value_unset (&item);
gst_caps_set_value (caps, "stream-format", &arr);
g_value_unset (&arr);
} else {
/* As of FFmpeg 7.1, it can only encode VVC via libvvenc, which is ignored in gst-libav. */
GST_FIXME ("Handle caps for VVC/H.266 encoding.");
}
break;
case AV_CODEC_ID_INDEO5:
caps =
gst_ff_vid_caps_new (context, NULL, codec_id, encode, "video/x-indeo",
@ -4969,6 +4994,9 @@ gst_ffmpeg_caps_to_codecid (const GstCaps * caps, AVCodecContext * context)
} else if (!strcmp (mimetype, "video/x-h265")) {
id = AV_CODEC_ID_HEVC;
video = TRUE;
} else if (!strcmp (mimetype, "video/x-h266")) {
id = AV_CODEC_ID_VVC;
video = TRUE;
} else if (!strcmp (mimetype, "video/x-flash-video")) {
gint flvversion = 0;

View file

@ -2864,6 +2864,8 @@ gst_ffmpegviddec_register (GstPlugin * plugin)
/* construct the type */
if (!strcmp (in_plugin->name, "hevc")) {
plugin_name = g_strdup ("h265");
} else if (!strcmp (in_plugin->name, "vvc")) {
plugin_name = g_strdup ("h266");
} else {
plugin_name = g_strdup ((gchar *) in_plugin->name);
}
@ -2891,6 +2893,7 @@ gst_ffmpegviddec_register (GstPlugin * plugin)
case AV_CODEC_ID_MSMPEG4V3:
case AV_CODEC_ID_H264:
case AV_CODEC_ID_HEVC:
case AV_CODEC_ID_VVC:
case AV_CODEC_ID_RV10:
case AV_CODEC_ID_RV20:
case AV_CODEC_ID_RV30: