[Libav-user] Question about wrapped_avframe

Andrew Randrianasulu randrianasulu at gmail.com
Thu Jul 28 01:10:54 EEST 2022


Our software (cinelerra-gg) uses array of pixelformats from libavcodec
encoders  for presenting user with menu to choose from

yuv4mpeg encoder does not have this array populated so menu basically
useless ...

I tried to make this patch


~ $ cat cinelerra/cinelerra-5.1/thirdparty/src/ffmpeg-5.1.patchZ1
--- ./libavcodec/wrapped_avframe.c.orig 2022-07-22 20:58:39.000000000 +0300
+++ ./libavcodec/wrapped_avframe.c 2022-07-24 05:51:27.513268806 +0300
@@ -33,6 +33,38 @@
 #include "libavutil/buffer.h"
 #include "libavutil/pixdesc.h"

+
+
+static const enum AVPixelFormat pix_fmts_all[] = {
+ AV_PIX_FMT_YUV411P,
+ AV_PIX_FMT_YUV420P,
+ AV_PIX_FMT_YUVJ420P,
+ AV_PIX_FMT_YUV422P,
+ AV_PIX_FMT_YUVJ422P,
+ AV_PIX_FMT_YUV444P,
+ AV_PIX_FMT_YUVJ444P,
+ AV_PIX_FMT_YUV420P10,
+ AV_PIX_FMT_YUV422P10,
+ AV_PIX_FMT_YUV444P10,
+ AV_PIX_FMT_YUV420P12,
+ AV_PIX_FMT_YUV422P12,
+ AV_PIX_FMT_YUV444P12,
+ AV_PIX_FMT_YUV420P14,
+ AV_PIX_FMT_YUV422P14,
+ AV_PIX_FMT_YUV444P14,
+ AV_PIX_FMT_YUV420P16,
+ AV_PIX_FMT_YUV422P16,
+ AV_PIX_FMT_YUV444P16,
+ AV_PIX_FMT_GRAY8,
+ AV_PIX_FMT_GRAY9,
+ AV_PIX_FMT_GRAY10,
+ AV_PIX_FMT_GRAY12,
+ AV_PIX_FMT_GRAY16,
+ AV_PIX_FMT_NONE
+};
+
+
+
 static void wrapped_avframe_release_buffer(void *unused, uint8_t *data)
 {
     AVFrame *frame = (AVFrame *)data;
@@ -109,6 +141,7 @@
     .p.id = AV_CODEC_ID_WRAPPED_AVFRAME,
     FF_CODEC_ENCODE_CB(wrapped_avframe_encode),
     .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE,
+ .p.pix_fmts = pix_fmts_all,
 };

 const FFCodec ff_wrapped_avframe_decoder = {
@@ -118,4 +151,5 @@
     .p.id = AV_CODEC_ID_WRAPPED_AVFRAME,
     FF_CODEC_DECODE_CB(wrapped_avframe_decode),
     .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE,
+
 };
~ $

So it compiles and I can select in our gui y4m with say 444yuv 16 bit. And
resulting file is huge, but decodeble by ffmpeg/libavcodec.

Does my patch break some assumptions somewhere? I saw wrapped avframe used
for hw accelerated encoding, but this part seems to work after my patch ...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20220728/1c590a51/attachment.htm>


More information about the Libav-user mailing list