[vlc-devel] [RFC 1/2] avcodec: encoder: Always provide frame dimension and pixel format
Hugo Beauzée-Luyssen
hugo at beauzee.fr
Mon Apr 4 15:44:03 CEST 2016
On 03/29/2016 05:56 PM, Vittorio Giovara wrote:
> 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
>
I think it makes more sense to rely on the AVCodecContext in the raw
encoder than setting the fields for each frame. I'll submit a patch
upstream.
Regards,
More information about the vlc-devel
mailing list