diff options
author | Paul B Mahol <onemda@gmail.com> | 2013-04-05 14:39:42 +0000 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2013-04-05 15:42:24 +0000 |
commit | 33b6d215fa4a740a771d58ddb3007e19dbdb1041 (patch) | |
tree | af9f1d93d9c7daf48dd3b541df265d2f37422ebc | |
parent | 37a9708391ae1fc202f090f24039b242f308c303 (diff) | |
download | ffmpeg-streaming-33b6d215fa4a740a771d58ddb3007e19dbdb1041.zip ffmpeg-streaming-33b6d215fa4a740a771d58ddb3007e19dbdb1041.tar.gz |
bintext: make use of AV_OPT_TYPE_VIDEO_RATE
Signed-off-by: Paul B Mahol <onemda@gmail.com>
-rw-r--r-- | libavformat/bintext.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/libavformat/bintext.c b/libavformat/bintext.c index 91f95f3..502bb12 100644 --- a/libavformat/bintext.c +++ b/libavformat/bintext.c @@ -44,7 +44,7 @@ typedef struct { set by private options as characters per second, and then converted to characters per frame at runtime */ char *video_size; /**< video size (WxH pixels) (private option) */ - char *framerate; /**< frames per second (private option) */ + AVRational framerate; /**< frames per second (private option) */ uint64_t fsize; /**< file size less metadata buffer */ } BinDemuxContext; @@ -67,16 +67,7 @@ static AVStream * init_stream(AVFormatContext *s) st->codec->height = (25<<4); } - if (bin->framerate) { - AVRational framerate; - if (av_parse_video_rate(&framerate, bin->framerate) < 0) { - av_log(s, AV_LOG_ERROR, "Could not parse framerate: '%s'\n", bin->framerate); - return NULL; - } - avpriv_set_pts_info(st, 60, framerate.den, framerate.num); - } else { - avpriv_set_pts_info(st, 60, 1, 25); - } + avpriv_set_pts_info(st, 60, bin->framerate.den, bin->framerate.num); /* simulate tty display speed */ bin->chars_per_frame = FFMAX(av_q2d(st->time_base) * bin->chars_per_frame, 1); @@ -347,7 +338,7 @@ static int read_packet(AVFormatContext *s, static const AVOption options[] = { { "linespeed", "set simulated line speed (bytes per second)", OFFSET(chars_per_frame), AV_OPT_TYPE_INT, {.i64 = 6000}, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM}, { "video_size", "set video size, such as 640x480 or hd720.", OFFSET(video_size), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, AV_OPT_FLAG_DECODING_PARAM }, - { "framerate", "set framerate (frames per second)", OFFSET(framerate), AV_OPT_TYPE_STRING, {.str = "25"}, 0, 0, AV_OPT_FLAG_DECODING_PARAM }, + { "framerate", "set framerate (frames per second)", OFFSET(framerate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, 0, AV_OPT_FLAG_DECODING_PARAM }, { NULL }, }; |