[FFmpeg-devel] [PATCH] avformat/img2dec: add non pipe AVInputFormats

wm4 nfxjfg at googlemail.com
Sat Jul 5 13:16:40 CEST 2014


On Fri,  4 Jul 2014 17:01:49 +0200
Michael Niedermayer <michaelni at gmx.at> wrote:

> These currently do not get autoselected, as they have no probe functions nor
> list file extensions

Why not? Does enabling probing break something?

> Suggested-by: wm4
> Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> ---
>  libavformat/allformats.c |    9 +++++++++
>  libavformat/img2dec.c    |   21 +++++++++++++++++++--
>  2 files changed, 28 insertions(+), 2 deletions(-)
> 
> diff --git a/libavformat/allformats.c b/libavformat/allformats.c
> index c07fbd1..6348f28 100644
> --- a/libavformat/allformats.c
> +++ b/libavformat/allformats.c
> @@ -319,6 +319,15 @@ void av_register_all(void)
>      REGISTER_MUXDEMUX(YUV4MPEGPIPE,     yuv4mpegpipe);
>  
>      /* image demuxers */
> +    REGISTER_DEMUXER (IMAGE_BMP,             image_bmp);
> +    REGISTER_DEMUXER (IMAGE_DPX,             image_dpx);
> +    REGISTER_DEMUXER (IMAGE_EXR,             image_exr);
> +    REGISTER_DEMUXER (IMAGE_J2K,             image_j2k);
> +    REGISTER_DEMUXER (IMAGE_PICTOR,          image_pictor);
> +    REGISTER_DEMUXER (IMAGE_PNG,             image_png);
> +    REGISTER_DEMUXER (IMAGE_SGI,             image_sgi);
> +    REGISTER_DEMUXER (IMAGE_SUNRAST,         image_sunrast);
> +    REGISTER_DEMUXER (IMAGE_TIFF,            image_tiff);
>      REGISTER_DEMUXER (IMAGE_BMP_PIPE,        image_bmp_pipe);
>      REGISTER_DEMUXER (IMAGE_DPX_PIPE,        image_dpx_pipe);
>      REGISTER_DEMUXER (IMAGE_EXR_PIPE,        image_exr_pipe);
> diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c
> index cda4996..52bc201 100644
> --- a/libavformat/img2dec.c
> +++ b/libavformat/img2dec.c
> @@ -658,8 +658,8 @@ static int tiff_probe(AVProbeData *p)
>  }
>  
>  #define IMAGEAUTO_DEMUXER(imgname, codecid)\
> -static const AVClass imgname ## _class = {\
> -    .class_name = AV_STRINGIFY(imgname) " demuxer",\
> +static const AVClass imgname ## _pipe_class = {\
> +    .class_name = AV_STRINGIFY(imgname) "pipe demuxer",\
>      .item_name  = av_default_item_name,\
>      .option     = options,\
>      .version    = LIBAVUTIL_VERSION_INT,\
> @@ -670,6 +670,23 @@ AVInputFormat ff_image_ ## imgname ## _pipe_demuxer = {\
>      .read_probe     = imgname ## _probe,\
>      .read_header    = ff_img_read_header,\
>      .read_packet    = ff_img_read_packet,\
> +    .priv_class     = & imgname ## _pipe_class,\
> +    .raw_codec_id   = codecid,\
> +};\
> +static const AVClass imgname ## _class = {\
> +    .class_name = AV_STRINGIFY(imgname) " demuxer",\
> +    .item_name  = av_default_item_name,\
> +    .option     = options,\
> +    .version    = LIBAVUTIL_VERSION_INT,\
> +};\
> +AVInputFormat ff_image_ ## imgname ## _demuxer = {\
> +    .name           = AV_STRINGIFY(imgname),\
> +    .priv_data_size = sizeof(VideoDemuxData),\
> +    .read_header    = ff_img_read_header,\
> +    .read_packet    = ff_img_read_packet,\
> +    .read_close     = img_read_close,\
> +    .read_seek      = img_read_seek,\
> +    .flags          = AVFMT_NOFILE,\

I'd say eventually, there should be a demuxer for each image format,
and these demuxer should work like all others.

Why NOFILE? Maybe I'm misunderstanding the purpose of this function,
and it's still somehow for matching multiple files with a filename
pattern?

>      .priv_class     = & imgname ## _class,\
>      .raw_codec_id   = codecid,\
>  };



More information about the ffmpeg-devel mailing list