[vlc-devel] [PATCH] use av_close_input_stream and remove AVFMT_NOFILE hack

Baptiste Coudurier baptiste.coudurier at gmail.com
Mon Sep 21 08:57:48 CEST 2009


Hi Rémi,

On 09/20/2009 11:40 PM, Rémi Denis-Courmont wrote:
>
> On Sun, 20 Sep 2009 17:25:30 -0700, Baptiste Coudurier
> <baptiste.coudurier at gmail.com>  wrote:
>>> How come does the removal of AVFMT_NOFILE fixes a bug when it is
>>> supposed to make no differences?
>>
>>> Does it not affect av_find_stream_info() ?
>
>> Sorry, my explanation was not clear, it has a side effect in
>> av_find_stream_info indeed: AVFormatContext->file_size will not be
>> populated, because no file is present.
>>
>> This causes AVFormatContext->bit_rate field not to be populated and
>> therefore disabling mxf seeking feature.
>>
>> VLC wrapper could populate file_size, though IMHO the good solution is
>> to not set AVFMT_NO_FILE.
>> AVFMT_NO_FILE is used for image sequences, null input/output for
>> example, and file size makes no sense in these situations.
>
> It's not that simple. The data comes from another of VLC plugins, which is
> solely responsible for interpreting the media location string. The syntax
> of p_demux->psz_path could be misunderstood, or misinterpreted by
> libavformat.
>
> IMHO, if ffmpeg actually uses the bit, then this change needs to be
> reverted.
>

I'm not sure to understand what you mean.

Currently, VLC wrapper uses av_open_input_stream which does not open any 
file, and setup libavformat IO using its own routines, like it should be 
done. p_demux->psz_path is passed to av_open_input_stream which only 
copies its value into AVFormatContext->file_name field.

I don't understand what you mean by "the bit", however I'm pretty sure 
AVInputFormat->flags should not be modified.

I believe that AVFMT_NO_FILE was used since now because of 
av_close_input_file, which will close the underlying IO, behaviour that 
VLC do not want to happen I guess, please correct me if I'm wrong.
To avoid this close, API propose av_close_input_stream (like 
av_open_input_stream).

-- 
Baptiste COUDURIER
Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
FFmpeg maintainer                                  http://www.ffmpeg.org



More information about the vlc-devel mailing list