]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/filmstripenc.c
mov: Wrap stsc index and count compare in a separate function
[ffmpeg] / libavformat / filmstripenc.c
index d000c4f9f58237e91f078424b998b299c3f195d1..5a09691a708164a681112efc1f13173795e6f329 100644 (file)
 
 #define RAND_TAG MKBETAG('R','a','n','d')
 
-typedef struct {
+typedef struct FilmstripMuxContext {
     int nb_frames;
 } FilmstripMuxContext;
 
 static int write_header(AVFormatContext *s)
 {
-    if (s->streams[0]->codec->pix_fmt != PIX_FMT_RGBA) {
-        av_log(s, AV_LOG_ERROR, "only PIX_FMT_RGBA is supported\n");
+    if (s->streams[0]->codecpar->format != AV_PIX_FMT_RGBA) {
+        av_log(s, AV_LOG_ERROR, "only AV_PIX_FMT_RGBA is supported\n");
         return AVERROR_INVALIDDATA;
     }
     return 0;
@@ -61,10 +61,11 @@ static int write_trailer(AVFormatContext *s)
     avio_wb32(pb, film->nb_frames);
     avio_wb16(pb, 0);  // packing method
     avio_wb16(pb, 0);  // reserved
-    avio_wb16(pb, st->codec->width);
-    avio_wb16(pb, st->codec->height);
+    avio_wb16(pb, st->codecpar->width);
+    avio_wb16(pb, st->codecpar->height);
     avio_wb16(pb, 0);  // leading
-    avio_wb16(pb, 1/av_q2d(st->codec->time_base));
+    // TODO: should be avg_frame_rate
+    avio_wb16(pb, 1/av_q2d(st->time_base));
     for (i = 0; i < 16; i++)
         avio_w8(pb, 0x00);  // reserved