]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/smacker.c
Reindent
[ffmpeg] / libavformat / smacker.c
index d11bddc1455163292a57270e7a39cf0d26e80460..59fed35d3f21b93b79226f4fdf7af43bc204a70b 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Smacker demuxer
- * Copyright (c) 2006 Konstantin Shishkov.
+ * Copyright (c) 2006 Konstantin Shishkov
  *
  * This file is part of FFmpeg.
  *
@@ -24,6 +24,7 @@
  */
 
 #include "libavutil/bswap.h"
+#include "libavutil/intreadwrite.h"
 #include "avformat.h"
 
 #define SMACKER_PAL 0x01
@@ -64,7 +65,7 @@ typedef struct SmackerContext {
     int buf_sizes[7];
     int stream_id[7];
     int curstream;
-    offset_t nextpos;
+    int64_t nextpos;
     int64_t aud_pts[7];
 } SmackerContext;
 
@@ -168,15 +169,24 @@ static int smacker_read_header(AVFormatContext *s, AVFormatParameters *ap)
     tbase = 100000;
     av_reduce(&tbase, &smk->pts_inc, tbase, smk->pts_inc, (1UL<<31)-1);
     av_set_pts_info(st, 33, smk->pts_inc, tbase);
+    st->duration = smk->frames;
     /* handle possible audio streams */
     for(i = 0; i < 7; i++) {
         smk->indexes[i] = -1;
-        if((smk->rates[i] & 0xFFFFFF) && !(smk->rates[i] & SMK_AUD_BINKAUD)){
+        if(smk->rates[i] & 0xFFFFFF){
             ast[i] = av_new_stream(s, 0);
             smk->indexes[i] = ast[i]->index;
             ast[i]->codec->codec_type = CODEC_TYPE_AUDIO;
-            ast[i]->codec->codec_id = (smk->rates[i] & SMK_AUD_PACKED) ? CODEC_ID_SMACKAUDIO : CODEC_ID_PCM_U8;
-            ast[i]->codec->codec_tag = MKTAG('S', 'M', 'K', 'A');
+            if (smk->rates[i] & SMK_AUD_BINKAUD) {
+                ast[i]->codec->codec_id = CODEC_ID_BINKAUDIO_RDFT;
+            } else if (smk->rates[i] & SMK_AUD_USEDCT) {
+                ast[i]->codec->codec_id = CODEC_ID_BINKAUDIO_DCT;
+            } else if (smk->rates[i] & SMK_AUD_PACKED){
+                ast[i]->codec->codec_id = CODEC_ID_SMACKAUDIO;
+                ast[i]->codec->codec_tag = MKTAG('S', 'M', 'K', 'A');
+            } else {
+                ast[i]->codec->codec_id = CODEC_ID_PCM_U8;
+            }
             ast[i]->codec->channels = (smk->rates[i] & SMK_AUD_STEREO) ? 2 : 1;
             ast[i]->codec->sample_rate = smk->rates[i] & 0xFFFFFF;
             ast[i]->codec->bits_per_coded_sample = (smk->rates[i] & SMK_AUD_16BITS) ? 16 : 8;