77
78
TtyDemuxContext *s = avctx->priv_data;
78
79
int width = 0, height = 0, ret = 0;
79
AVStream *st = av_new_stream(avctx, 0);
80
AVStream *st = avformat_new_stream(avctx, NULL);
80
81
AVRational framerate;
95
96
av_log(avctx, AV_LOG_ERROR, "Could not parse framerate: %s.\n", s->framerate);
98
#if FF_API_FORMAT_PARAMETERS
103
if (ap->time_base.num)
104
framerate = (AVRational){ap->time_base.den, ap->time_base.num};
106
99
st->codec->width = width;
107
100
st->codec->height = height;
108
av_set_pts_info(st, 60, framerate.den, framerate.num);
101
avpriv_set_pts_info(st, 60, framerate.den, framerate.num);
110
103
/* simulate tty display speed */
111
#if FF_API_FORMAT_PARAMETERS
113
s->chars_per_frame = ap->sample_rate;
115
104
s->chars_per_frame = FFMAX(av_q2d(st->time_base)*s->chars_per_frame, 1);
117
106
if (avctx->pb->seekable) {
154
143
#define OFFSET(x) offsetof(TtyDemuxContext, x)
155
144
#define DEC AV_OPT_FLAG_DECODING_PARAM
156
145
static const AVOption options[] = {
157
{ "chars_per_frame", "", offsetof(TtyDemuxContext, chars_per_frame), FF_OPT_TYPE_INT, {.dbl = 6000}, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM},
158
{ "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(video_size), FF_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
159
{ "framerate", "", OFFSET(framerate), FF_OPT_TYPE_STRING, {.str = "25"}, 0, 0, DEC },
146
{ "chars_per_frame", "", offsetof(TtyDemuxContext, chars_per_frame), AV_OPT_TYPE_INT, {.dbl = 6000}, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM},
147
{ "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(video_size), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
148
{ "framerate", "", OFFSET(framerate), AV_OPT_TYPE_STRING, {.str = "25"}, 0, 0, DEC },