img2dec: add support for piped SVG demuxing

Only checks the extension and MIME type, since determining whether
a file is SVG is difficult since they're just XML files.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
This commit is contained in:
Rostislav Pehlivanov 2017-05-08 05:00:41 +01:00
parent a13eac5a99
commit f68ea92833
3 changed files with 22 additions and 0 deletions

View File

@ -237,6 +237,7 @@ OBJS-$(CONFIG_IMAGE_PPM_PIPE_DEMUXER) += img2dec.o img2.o
OBJS-$(CONFIG_IMAGE_PSD_PIPE_DEMUXER) += img2dec.o img2.o
OBJS-$(CONFIG_IMAGE_QDRAW_PIPE_DEMUXER) += img2dec.o img2.o
OBJS-$(CONFIG_IMAGE_SGI_PIPE_DEMUXER) += img2dec.o img2.o
OBJS-$(CONFIG_IMAGE_SVG_PIPE_DEMUXER) += img2dec.o img2.o
OBJS-$(CONFIG_IMAGE_SUNRAST_PIPE_DEMUXER) += img2dec.o img2.o
OBJS-$(CONFIG_IMAGE_TIFF_PIPE_DEMUXER) += img2dec.o img2.o
OBJS-$(CONFIG_IMAGE_WEBP_PIPE_DEMUXER) += img2dec.o img2.o

View File

@ -369,6 +369,7 @@ static void register_all(void)
REGISTER_DEMUXER (IMAGE_PSD_PIPE, image_psd_pipe);
REGISTER_DEMUXER (IMAGE_QDRAW_PIPE, image_qdraw_pipe);
REGISTER_DEMUXER (IMAGE_SGI_PIPE, image_sgi_pipe);
REGISTER_DEMUXER (IMAGE_SVG_PIPE, image_svg_pipe);
REGISTER_DEMUXER (IMAGE_SUNRAST_PIPE, image_sunrast_pipe);
REGISTER_DEMUXER (IMAGE_TIFF_PIPE, image_tiff_pipe);
REGISTER_DEMUXER (IMAGE_WEBP_PIPE, image_webp_pipe);

View File

@ -971,6 +971,26 @@ AVInputFormat ff_image_ ## imgname ## _pipe_demuxer = {\
.raw_codec_id = codecid,\
};
static const AVClass svg_class = {
.class_name = "svg demuxer",
.item_name = av_default_item_name,
.option = ff_img_options,
.version = LIBAVUTIL_VERSION_INT,
};
AVInputFormat ff_image_svg_pipe_demuxer = {
.name = "svg_pipe",
.long_name = NULL_IF_CONFIG_SMALL("piped svg sequence"),
.priv_data_size = sizeof(VideoDemuxData),
.read_header = ff_img_read_header,
.read_packet = ff_img_read_packet,
.priv_class = &svg_class,
.mime_type = "image/svg+xml",
.extensions = "svg,svgz",
.flags = AVFMT_GENERIC_INDEX,
.raw_codec_id = AV_CODEC_ID_SVG,
};
IMAGEAUTO_DEMUXER(bmp, AV_CODEC_ID_BMP)
IMAGEAUTO_DEMUXER(dds, AV_CODEC_ID_DDS)
IMAGEAUTO_DEMUXER(dpx, AV_CODEC_ID_DPX)