]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/tty.c
tty: set avg_frame_rate.
[ffmpeg] / libavformat / tty.c
index 50514e8b08bbca30f998fd1f4ceadea319c774bf..0ae1510491774577587b43c91607320a2bf80cbe 100644 (file)
@@ -31,6 +31,7 @@
 #include "libavutil/opt.h"
 #include "libavutil/parseutils.h"
 #include "avformat.h"
+#include "internal.h"
 #include "sauce.h"
 
 typedef struct {
@@ -71,12 +72,11 @@ static int efi_read(AVFormatContext *avctx, uint64_t start_pos)
     return 0;
 }
 
-static int read_header(AVFormatContext *avctx,
-                       AVFormatParameters *ap)
+static int read_header(AVFormatContext *avctx)
 {
     TtyDemuxContext *s = avctx->priv_data;
     int width = 0, height = 0, ret = 0;
-    AVStream *st = av_new_stream(avctx, 0);
+    AVStream *st = avformat_new_stream(avctx, NULL);
     AVRational framerate;
 
     if (!st) {
@@ -85,7 +85,7 @@ static int read_header(AVFormatContext *avctx,
     }
     st->codec->codec_tag   = 0;
     st->codec->codec_type  = AVMEDIA_TYPE_VIDEO;
-    st->codec->codec_id    = CODEC_ID_ANSI;
+    st->codec->codec_id    = AV_CODEC_ID_ANSI;
 
     if (s->video_size && (ret = av_parse_video_size(&width, &height, s->video_size)) < 0) {
         av_log (avctx, AV_LOG_ERROR, "Couldn't parse video size.\n");
@@ -97,7 +97,8 @@ static int read_header(AVFormatContext *avctx,
     }
     st->codec->width  = width;
     st->codec->height = height;
-    av_set_pts_info(st, 60, framerate.den, framerate.num);
+    avpriv_set_pts_info(st, 60, framerate.den, framerate.num);
+    st->avg_frame_rate = framerate;
 
     /* simulate tty display speed */
     s->chars_per_frame = FFMAX(av_q2d(st->time_base)*s->chars_per_frame, 1);
@@ -142,7 +143,7 @@ static int read_packet(AVFormatContext *avctx, AVPacket *pkt)
 #define OFFSET(x) offsetof(TtyDemuxContext, x)
 #define DEC AV_OPT_FLAG_DECODING_PARAM
 static const AVOption options[] = {
-    { "chars_per_frame", "", offsetof(TtyDemuxContext, chars_per_frame), AV_OPT_TYPE_INT, {.dbl = 6000}, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM},
+    { "chars_per_frame", "", offsetof(TtyDemuxContext, chars_per_frame), AV_OPT_TYPE_INT, {.i64 = 6000}, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM},
     { "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(video_size), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
     { "framerate", "", OFFSET(framerate), AV_OPT_TYPE_STRING, {.str = "25"}, 0, 0, DEC },
     { NULL },