summaryrefslogtreecommitdiffstats
path: root/libavformat/img2dec.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2013-04-05 15:07:52 +0000
committerPaul B Mahol <onemda@gmail.com>2013-04-05 15:42:25 +0000
commit9a8f1e729588435a1129d6b77e8dcdd1b2745ec6 (patch)
tree1725655731eee46991a1d789abfa0ea4c34b447d /libavformat/img2dec.c
parent1d5b4f9fe9817fe6d4ed3a490f6781d5d3d2e430 (diff)
downloadffmpeg-streaming-9a8f1e729588435a1129d6b77e8dcdd1b2745ec6.zip
ffmpeg-streaming-9a8f1e729588435a1129d6b77e8dcdd1b2745ec6.tar.gz
img2dec: make use of AV_OPT_TYPE_IMAGE_SIZE
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Diffstat (limited to 'libavformat/img2dec.c')
-rw-r--r--libavformat/img2dec.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c
index 2929d2e..12cf462 100644
--- a/libavformat/img2dec.c
+++ b/libavformat/img2dec.c
@@ -52,7 +52,7 @@ typedef struct {
int split_planes; /**< use independent file for each Y, U, V plane */
char path[1024];
char *pixel_format; /**< Set by a private option. */
- char *video_size; /**< Set by a private option. */
+ int width, height; /**< Set by a private option. */
AVRational framerate; /**< Set by a private option. */
int loop;
enum { PT_GLOB_SEQUENCE, PT_GLOB, PT_SEQUENCE } pattern_type;
@@ -193,8 +193,7 @@ static int img_read_probe(AVProbeData *p)
static int img_read_header(AVFormatContext *s1)
{
VideoDemuxData *s = s1->priv_data;
- int first_index, last_index, ret = 0;
- int width = 0, height = 0;
+ int first_index, last_index;
AVStream *st;
enum AVPixelFormat pix_fmt = AV_PIX_FMT_NONE;
@@ -211,12 +210,6 @@ static int img_read_header(AVFormatContext *s1)
s->pixel_format);
return AVERROR(EINVAL);
}
- if (s->video_size &&
- (ret = av_parse_video_size(&width, &height, s->video_size)) < 0) {
- av_log(s, AV_LOG_ERROR,
- "Could not parse video size: %s.\n", s->video_size);
- return ret;
- }
av_strlcpy(s->path, s1->filename, sizeof(s->path));
s->img_number = 0;
@@ -232,9 +225,9 @@ static int img_read_header(AVFormatContext *s1)
avpriv_set_pts_info(st, 60, s->framerate.den, s->framerate.num);
- if (width && height) {
- st->codec->width = width;
- st->codec->height = height;
+ if (s->width && s->height) {
+ st->codec->width = s->width;
+ st->codec->height = s->height;
}
if (!s->is_pipe) {
@@ -449,7 +442,7 @@ static const AVOption options[] = {
{ "pixel_format", "set video pixel format", OFFSET(pixel_format), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
{ "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 },
+ { "video_size", "set video size", OFFSET(width), AV_OPT_TYPE_IMAGE_SIZE, {.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 },
};
OpenPOWER on IntegriCloud