Mercurial > libavformat.hg
annotate aiff.c @ 3861:a0098594ab90 libavformat
Remove useless "else" case in if X { A; return }; else { B }. See discussion
in "Realmedia patch" thread on mailinglist.
author | rbultje |
---|---|
date | Mon, 01 Sep 2008 13:51:24 +0000 |
parents | f062deeedb8d |
children | e6aeb2733e34 |
rev | line source |
---|---|
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
1 /* |
1415
3b00fb8ef8e4
replace coder/decoder file description in libavformat by muxer/demuxer
aurel
parents:
1377
diff
changeset
|
2 * AIFF/AIFF-C muxer and demuxer |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
3 * Copyright (c) 2006 Patrick Guimond |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
4 * |
1358
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
1172
diff
changeset
|
5 * This file is part of FFmpeg. |
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
1172
diff
changeset
|
6 * |
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
1172
diff
changeset
|
7 * FFmpeg is free software; you can redistribute it and/or |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
8 * modify it under the terms of the GNU Lesser General Public |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
9 * License as published by the Free Software Foundation; either |
1358
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
1172
diff
changeset
|
10 * version 2.1 of the License, or (at your option) any later version. |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
11 * |
1358
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
1172
diff
changeset
|
12 * FFmpeg is distributed in the hope that it will be useful, |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
15 * Lesser General Public License for more details. |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
16 * |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
17 * You should have received a copy of the GNU Lesser General Public |
1358
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
1172
diff
changeset
|
18 * License along with FFmpeg; if not, write to the Free Software |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
20 */ |
3286 | 21 |
22 #include "libavutil/intfloat_readwrite.h" | |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
23 #include "avformat.h" |
2545
213268d7594e
move unrelated functions declarations out of allformats.h
aurel
parents:
2274
diff
changeset
|
24 #include "raw.h" |
1172
6a5e58d2114b
move common stuff from avienc.c and wav.c to new file riff.c
mru
parents:
1170
diff
changeset
|
25 #include "riff.h" |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
26 |
1677
2a85c82b8538
add codec_id <-> codec_tag tables to AVIn/OutputFormat
michael
parents:
1481
diff
changeset
|
27 static const AVCodecTag codec_aiff_tags[] = { |
3529 | 28 { CODEC_ID_PCM_S16BE, MKTAG('N','O','N','E') }, |
29 { CODEC_ID_PCM_S8, MKTAG('N','O','N','E') }, | |
30 { CODEC_ID_PCM_S24BE, MKTAG('N','O','N','E') }, | |
31 { CODEC_ID_PCM_S32BE, MKTAG('N','O','N','E') }, | |
3739 | 32 { CODEC_ID_PCM_F32BE, MKTAG('f','l','3','2') }, |
33 { CODEC_ID_PCM_F64BE, MKTAG('f','l','6','4') }, | |
3529 | 34 { CODEC_ID_PCM_ALAW, MKTAG('a','l','a','w') }, |
35 { CODEC_ID_PCM_MULAW, MKTAG('u','l','a','w') }, | |
36 { CODEC_ID_MACE3, MKTAG('M','A','C','3') }, | |
37 { CODEC_ID_MACE6, MKTAG('M','A','C','6') }, | |
38 { CODEC_ID_GSM, MKTAG('G','S','M',' ') }, | |
39 { CODEC_ID_ADPCM_G726, MKTAG('G','7','2','6') }, | |
40 { CODEC_ID_PCM_S16LE, MKTAG('s','o','w','t') }, | |
3066 | 41 { CODEC_ID_ADPCM_IMA_QT, MKTAG('i','m','a','4') }, |
3529 | 42 { CODEC_ID_QDM2, MKTAG('Q','D','M','2') }, |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
43 { 0, 0 }, |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
44 }; |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
45 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
46 #define AIFF 0 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
47 #define AIFF_C_VERSION1 0xA2805140 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
48 |
3530 | 49 static int aiff_codec_get_id(int bps) |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
50 { |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
51 if (bps <= 8) |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
52 return CODEC_ID_PCM_S8; |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
53 if (bps <= 16) |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
54 return CODEC_ID_PCM_S16BE; |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
55 if (bps <= 24) |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
56 return CODEC_ID_PCM_S24BE; |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
57 if (bps <= 32) |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
58 return CODEC_ID_PCM_S32BE; |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
59 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
60 /* bigger than 32 isn't allowed */ |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
61 return 0; |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
62 } |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
63 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
64 /* returns the size of the found tag */ |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
65 static int get_tag(ByteIOContext *pb, uint32_t * tag) |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
66 { |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
67 int size; |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
68 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
69 if (url_feof(pb)) |
2274
b21c2af60bc9
Replace all occurrences of AVERROR_IO with AVERROR(EIO).
takis
parents:
2273
diff
changeset
|
70 return AVERROR(EIO); |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
71 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
72 *tag = get_le32(pb); |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
73 size = get_be32(pb); |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
74 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
75 if (size < 0) |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
76 size = 0x7fffffff; |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
77 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
78 return size; |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
79 } |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
80 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
81 /* Metadata string read */ |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
82 static void get_meta(ByteIOContext *pb, char * str, int strsize, int size) |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
83 { |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
84 int res; |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
85 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
86 if (size > strsize-1) |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
87 res = get_buffer(pb, (uint8_t*)str, strsize-1); |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
88 else |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
89 res = get_buffer(pb, (uint8_t*)str, size); |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
90 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
91 if (res < 0) |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
92 return; |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
93 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
94 str[res] = 0; |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
95 if (size & 1) |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
96 size++; |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
97 size -= res; |
1792 | 98 if (size) |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
99 url_fskip(pb, size); |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
100 } |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
101 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
102 /* Returns the number of sound data frames or negative on error */ |
1124
d3aff2c607f9
Add const to (mostly) char* and make some functions static, which aren't used
diego
parents:
1123
diff
changeset
|
103 static unsigned int get_aiff_header(ByteIOContext *pb, AVCodecContext *codec, |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
104 int size, unsigned version) |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
105 { |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
106 AVExtFloat ext; |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
107 double sample_rate; |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
108 unsigned int num_frames; |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
109 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
110 if (size & 1) |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
111 size++; |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
112 codec->codec_type = CODEC_TYPE_AUDIO; |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
113 codec->channels = get_be16(pb); |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
114 num_frames = get_be32(pb); |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
115 codec->bits_per_sample = get_be16(pb); |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
116 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
117 get_buffer(pb, (uint8_t*)&ext, sizeof(ext));/* Sample rate is in */ |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
118 sample_rate = av_ext2dbl(ext); /* 80 bits BE IEEE extended float */ |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
119 codec->sample_rate = sample_rate; |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
120 size -= 18; |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
121 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
122 /* Got an AIFF-C? */ |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
123 if (version == AIFF_C_VERSION1) { |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
124 codec->codec_tag = get_le32(pb); |
3070 | 125 codec->codec_id = codec_get_id(codec_aiff_tags, codec->codec_tag); |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
126 |
3066 | 127 switch (codec->codec_id) { |
128 case CODEC_ID_PCM_S16BE: | |
3070 | 129 codec->codec_id = aiff_codec_get_id(codec->bits_per_sample); |
1376 | 130 codec->bits_per_sample = av_get_bits_per_sample(codec->codec_id); |
3066 | 131 break; |
132 case CODEC_ID_ADPCM_IMA_QT: | |
133 codec->block_align = 34*codec->channels; | |
3067 | 134 codec->frame_size = 64; |
3066 | 135 break; |
3079 | 136 case CODEC_ID_MACE3: |
3111 | 137 codec->block_align = 2*codec->channels; |
138 codec->frame_size = 6; | |
139 break; | |
3079 | 140 case CODEC_ID_MACE6: |
3111 | 141 codec->block_align = 1*codec->channels; |
3079 | 142 codec->frame_size = 6; |
143 break; | |
3066 | 144 default: |
145 break; | |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
146 } |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
147 size -= 4; |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
148 } else { |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
149 /* Need the codec type */ |
3070 | 150 codec->codec_id = aiff_codec_get_id(codec->bits_per_sample); |
1376 | 151 codec->bits_per_sample = av_get_bits_per_sample(codec->codec_id); |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
152 } |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
153 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
154 /* Block align needs to be computed in all cases, as the definition |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
155 * is specific to applications -> here we use the WAVE format definition */ |
3066 | 156 if (!codec->block_align) |
157 codec->block_align = (codec->bits_per_sample * codec->channels) >> 3; | |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
158 |
3110
3dade22abed6
correctly compute bit rate for compressed audio, should fix seeking in aiff
bcoudurier
parents:
3079
diff
changeset
|
159 codec->bit_rate = (codec->frame_size ? codec->sample_rate/codec->frame_size : |
3dade22abed6
correctly compute bit rate for compressed audio, should fix seeking in aiff
bcoudurier
parents:
3079
diff
changeset
|
160 codec->sample_rate) * (codec->block_align << 3); |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
161 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
162 /* Chunk is over */ |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
163 if (size) |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
164 url_fseek(pb, size, SEEK_CUR); |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
165 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
166 return num_frames; |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
167 } |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
168 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
169 #ifdef CONFIG_MUXERS |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
170 typedef struct { |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
171 offset_t form; |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
172 offset_t frames; |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
173 offset_t ssnd; |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
174 } AIFFOutputContext; |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
175 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
176 static int aiff_write_header(AVFormatContext *s) |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
177 { |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
178 AIFFOutputContext *aiff = s->priv_data; |
2771
d52c718e83f9
Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents:
2545
diff
changeset
|
179 ByteIOContext *pb = s->pb; |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
180 AVCodecContext *enc = s->streams[0]->codec; |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
181 AVExtFloat sample_rate; |
1790
d30211065a35
use aiff when we can, some players only support aiff
bcoudurier
parents:
1684
diff
changeset
|
182 int aifc = 0; |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
183 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
184 /* First verify if format is ok */ |
3070 | 185 if (!enc->codec_tag) |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
186 return -1; |
1790
d30211065a35
use aiff when we can, some players only support aiff
bcoudurier
parents:
1684
diff
changeset
|
187 if (enc->codec_tag != MKTAG('N','O','N','E')) |
d30211065a35
use aiff when we can, some players only support aiff
bcoudurier
parents:
1684
diff
changeset
|
188 aifc = 1; |
d30211065a35
use aiff when we can, some players only support aiff
bcoudurier
parents:
1684
diff
changeset
|
189 |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
190 /* FORM AIFF header */ |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
191 put_tag(pb, "FORM"); |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
192 aiff->form = url_ftell(pb); |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
193 put_be32(pb, 0); /* file length */ |
1790
d30211065a35
use aiff when we can, some players only support aiff
bcoudurier
parents:
1684
diff
changeset
|
194 put_tag(pb, aifc ? "AIFC" : "AIFF"); |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
195 |
3068
9cc9ff5aff9c
set bps to uncompressed original sound data for compressed audio
bcoudurier
parents:
3067
diff
changeset
|
196 if (aifc) { // compressed audio |
9cc9ff5aff9c
set bps to uncompressed original sound data for compressed audio
bcoudurier
parents:
3067
diff
changeset
|
197 enc->bits_per_sample = 16; |
9cc9ff5aff9c
set bps to uncompressed original sound data for compressed audio
bcoudurier
parents:
3067
diff
changeset
|
198 if (!enc->block_align) { |
9cc9ff5aff9c
set bps to uncompressed original sound data for compressed audio
bcoudurier
parents:
3067
diff
changeset
|
199 av_log(s, AV_LOG_ERROR, "block align not set\n"); |
9cc9ff5aff9c
set bps to uncompressed original sound data for compressed audio
bcoudurier
parents:
3067
diff
changeset
|
200 return -1; |
9cc9ff5aff9c
set bps to uncompressed original sound data for compressed audio
bcoudurier
parents:
3067
diff
changeset
|
201 } |
1791 | 202 /* Version chunk */ |
203 put_tag(pb, "FVER"); | |
204 put_be32(pb, 4); | |
205 put_be32(pb, 0xA2805140); | |
1790
d30211065a35
use aiff when we can, some players only support aiff
bcoudurier
parents:
1684
diff
changeset
|
206 } |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
207 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
208 /* Common chunk */ |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
209 put_tag(pb, "COMM"); |
1790
d30211065a35
use aiff when we can, some players only support aiff
bcoudurier
parents:
1684
diff
changeset
|
210 put_be32(pb, aifc ? 24 : 18); /* size */ |
3070 | 211 put_be16(pb, enc->channels); /* Number of channels */ |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
212 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
213 aiff->frames = url_ftell(pb); |
3070 | 214 put_be32(pb, 0); /* Number of frames */ |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
215 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
216 if (!enc->bits_per_sample) |
1375
c42cb95fa0d4
use av_get_bits_per_sample, compute block align if not set
bcoudurier
parents:
1374
diff
changeset
|
217 enc->bits_per_sample = av_get_bits_per_sample(enc->codec_id); |
c42cb95fa0d4
use av_get_bits_per_sample, compute block align if not set
bcoudurier
parents:
1374
diff
changeset
|
218 if (!enc->bits_per_sample) { |
c42cb95fa0d4
use av_get_bits_per_sample, compute block align if not set
bcoudurier
parents:
1374
diff
changeset
|
219 av_log(s, AV_LOG_ERROR, "could not compute bits per sample\n"); |
c42cb95fa0d4
use av_get_bits_per_sample, compute block align if not set
bcoudurier
parents:
1374
diff
changeset
|
220 return -1; |
c42cb95fa0d4
use av_get_bits_per_sample, compute block align if not set
bcoudurier
parents:
1374
diff
changeset
|
221 } |
c42cb95fa0d4
use av_get_bits_per_sample, compute block align if not set
bcoudurier
parents:
1374
diff
changeset
|
222 if (!enc->block_align) |
c42cb95fa0d4
use av_get_bits_per_sample, compute block align if not set
bcoudurier
parents:
1374
diff
changeset
|
223 enc->block_align = (enc->bits_per_sample * enc->channels) >> 3; |
c42cb95fa0d4
use av_get_bits_per_sample, compute block align if not set
bcoudurier
parents:
1374
diff
changeset
|
224 |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
225 put_be16(pb, enc->bits_per_sample); /* Sample size */ |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
226 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
227 sample_rate = av_dbl2ext((double)enc->sample_rate); |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
228 put_buffer(pb, (uint8_t*)&sample_rate, sizeof(sample_rate)); |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
229 |
1790
d30211065a35
use aiff when we can, some players only support aiff
bcoudurier
parents:
1684
diff
changeset
|
230 if (aifc) { |
1791 | 231 put_le32(pb, enc->codec_tag); |
232 put_be16(pb, 0); | |
1790
d30211065a35
use aiff when we can, some players only support aiff
bcoudurier
parents:
1684
diff
changeset
|
233 } |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
234 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
235 /* Sound data chunk */ |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
236 put_tag(pb, "SSND"); |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
237 aiff->ssnd = url_ftell(pb); /* Sound chunk size */ |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
238 put_be32(pb, 0); /* Sound samples data size */ |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
239 put_be32(pb, 0); /* Data offset */ |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
240 put_be32(pb, 0); /* Block-size (block align) */ |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
241 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
242 av_set_pts_info(s->streams[0], 64, 1, s->streams[0]->codec->sample_rate); |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
243 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
244 /* Data is starting here */ |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
245 put_flush_packet(pb); |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
246 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
247 return 0; |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
248 } |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
249 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
250 static int aiff_write_packet(AVFormatContext *s, AVPacket *pkt) |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
251 { |
2771
d52c718e83f9
Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents:
2545
diff
changeset
|
252 ByteIOContext *pb = s->pb; |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
253 put_buffer(pb, pkt->data, pkt->size); |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
254 return 0; |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
255 } |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
256 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
257 static int aiff_write_trailer(AVFormatContext *s) |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
258 { |
2771
d52c718e83f9
Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents:
2545
diff
changeset
|
259 ByteIOContext *pb = s->pb; |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
260 AIFFOutputContext *aiff = s->priv_data; |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
261 AVCodecContext *enc = s->streams[0]->codec; |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
262 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
263 /* Chunks sizes must be even */ |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
264 offset_t file_size, end_size; |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
265 end_size = file_size = url_ftell(pb); |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
266 if (file_size & 1) { |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
267 put_byte(pb, 0); |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
268 end_size++; |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
269 } |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
270 |
2771
d52c718e83f9
Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents:
2545
diff
changeset
|
271 if (!url_is_streamed(s->pb)) { |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
272 /* File length */ |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
273 url_fseek(pb, aiff->form, SEEK_SET); |
3071 | 274 put_be32(pb, file_size - aiff->form - 4); |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
275 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
276 /* Number of sample frames */ |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
277 url_fseek(pb, aiff->frames, SEEK_SET); |
3071 | 278 put_be32(pb, (file_size-aiff->ssnd-12)/enc->block_align); |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
279 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
280 /* Sound Data chunk size */ |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
281 url_fseek(pb, aiff->ssnd, SEEK_SET); |
3071 | 282 put_be32(pb, file_size - aiff->ssnd - 4); |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
283 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
284 /* return to the end */ |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
285 url_fseek(pb, end_size, SEEK_SET); |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
286 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
287 put_flush_packet(pb); |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
288 } |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
289 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
290 return 0; |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
291 } |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
292 #endif //CONFIG_MUXERS |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
293 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
294 static int aiff_probe(AVProbeData *p) |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
295 { |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
296 /* check file header */ |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
297 if (p->buf[0] == 'F' && p->buf[1] == 'O' && |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
298 p->buf[2] == 'R' && p->buf[3] == 'M' && |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
299 p->buf[8] == 'A' && p->buf[9] == 'I' && |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
300 p->buf[10] == 'F' && (p->buf[11] == 'F' || p->buf[11] == 'C')) |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
301 return AVPROBE_SCORE_MAX; |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
302 else |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
303 return 0; |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
304 } |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
305 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
306 /* aiff input */ |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
307 static int aiff_read_header(AVFormatContext *s, |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
308 AVFormatParameters *ap) |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
309 { |
2206
c049274b7bd4
support files with COMM chunk after SSND, fix invalid_nocommon.aiff which is spec compliant
bcoudurier
parents:
2060
diff
changeset
|
310 int size, filesize; |
c049274b7bd4
support files with COMM chunk after SSND, fix invalid_nocommon.aiff which is spec compliant
bcoudurier
parents:
2060
diff
changeset
|
311 offset_t offset = 0; |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
312 uint32_t tag; |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
313 unsigned version = AIFF_C_VERSION1; |
2771
d52c718e83f9
Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents:
2545
diff
changeset
|
314 ByteIOContext *pb = s->pb; |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
315 AVStream * st = s->streams[0]; |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
316 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
317 /* check FORM header */ |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
318 filesize = get_tag(pb, &tag); |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
319 if (filesize < 0 || tag != MKTAG('F', 'O', 'R', 'M')) |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
320 return AVERROR_INVALIDDATA; |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
321 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
322 /* AIFF data type */ |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
323 tag = get_le32(pb); |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
324 if (tag == MKTAG('A', 'I', 'F', 'F')) /* Got an AIFF file */ |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
325 version = AIFF; |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
326 else if (tag != MKTAG('A', 'I', 'F', 'C')) /* An AIFF-C file then */ |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
327 return AVERROR_INVALIDDATA; |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
328 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
329 filesize -= 4; |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
330 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
331 st = av_new_stream(s, 0); |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
332 if (!st) |
2273
7eb456c4ed8a
Replace all occurrences of AVERROR_NOMEM with AVERROR(ENOMEM).
takis
parents:
2209
diff
changeset
|
333 return AVERROR(ENOMEM); |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
334 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
335 while (filesize > 0) { |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
336 /* parse different chunks */ |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
337 size = get_tag(pb, &tag); |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
338 if (size < 0) |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
339 return size; |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
340 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
341 filesize -= size + 8; |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
342 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
343 switch (tag) { |
3072 | 344 case MKTAG('C', 'O', 'M', 'M'): /* Common chunk */ |
345 /* Then for the complete header info */ | |
3295
4616ba855d62
cosmetics, remove space before opening parenthesis
bcoudurier
parents:
3286
diff
changeset
|
346 st->nb_frames = get_aiff_header(pb, st->codec, size, version); |
3072 | 347 if (st->nb_frames < 0) |
348 return st->nb_frames; | |
349 if (offset > 0) // COMM is after SSND | |
350 goto got_sound; | |
351 break; | |
352 case MKTAG('F', 'V', 'E', 'R'): /* Version chunk */ | |
353 version = get_be32(pb); | |
354 break; | |
355 case MKTAG('N', 'A', 'M', 'E'): /* Sample name chunk */ | |
3295
4616ba855d62
cosmetics, remove space before opening parenthesis
bcoudurier
parents:
3286
diff
changeset
|
356 get_meta(pb, s->title, sizeof(s->title), size); |
3072 | 357 break; |
358 case MKTAG('A', 'U', 'T', 'H'): /* Author chunk */ | |
3295
4616ba855d62
cosmetics, remove space before opening parenthesis
bcoudurier
parents:
3286
diff
changeset
|
359 get_meta(pb, s->author, sizeof(s->author), size); |
3072 | 360 break; |
361 case MKTAG('(', 'c', ')', ' '): /* Copyright chunk */ | |
3295
4616ba855d62
cosmetics, remove space before opening parenthesis
bcoudurier
parents:
3286
diff
changeset
|
362 get_meta(pb, s->copyright, sizeof(s->copyright), size); |
3072 | 363 break; |
364 case MKTAG('A', 'N', 'N', 'O'): /* Annotation chunk */ | |
3295
4616ba855d62
cosmetics, remove space before opening parenthesis
bcoudurier
parents:
3286
diff
changeset
|
365 get_meta(pb, s->comment, sizeof(s->comment), size); |
3072 | 366 break; |
367 case MKTAG('S', 'S', 'N', 'D'): /* Sampled sound chunk */ | |
368 offset = get_be32(pb); /* Offset of sound data */ | |
369 get_be32(pb); /* BlockSize... don't care */ | |
370 offset += url_ftell(pb); /* Compute absolute data offset */ | |
3297
df2df4c07d12
try to demux even if codec is not recognized, should demux M1F1-float32C-AFsp.aif and fix #454
bcoudurier
parents:
3296
diff
changeset
|
371 if (st->codec->block_align) /* Assume COMM already parsed */ |
3072 | 372 goto got_sound; |
373 if (url_is_streamed(pb)) { | |
374 av_log(s, AV_LOG_ERROR, "file is not seekable\n"); | |
375 return -1; | |
376 } | |
377 url_fskip(pb, size - 8); | |
378 break; | |
3074 | 379 case MKTAG('w', 'a', 'v', 'e'): |
3075 | 380 if ((uint64_t)size > (1<<30)) |
381 return -1; | |
3074 | 382 st->codec->extradata = av_mallocz(size + FF_INPUT_BUFFER_PADDING_SIZE); |
383 if (!st->codec->extradata) | |
384 return AVERROR(ENOMEM); | |
385 st->codec->extradata_size = size; | |
386 get_buffer(pb, st->codec->extradata, size); | |
387 break; | |
3072 | 388 default: /* Jump */ |
389 if (size & 1) /* Always even aligned */ | |
390 size++; | |
391 url_fskip (pb, size); | |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
392 } |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
393 } |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
394 |
3297
df2df4c07d12
try to demux even if codec is not recognized, should demux M1F1-float32C-AFsp.aif and fix #454
bcoudurier
parents:
3296
diff
changeset
|
395 if (!st->codec->block_align) { |
df2df4c07d12
try to demux even if codec is not recognized, should demux M1F1-float32C-AFsp.aif and fix #454
bcoudurier
parents:
3296
diff
changeset
|
396 av_log(s, AV_LOG_ERROR, "could not find COMM tag\n"); |
df2df4c07d12
try to demux even if codec is not recognized, should demux M1F1-float32C-AFsp.aif and fix #454
bcoudurier
parents:
3296
diff
changeset
|
397 return -1; |
df2df4c07d12
try to demux even if codec is not recognized, should demux M1F1-float32C-AFsp.aif and fix #454
bcoudurier
parents:
3296
diff
changeset
|
398 } |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
399 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
400 got_sound: |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
401 /* Now positioned, get the sound data start and end */ |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
402 if (st->nb_frames) |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
403 s->file_size = st->nb_frames * st->codec->block_align; |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
404 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
405 av_set_pts_info(st, 64, 1, st->codec->sample_rate); |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
406 st->start_time = 0; |
3067 | 407 st->duration = st->codec->frame_size ? |
408 st->nb_frames * st->codec->frame_size : st->nb_frames; | |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
409 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
410 /* Position the stream at the first block */ |
2206
c049274b7bd4
support files with COMM chunk after SSND, fix invalid_nocommon.aiff which is spec compliant
bcoudurier
parents:
2060
diff
changeset
|
411 url_fseek(pb, offset, SEEK_SET); |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
412 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
413 return 0; |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
414 } |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
415 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
416 #define MAX_SIZE 4096 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
417 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
418 static int aiff_read_packet(AVFormatContext *s, |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
419 AVPacket *pkt) |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
420 { |
1087 | 421 AVStream *st = s->streams[0]; |
422 int res; | |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
423 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
424 /* End of stream may be reached */ |
2771
d52c718e83f9
Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents:
2545
diff
changeset
|
425 if (url_feof(s->pb)) |
2274
b21c2af60bc9
Replace all occurrences of AVERROR_IO with AVERROR(EIO).
takis
parents:
2273
diff
changeset
|
426 return AVERROR(EIO); |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
427 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
428 /* Now for that packet */ |
2771
d52c718e83f9
Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents:
2545
diff
changeset
|
429 res = av_get_packet(s->pb, pkt, (MAX_SIZE / st->codec->block_align) * st->codec->block_align); |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
430 if (res < 0) |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
431 return res; |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
432 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
433 /* Only one stream in an AIFF file */ |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
434 pkt->stream_index = 0; |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
435 return 0; |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
436 } |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
437 |
1169 | 438 #ifdef CONFIG_AIFF_DEMUXER |
439 AVInputFormat aiff_demuxer = { | |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
440 "aiff", |
3424
7a0230981402
Make long_names in lavf/lavdev optional depending on CONFIG_SMALL.
diego
parents:
3297
diff
changeset
|
441 NULL_IF_CONFIG_SMALL("Audio IFF"), |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
442 0, |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
443 aiff_probe, |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
444 aiff_read_header, |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
445 aiff_read_packet, |
3073 | 446 NULL, |
3435 | 447 pcm_read_seek, |
3766
f062deeedb8d
Change codec_tag type from const struct AVCodecTag ** to const struct AVCodecTag * const *
reimar
parents:
3739
diff
changeset
|
448 .codec_tag= (const AVCodecTag* const []){codec_aiff_tags, 0}, |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
449 }; |
1169 | 450 #endif |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
451 |
1170 | 452 #ifdef CONFIG_AIFF_MUXER |
1169 | 453 AVOutputFormat aiff_muxer = { |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
454 "aiff", |
3424
7a0230981402
Make long_names in lavf/lavdev optional depending on CONFIG_SMALL.
diego
parents:
3297
diff
changeset
|
455 NULL_IF_CONFIG_SMALL("Audio IFF"), |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
456 "audio/aiff", |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
457 "aif,aiff,afc,aifc", |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
458 sizeof(AIFFOutputContext), |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
459 CODEC_ID_PCM_S16BE, |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
460 CODEC_ID_NONE, |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
461 aiff_write_header, |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
462 aiff_write_packet, |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
463 aiff_write_trailer, |
3766
f062deeedb8d
Change codec_tag type from const struct AVCodecTag ** to const struct AVCodecTag * const *
reimar
parents:
3739
diff
changeset
|
464 .codec_tag= (const AVCodecTag* const []){codec_aiff_tags, 0}, |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
465 }; |
1169 | 466 #endif |