[vlc-commits] avcodec: encoder: Always provide frame dimension and pixel format

Hugo Beauzée-Luyssen git at videolan.org
Mon Apr 4 16:45:07 CEST 2016


vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Mon Mar 28 14:28:17 2016 +0200| [1b54a8a95f3f110e7b25d8db2e8ad51c139f6e40] | committer: Hugo Beauzée-Luyssen

avcodec: encoder: Always provide frame dimension and pixel format

av_frame_unref will clear most of the frame fields, including dimension
& pixel format. This causes some encoders (at least the raw encoder) to
reject the frame.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1b54a8a95f3f110e7b25d8db2e8ad51c139f6e40
---

 modules/codec/avcodec/encoder.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c
index c02fa1d..9babede 100644
--- a/modules/codec/avcodec/encoder.c
+++ b/modules/codec/avcodec/encoder.c
@@ -1088,6 +1088,10 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pict )
         frame->interlaced_frame = !p_pict->b_progressive;
         frame->top_field_first = !!p_pict->b_top_field_first;
 
+        frame->format = p_sys->p_context->pix_fmt;
+        frame->width = p_sys->p_context->width;
+        frame->height = p_sys->p_context->height;
+
         /* Set the pts of the frame being encoded
          * avcodec likes pts to be in time_base units
          * frame number */



More information about the vlc-commits mailing list