aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/img2dec.c
diff options
context:
space:
mode:
authorCarl Eugen Hoyos <cehoyos@ag.or.at>2012-11-10 02:25:17 +0100
committerCarl Eugen Hoyos <cehoyos@ag.or.at>2012-11-10 02:25:17 +0100
commitb56ff0b261c4432e52e6b66bbd515f5694292b8a (patch)
tree29f38028f8b7b9a5f1dc334fadd863a925dc0c44 /libavformat/img2dec.c
parentf91f049a2281a996c77d13a3d151addde2608d8c (diff)
downloadffmpeg-b56ff0b261c4432e52e6b66bbd515f5694292b8a.tar.gz
Allow forcing a frame size in bytes for image2pipe.
This allows decoding of concatenated frames encoded in uncompressed formats like v210. The frame size cannot be generally calculated, FFmpeg also supports broken encoders. Fixes ticket #1869.
Diffstat (limited to 'libavformat/img2dec.c')
-rw-r--r--libavformat/img2dec.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c
index c493f1add7..735541eadc 100644
--- a/libavformat/img2dec.c
+++ b/libavformat/img2dec.c
@@ -61,6 +61,7 @@ typedef struct {
#endif
int start_number;
int start_number_range;
+ int frame_size;
} VideoDemuxData;
static const int sizes[][2] = {
@@ -372,7 +373,11 @@ static int read_packet(AVFormatContext *s1, AVPacket *pkt)
f[0] = s1->pb;
if (url_feof(f[0]))
return AVERROR(EIO);
- size[0]= 4096;
+ if (s->frame_size > 0) {
+ size[0] = s->frame_size;
+ } else {
+ size[0]= 4096;
+ }
}
if (av_new_packet(pkt, size[0] + size[1] + size[2]) < 0)
@@ -427,6 +432,7 @@ static const AVOption options[] = {
{ "start_number", "set first number in the sequence", OFFSET(start_number), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, DEC },
{ "start_number_range", "set range for looking at the first sequence number", OFFSET(start_number_range), AV_OPT_TYPE_INT, {.i64 = 5}, 1, INT_MAX, DEC },
{ "video_size", "set video size", OFFSET(video_size), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
+ { "frame_size", "force frame size in bytes", OFFSET(frame_size), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, DEC },
{ NULL },
};