[FFmpeg-devel] adding RGBA and BGRA to nvenc.c

Andy Furniss adf.lists at gmail.com
Sat Sep 10 22:32:02 EEST 2016


Andy Furniss wrote:
> Nicolas George wrote:

>> I had an inkling that it was about the packet -> frame conversion,
>> but it seems rawdec does the right thing in this particular case.
>> Still, I suggest you add a quick debug av_log() in
>> libavcodec/rawdec.c to check that need_copy is false.
>
> I shall have go later this evening.

I did as below and for both -f null - and -f rawvideo -y /dev/null it 
says false.

diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c
index 1259577..28a8fd0 100644
--- a/libavcodec/rawdec.c
+++ b/libavcodec/rawdec.c
@@ -248,10 +248,13 @@ static int raw_decode(AVCodecContext *avctx, void 
*data, int *got_frame,
      if ((res = av_image_check_size(avctx->width, avctx->height, 0, 
avctx)) < 0)
          return res;

-    if (need_copy)
+    if (need_copy) {
          frame->buf[0] = av_buffer_alloc(FFMAX(context->frame_size, 
buf_size));
-    else
+        av_log(NULL, AV_LOG_ERROR, "ADF need_copy = true\n");
+    } else {
          frame->buf[0] = av_buffer_ref(avpkt->buf);
+        av_log(NULL, AV_LOG_ERROR, "ADF need_copy = false\n");
+    }
      if (!frame->buf[0])
          return AVERROR(ENOMEM);

@@ -341,6 +344,7 @@ static int raw_decode(AVCodecContext *avctx, void 
*data, int *got_frame,

          buf = dst;
      } else if (need_copy) {
+        av_log(NULL, AV_LOG_ERROR, "ADF need_copy2 = true\n");
          memcpy(frame->buf[0]->data, buf, buf_size);
          buf = frame->buf[0]->data;
      }




More information about the ffmpeg-devel mailing list