]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/a64.c
mov: Wrap stsc index and count compare in a separate function
[ffmpeg] / libavformat / a64.c
index c8e8e646b52d7c2b9b257736a907867cf93baffa..fdd6f62750e651b85d3925c6e436b7321fd50510 100644 (file)
@@ -27,7 +27,7 @@
 
 static int a64_write_header(AVFormatContext *s)
 {
-    AVCodecContext *avctx = s->streams[0]->codec;
+    AVCodecParameters *par = s->streams[0]->codecpar;
     uint8_t header[5] = {
         0x00, //load
         0x40, //address
@@ -36,20 +36,20 @@ static int a64_write_header(AVFormatContext *s)
         0x00  //fps in 50/fps;
     };
 
-    if (avctx->extradata_size < 4) {
+    if (par->extradata_size < 4) {
         av_log(s, AV_LOG_ERROR, "Missing extradata\n");
         return AVERROR_INVALIDDATA;
     }
 
-    switch (avctx->codec->id) {
+    switch (par->codec_id) {
     case AV_CODEC_ID_A64_MULTI:
         header[2] = 0x00;
-        header[3] = AV_RB32(avctx->extradata+0);
+        header[3] = AV_RB32(par->extradata+0);
         header[4] = 2;
         break;
     case AV_CODEC_ID_A64_MULTI5:
         header[2] = 0x01;
-        header[3] = AV_RB32(avctx->extradata+0);
+        header[3] = AV_RB32(par->extradata+0);
         header[4] = 3;
         break;
     default: