[vlc-devel] [RFC 1/2] avcodec: encoder: Always provide frame dimension and pixel format
Vittorio Giovara
vittorio.giovara at gmail.com
Tue Mar 29 17:56:27 CEST 2016
On Mon, Mar 28, 2016 at 2:28 PM, Hugo Beauzée-Luyssen <hugo at beauzee.fr> wrote:
> 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 */
after some more thinking this patch should be ok
--
Vittorio
More information about the vlc-devel
mailing list