summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-03-28 17:24:48 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-03-28 23:54:51 +0100
commit1c13e1ef368ae6b6c7582f39e2e9567df8f200db (patch)
treee34b91306676d78a6c48ac47128302523ae4676a
parent075d6c066bc982819019b7c39660e8f3c9dfecc6 (diff)
avformat/img2dec: Use avformat probing interface to identify format if it has not been otherwise identified
This is used only for distinguishing .pix formats for now. Which is the only case that has image2 demuxers currently Reviewed-by: wm4 <nfxjfg@googlemail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavformat/img2dec.c22
-rw-r--r--libavformat/version.h4
2 files changed, 24 insertions, 2 deletions
diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c
index 026fd5f14b..f6df41d4e6 100644
--- a/libavformat/img2dec.c
+++ b/libavformat/img2dec.c
@@ -298,6 +298,8 @@ int ff_img_read_header(AVFormatContext *s1)
st->codec->codec_id = ff_guess_image2_codec(s->path);
if (st->codec->codec_id == AV_CODEC_ID_LJPEG)
st->codec->codec_id = AV_CODEC_ID_MJPEG;
+ if (st->codec->codec_id == AV_CODEC_ID_ALIAS_PIX) // we cannot distingiush this from BRENDER_PIX
+ st->codec->codec_id = AV_CODEC_ID_NONE;
}
if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO &&
pix_fmt != AV_PIX_FMT_NONE)
@@ -349,6 +351,26 @@ int ff_img_read_packet(AVFormatContext *s1, AVPacket *pkt)
filename[strlen(filename) - 1] = 'U' + i;
}
+ if (codec->codec_id == AV_CODEC_ID_NONE) {
+ AVProbeData pd;
+ AVInputFormat *ifmt;
+ uint8_t header[20 + AVPROBE_PADDING_SIZE];
+ int ret;
+ int score = 0;
+
+ ret = avio_read(f[0], header, 20);
+ if (ret < 0)
+ return ret;
+ avio_skip(f[0], -ret);
+ pd.buf = header;
+ pd.buf_size = ret;
+ pd.filename = filename;
+
+ ifmt = av_probe_input_format3(&pd, 1, &score);
+ if (ifmt && ifmt->read_packet == ff_img_read_packet && ifmt->raw_codec_id)
+ codec->codec_id = ifmt->raw_codec_id;
+ }
+
if (codec->codec_id == AV_CODEC_ID_RAWVIDEO && !codec->width)
infer_size(&codec->width, &codec->height, size[0]);
} else {
diff --git a/libavformat/version.h b/libavformat/version.h
index 55b8591457..cb17faee16 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -30,8 +30,8 @@
#include "libavutil/version.h"
#define LIBAVFORMAT_VERSION_MAJOR 55
-#define LIBAVFORMAT_VERSION_MINOR 35
-#define LIBAVFORMAT_VERSION_MICRO 102
+#define LIBAVFORMAT_VERSION_MINOR 36
+#define LIBAVFORMAT_VERSION_MICRO 100
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \