[FFmpeg-devel] [PATCH 1/2] avformat: add AVFMT_FILE to allow demuxers to be used with and without files

wm4 nfxjfg at googlemail.com
Fri Sep 12 12:49:03 CEST 2014


On Fri, 12 Sep 2014 12:29:36 +0200
Michael Niedermayer <michaelni at gmx.at> wrote:

> Suggested-by: Benoit Fouet <benoit.fouet at free.fr>
> Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> ---
>  doc/APIchanges         |    3 +++
>  libavformat/avformat.h |    8 ++++++++
>  libavformat/format.c   |    3 ++-
>  libavformat/version.h  |    4 ++--
>  4 files changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/doc/APIchanges b/doc/APIchanges
> index 6d214ef..45ed60a 100644
> --- a/doc/APIchanges
> +++ b/doc/APIchanges
> @@ -15,6 +15,9 @@ libavutil:     2014-08-09
>  
>  API changes, most recent first:
>  
> +2014-09-xx - xxxxxxx - lavf 56.5.100 - avformat.h
> +  Add AVFMT_FILE
> +
>  2014-08-xx - xxxxxxx - lavc 56.1.0 - avcodec.h
>    Add AV_PKT_DATA_STEREO3D to export container-level stereo3d information.
>  
> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> index b915148..a95d702 100644
> --- a/libavformat/avformat.h
> +++ b/libavformat/avformat.h
> @@ -446,6 +446,14 @@ typedef struct AVProbeData {
>  
>  #define AVFMT_SEEK_TO_PTS   0x4000000 /**< Seeking is based on PTS */
>  
> +#define AVFMT_FILE          0x8000000 /**< demuxer can be used with a file, this
> +                                           is default if AVFMT_NOFILE is not set.

It's default, but it's not set? That's very strange.

> +                                           If AVFMT_NOFILE and AVFMT_FILE is set
> +                                           then the demuxer can be used with and
> +                                           without a file (so this flag makes
> +                                           only sense together with AVFMT_NOFILE)

Very confusing. Without knowing the context (hack for img2 stuff) I
wouldn't know what this means.

I think I would prefer the previous patch, which just special-cases
image2. image2 probing should be fixed eventually, and it'd be better
not to add strange API artifacts just because we're not there yet.

Also, not sure if I understand issue 3901 correctly. But shouldn't he
gif detection be pretty reliable, and just override the jpg image2 one?

> +                                           */
> +
>  /**
>   * @addtogroup lavf_encoding
>   * @{
> diff --git a/libavformat/format.c b/libavformat/format.c
> index 828ab52..d59fe8a 100644
> --- a/libavformat/format.c
> +++ b/libavformat/format.c
> @@ -202,7 +202,8 @@ AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened,
>  
>      fmt = NULL;
>      while ((fmt1 = av_iformat_next(fmt1))) {
> -        if (!is_opened == !(fmt1->flags & AVFMT_NOFILE))
> +        if (!is_opened == !(fmt1->flags & AVFMT_NOFILE) &&
> +            (fmt1->flags & (AVFMT_FILE | AVFMT_NOFILE)) != (AVFMT_FILE | AVFMT_NOFILE))
>              continue;
>          score = 0;
>          if (fmt1->read_probe) {
> diff --git a/libavformat/version.h b/libavformat/version.h
> index f5808eb..b1dde2c 100644
> --- a/libavformat/version.h
> +++ b/libavformat/version.h
> @@ -30,8 +30,8 @@
>  #include "libavutil/version.h"
>  
>  #define LIBAVFORMAT_VERSION_MAJOR 56
> -#define LIBAVFORMAT_VERSION_MINOR  4
> -#define LIBAVFORMAT_VERSION_MICRO 101
> +#define LIBAVFORMAT_VERSION_MINOR  5
> +#define LIBAVFORMAT_VERSION_MICRO 100
>  
>  #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
>                                                 LIBAVFORMAT_VERSION_MINOR, \



More information about the ffmpeg-devel mailing list