[FFmpeg-cvslog] img2dec: make use of AV_OPT_TYPE_IMAGE_SIZE
Paul B Mahol
git at videolan.org
Fri Apr 5 18:05:33 CEST 2013
ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Fri Apr 5 15:07:52 2013 +0000| [9a8f1e729588435a1129d6b77e8dcdd1b2745ec6] | committer: Paul B Mahol
img2dec: make use of AV_OPT_TYPE_IMAGE_SIZE
Signed-off-by: Paul B Mahol <onemda at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9a8f1e729588435a1129d6b77e8dcdd1b2745ec6
---
libavformat/img2dec.c | 19 ++++++-------------
1 file 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 },
};
More information about the ffmpeg-cvslog
mailing list