Files
yoctor-layers/meta-st/meta-st-openstlinux/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0026-v4l2codecs-Register-V4L2-stateless-Vp8-encoder.patch
2024-07-11 14:16:35 +02:00

77 lines
2.2 KiB
Diff

From 9f38752fa28cb43b1069fe6fa9ce7e1db5958962 Mon Sep 17 00:00:00 2001
From: Benjamin Gaignard <benjamin.gaignard@collabora.com>
Date: Mon, 16 Jan 2023 17:40:30 +0100
Subject: [PATCH 5/5] v4l2codecs: Register V4L2 stateless Vp8 encoder
If a v4l2 stateless VP8 encoder is detected register the matching
element.
---
sys/v4l2codecs/plugin.c | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/sys/v4l2codecs/plugin.c b/sys/v4l2codecs/plugin.c
index ac83e1b..7867474 100644
--- a/sys/v4l2codecs/plugin.c
+++ b/sys/v4l2codecs/plugin.c
@@ -27,8 +27,10 @@
#include "gstv4l2codech265dec.h"
#include "gstv4l2codecmpeg2dec.h"
#include "gstv4l2codecvp8dec.h"
+#include "gstv4l2codecvp8enc.h"
#include "gstv4l2codecvp9dec.h"
#include "gstv4l2decoder.h"
+#include "gstv4l2encoder.h"
#include "linux/v4l2-controls.h"
#include "linux/media.h"
@@ -91,6 +93,36 @@ register_video_decoder (GstPlugin * plugin, GstV4l2CodecDevice * device)
g_object_unref (decoder);
}
+static void
+register_video_encoder (GstPlugin * plugin, GstV4l2CodecDevice * device)
+{
+ GstV4l2Encoder *encoder = gst_v4l2_encoder_new (device);
+ gint i;
+ guint32 fmt;
+
+ if (!gst_v4l2_encoder_open (encoder)) {
+ g_object_unref (encoder);
+ return;
+ }
+
+ for (i = 0; gst_v4l2_encoder_enum_src_formats (encoder, i, &fmt); i++) {
+ switch (fmt) {
+ case V4L2_PIX_FMT_VP8_FRAME:
+ GST_INFO_OBJECT (encoder, "Registering %s as VP8 Encoder",
+ device->name);
+ gst_v4l2_codec_vp8_enc_register (plugin, encoder, device,
+ GST_RANK_PRIMARY + 1);
+ break;
+ default:
+ GST_FIXME_OBJECT (encoder, "%" GST_FOURCC_FORMAT " is not supported.",
+ GST_FOURCC_ARGS (fmt));
+ break;
+ }
+ }
+
+ g_object_unref (encoder);
+}
+
static gboolean
plugin_init (GstPlugin * plugin)
{
@@ -112,6 +144,9 @@ plugin_init (GstPlugin * plugin)
if (device->function == MEDIA_ENT_F_PROC_VIDEO_DECODER)
register_video_decoder (plugin, device);
+
+ if (device->function == MEDIA_ENT_F_PROC_VIDEO_ENCODER)
+ register_video_encoder (plugin, device);
}
gst_v4l2_codec_device_list_free (devices);
--
2.25.1