diff options
author | Carl Eugen Hoyos <cehoyos@ag.or.at> | 2012-06-03 14:47:26 +0200 |
---|---|---|
committer | Carl Eugen Hoyos <cehoyos@ag.or.at> | 2012-06-03 14:47:26 +0200 |
commit | 169dae81145232514d7894264fc7d56822a81b04 (patch) | |
tree | ee993703228fe15d302f8ebbff4df793965bc669 /libavformat/bintext.c | |
parent | 7f17f4f1a7ff1904ba431c62a6a576dc768203aa (diff) | |
download | ffmpeg-169dae81145232514d7894264fc7d56822a81b04.tar.gz |
Unconditionally compile init_stream() in bintext.
Fixes compilation of xbin, adf and idf demuxer if
bintext demuxer was disabled.
Fixes ticket #1399
Diffstat (limited to 'libavformat/bintext.c')
-rw-r--r-- | libavformat/bintext.c | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/libavformat/bintext.c b/libavformat/bintext.c index c85222756e..3fab3e4f57 100644 --- a/libavformat/bintext.c +++ b/libavformat/bintext.c @@ -48,6 +48,42 @@ typedef struct { uint64_t fsize; /**< file size less metadata buffer */ } BinDemuxContext; +static AVStream * init_stream(AVFormatContext *s) +{ + BinDemuxContext *bin = s->priv_data; + AVStream *st = avformat_new_stream(s, NULL); + if (!st) + return NULL; + st->codec->codec_tag = 0; + st->codec->codec_type = AVMEDIA_TYPE_VIDEO; + + if (bin->video_size) { + if (av_parse_video_size(&st->codec->width, &st->codec->height, bin->video_size) < 0) { + av_log(s, AV_LOG_ERROR, "Could not parse video size: '%s'\n", bin->video_size); + return NULL; + } + } else { + st->codec->width = (80<<3); + 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); + } + + /* simulate tty display speed */ + bin->chars_per_frame = FFMAX(av_q2d(st->time_base) * bin->chars_per_frame, 1); + + return st; +} + #if CONFIG_BINTEXT_DEMUXER | CONFIG_ADF_DEMUXER | CONFIG_IDF_DEMUXER /** * Given filesize and width, calculate height (assume font_height of 16) @@ -104,42 +140,6 @@ static void predict_width(AVCodecContext *avctx, uint64_t fsize, int got_width) avctx->width = fsize > 4000 ? (160<<3) : (80<<3); } -static AVStream * init_stream(AVFormatContext *s) -{ - BinDemuxContext *bin = s->priv_data; - AVStream *st = avformat_new_stream(s, NULL); - if (!st) - return NULL; - st->codec->codec_tag = 0; - st->codec->codec_type = AVMEDIA_TYPE_VIDEO; - - if (bin->video_size) { - if (av_parse_video_size(&st->codec->width, &st->codec->height, bin->video_size) < 0) { - av_log(s, AV_LOG_ERROR, "Could not parse video size: '%s'\n", bin->video_size); - return NULL; - } - } else { - st->codec->width = (80<<3); - 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); - } - - /* simulate tty display speed */ - bin->chars_per_frame = FFMAX(av_q2d(st->time_base) * bin->chars_per_frame, 1); - - return st; -} - static int bintext_read_header(AVFormatContext *s) { BinDemuxContext *bin = s->priv_data; |