[FFmpeg-devel] [PATCH] avformat/img2dec: add non pipe AVInputFormats
Michael Niedermayer
michaelni at gmx.at
Sat Jul 5 14:18:23 CEST 2014
On Sat, Jul 05, 2014 at 01:16:40PM +0200, wm4 wrote:
> 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?
no, but someone has to write probe functions that either work without
having access to the files content or somehow "evaluate" the
wildcards in the filename to be able to open a file at probing stage
somewhere
>
> > 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.
well, they work with "%d" and such and multiple files, so they arent
like other demuxers
>
> Why NOFILE? Maybe I'm misunderstanding the purpose of this function,
> and it's still somehow for matching multiple files with a filename
> pattern?
yes, the filename thats passed to them cannot be opened as a URL
as it contains stuff like "%05d" which need to be filled in first
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
It is what and why we do it that matters, not just one of them.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140705/74f6e503/attachment.asc>
More information about the ffmpeg-devel
mailing list