[FFmpeg-devel] [PATCH 1/4] ffmpeg: Flush output BSFs when encode reaches EOF

Mark Thompson sw at jkqxz.net
Sat Jun 24 19:44:48 EEST 2017


On 24/06/17 11:29, Michael Niedermayer wrote:
> On Mon, Jun 19, 2017 at 10:48:15PM +0100, Mark Thompson wrote:
>> On 19/06/17 16:32, Michael Niedermayer wrote:
>>> On Sun, Jun 18, 2017 at 11:09:23PM +0100, Mark Thompson wrote:
>>>> Before this, output bitstream filters would never see EOF and
>>>> therefore would not be able to flush any delayed packets.
>>>>
>>>> (cherry picked from commit f64d1100a54d12c78ce436181bb64229c56da6b3)
>>>> ---
>>>>  ffmpeg.c | 30 +++++++++++++++++++-----------
>>>>  1 file changed, 19 insertions(+), 11 deletions(-)
>>>>
>>>> diff --git a/ffmpeg.c b/ffmpeg.c
>>>> index 6170bd453c..f265980fdd 100644
>>>> --- a/ffmpeg.c
>>>> +++ b/ffmpeg.c
>>>> @@ -814,7 +814,8 @@ static void close_output_stream(OutputStream *ost)
>>>>      }
>>>>  }
>>>>  
>>>> -static void output_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost)
>>>> +static void output_packet(OutputFile *of, AVPacket *pkt,
>>>> +                          OutputStream *ost, int eof)
>>>>  {
>>>>      int ret = 0;
>>>>  
>>>
>>> please document why pkt==NULL is not used for eof detection and what
>>> the functionn does with pkt. The caller must be aware of it, if it is
>>> not just used as unchanged input that is written
>>
>> """
>> /*
>>  * Send a single packet to the output, applying any bitstream filters
>>  * associated with the output stream.  This may result in any number
>>  * of packets actually being written, depending on what bitstream
>>  * filters are applied.  The supplied packet is consumed and will be
>>  * empty when this function returns.
>>  *
>>  * If eof is set, instead indicate EOF to all bitstream filters and
>>  * therefore flush any delayed packets to the output.  An empty packet
>>  * must be supplied in this case.
>>  */
>> static void output_packet(OutputFile *of, AVPacket *pkt,
>>                           OutputStream *ost, int eof)
> 
> LGTM
> 
> maybe "empty packet" could be clarified.

Set applied with this modified as noted on IRC.

Thanks,

- Mark


More information about the ffmpeg-devel mailing list