]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/aiff.c
Remove Fabrice's copyright from the Makefiles. They have been entirely
[ffmpeg] / libavformat / aiff.c
index 4343e79c48b90842facd8d822ea3f293c43f4197..4c701fb383140be553c1a1ee66b6d720b5de5ea8 100644 (file)
  * License along with FFmpeg; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
+
+#include "libavutil/intfloat_readwrite.h"
 #include "avformat.h"
 #include "raw.h"
 #include "riff.h"
-#include "intfloat_readwrite.h"
 
 static const AVCodecTag codec_aiff_tags[] = {
     { CODEC_ID_PCM_S16BE, MKTAG('N','O','N','E') },
@@ -131,7 +132,11 @@ static unsigned int get_aiff_header(ByteIOContext *pb, AVCodecContext *codec,
             codec->frame_size = 64;
             break;
         case CODEC_ID_MACE3:
+            codec->block_align = 2*codec->channels;
+            codec->frame_size = 6;
+            break;
         case CODEC_ID_MACE6:
+            codec->block_align = 1*codec->channels;
             codec->frame_size = 6;
             break;
         default:
@@ -144,9 +149,6 @@ static unsigned int get_aiff_header(ByteIOContext *pb, AVCodecContext *codec,
         codec->bits_per_sample = av_get_bits_per_sample(codec->codec_id);
     }
 
-    if (!codec->codec_id)
-        return AVERROR_INVALIDDATA;
-
     /* Block align needs to be computed in all cases, as the definition
      * is specific to applications -> here we use the WAVE format definition */
     if (!codec->block_align)
@@ -339,7 +341,7 @@ static int aiff_read_header(AVFormatContext *s,
         switch (tag) {
         case MKTAG('C', 'O', 'M', 'M'):     /* Common chunk */
             /* Then for the complete header info */
-            st->nb_frames = get_aiff_header (pb, st->codec, size, version);
+            st->nb_frames = get_aiff_header(pb, st->codec, size, version);
             if (st->nb_frames < 0)
                 return st->nb_frames;
             if (offset > 0) // COMM is after SSND
@@ -349,22 +351,22 @@ static int aiff_read_header(AVFormatContext *s,
             version = get_be32(pb);
             break;
         case MKTAG('N', 'A', 'M', 'E'):     /* Sample name chunk */
-            get_meta (pb, s->title, sizeof(s->title), size);
+            get_meta(pb, s->title, sizeof(s->title), size);
             break;
         case MKTAG('A', 'U', 'T', 'H'):     /* Author chunk */
-            get_meta (pb, s->author, sizeof(s->author), size);
+            get_meta(pb, s->author, sizeof(s->author), size);
             break;
         case MKTAG('(', 'c', ')', ' '):     /* Copyright chunk */
-            get_meta (pb, s->copyright, sizeof(s->copyright), size);
+            get_meta(pb, s->copyright, sizeof(s->copyright), size);
             break;
         case MKTAG('A', 'N', 'N', 'O'):     /* Annotation chunk */
-            get_meta (pb, s->comment, sizeof(s->comment), size);
+            get_meta(pb, s->comment, sizeof(s->comment), size);
             break;
         case MKTAG('S', 'S', 'N', 'D'):     /* Sampled sound chunk */
             offset = get_be32(pb);      /* Offset of sound data */
             get_be32(pb);               /* BlockSize... don't care */
             offset += url_ftell(pb);    /* Compute absolute data offset */
-            if (st->codec->codec_id)    /* Assume COMM already parsed */
+            if (st->codec->block_align)    /* Assume COMM already parsed */
                 goto got_sound;
             if (url_is_streamed(pb)) {
                 av_log(s, AV_LOG_ERROR, "file is not seekable\n");
@@ -388,8 +390,10 @@ static int aiff_read_header(AVFormatContext *s,
         }
     }
 
-    /* End of loop and didn't get sound */
-    return AVERROR_INVALIDDATA;
+    if (!st->codec->block_align) {
+        av_log(s, AV_LOG_ERROR, "could not find COMM tag\n");
+        return -1;
+    }
 
 got_sound:
     /* Now positioned, get the sound data start and end */
@@ -438,7 +442,7 @@ static int aiff_read_seek(AVFormatContext *s,
 #ifdef CONFIG_AIFF_DEMUXER
 AVInputFormat aiff_demuxer = {
     "aiff",
-    "Audio IFF",
+    NULL_IF_CONFIG_SMALL("Audio IFF"),
     0,
     aiff_probe,
     aiff_read_header,
@@ -452,7 +456,7 @@ AVInputFormat aiff_demuxer = {
 #ifdef CONFIG_AIFF_MUXER
 AVOutputFormat aiff_muxer = {
     "aiff",
-    "Audio IFF",
+    NULL_IF_CONFIG_SMALL("Audio IFF"),
     "audio/aiff",
     "aif,aiff,afc,aifc",
     sizeof(AIFFOutputContext),