[FFmpeg-devel] [PATCH] avformat: add vapoursynth wrapper

James Almer jamrial at gmail.com
Sat Apr 28 21:44:32 EEST 2018


On 4/28/2018 3:38 PM, wm4 wrote:
> On Sat, 28 Apr 2018 15:28:13 -0300
> James Almer <jamrial at gmail.com> wrote:
> 
>> On 4/28/2018 2:05 PM, wm4 wrote:
>>> This can "demux" .vpy files.
>>>
> 
> 
>>> +    pkt->data   = pkt->buf->data;
>>> +    pkt->size   = pkt->buf->size;
>>> +    pkt->flags |= AV_PKT_FLAG_TRUSTED;
>>> +
>>> +    if (vs->is_cfr)
>>> +        pkt->pts = vs->current_frame;
>>> +
>>> +    vs->current_frame++;
>>> +
>>> +end:
>>> +    if (err < 0)
>>> +        av_packet_unref(pkt);  
>>
>> Unneeded. Nothing after pkt->buf is initialized can fail right now. And
>> if av_buffer_create() fails, pkt will be untouched.
> 
> Could be good for robustness reasons, but OK, removed.
> 
>>> +    av_frame_free(&frame);
>>> +    vs->vsapi->freeFrame(vsframe);
>>> +    return err;  
>>
>> Shouldn't you set err to pkt->size right above the end label?
> 
> I'm not sure what you mean. err is initialized to 0, and only becomes
> non-0 on errors, so it doesn't need to be set here.

I was under the impression that read_packet() functions were supposed to
return the size of the packet read on success, but it seems it's not
consistent (some demuxers do, others don't).


More information about the ffmpeg-devel mailing list