[vlc-devel] [RFC 1/2] avcodec: encoder: Always provide frame dimension and pixel format
Hugo Beauzée-Luyssen
hugo at beauzee.fr
Mon Mar 28 14:28:17 CEST 2016
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.
---
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 9f1e6c2..c9b3763 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 */
--
2.7.0
More information about the vlc-devel
mailing list