Revision 461ef741 libavformat/rmdec.c
libavformat/rmdec.c | ||
---|---|---|
22 | 22 |
#include "libavutil/avstring.h" |
23 | 23 |
#include "libavutil/intreadwrite.h" |
24 | 24 |
#include "avformat.h" |
25 |
#include "riff.h" |
|
25 | 26 |
#include "rm.h" |
26 | 27 |
|
27 | 28 |
struct RMStream { |
... | ... | |
48 | 49 |
int audio_pkt_cnt; ///< Output packet counter |
49 | 50 |
} RMDemuxContext; |
50 | 51 |
|
52 |
static const AVCodecTag rm_codec_tags[] = { |
|
53 |
{ CODEC_ID_RV10, MKTAG('R','V','1','0') }, |
|
54 |
{ CODEC_ID_RV20, MKTAG('R','V','2','0') }, |
|
55 |
{ CODEC_ID_RV20, MKTAG('R','V','T','R') }, |
|
56 |
{ CODEC_ID_RV30, MKTAG('R','V','3','0') }, |
|
57 |
{ CODEC_ID_RV40, MKTAG('R','V','4','0') }, |
|
58 |
{ CODEC_ID_AC3, MKTAG('d','n','e','t') }, |
|
59 |
{ CODEC_ID_RA_144, MKTAG('l','p','c','J') }, |
|
60 |
{ CODEC_ID_RA_288, MKTAG('2','8','_','8') }, |
|
61 |
{ CODEC_ID_COOK, MKTAG('c','o','o','k') }, |
|
62 |
{ CODEC_ID_ATRAC3, MKTAG('a','t','r','c') }, |
|
63 |
{ CODEC_ID_SIPR, MKTAG('s','i','p','r') }, |
|
64 |
{ CODEC_ID_AAC, MKTAG('r','a','a','c') }, |
|
65 |
{ CODEC_ID_AAC, MKTAG('r','a','c','p') }, |
|
66 |
{ 0 }, |
|
67 |
}; |
|
68 |
|
|
51 | 69 |
static const unsigned char sipr_swaps[38][2] = { |
52 | 70 |
{ 0, 63 }, { 1, 22 }, { 2, 44 }, { 3, 90 }, |
53 | 71 |
{ 5, 81 }, { 7, 31 }, { 8, 86 }, { 9, 58 }, |
... | ... | |
161 | 179 |
get_str8(pb, buf, sizeof(buf)); /* desc */ |
162 | 180 |
} |
163 | 181 |
st->codec->codec_type = CODEC_TYPE_AUDIO; |
164 |
if (!strcmp(buf, "dnet")) { |
|
165 |
st->codec->codec_id = CODEC_ID_AC3; |
|
182 |
st->codec->codec_tag = AV_RL32(buf); |
|
183 |
st->codec->codec_id = ff_codec_get_id(rm_codec_tags, st->codec->codec_tag); |
|
184 |
switch (st->codec->codec_id) { |
|
185 |
case CODEC_ID_AC3: |
|
166 | 186 |
st->need_parsing = AVSTREAM_PARSE_FULL; |
167 |
} else if (!strcmp(buf, "28_8")) {
|
|
168 |
st->codec->codec_id = CODEC_ID_RA_288;
|
|
187 |
break;
|
|
188 |
case CODEC_ID_RA_288:
|
|
169 | 189 |
st->codec->extradata_size= 0; |
170 | 190 |
ast->audio_framesize = st->codec->block_align; |
171 | 191 |
st->codec->block_align = coded_framesize; |
... | ... | |
176 | 196 |
} |
177 | 197 |
|
178 | 198 |
av_new_packet(&ast->pkt, ast->audio_framesize * sub_packet_h); |
179 |
} else if ((!strcmp(buf, "cook")) || (!strcmp(buf, "atrc")) || (!strcmp(buf, "sipr"))) { |
|
199 |
break; |
|
200 |
case CODEC_ID_COOK: |
|
201 |
case CODEC_ID_ATRAC3: |
|
202 |
case CODEC_ID_SIPR: |
|
180 | 203 |
get_be16(pb); get_byte(pb); |
181 | 204 |
if (((version >> 16) & 0xff) == 5) |
182 | 205 |
get_byte(pb); |
... | ... | |
215 | 238 |
} |
216 | 239 |
|
217 | 240 |
av_new_packet(&ast->pkt, ast->audio_framesize * sub_packet_h); |
218 |
} else if (!strcmp(buf, "raac") || !strcmp(buf, "racp")) { |
|
241 |
break; |
|
242 |
case CODEC_ID_AAC: |
|
219 | 243 |
get_be16(pb); get_byte(pb); |
220 | 244 |
if (((version >> 16) & 0xff) == 5) |
221 | 245 |
get_byte(pb); |
... | ... | |
231 | 255 |
get_byte(pb); |
232 | 256 |
get_buffer(pb, st->codec->extradata, st->codec->extradata_size); |
233 | 257 |
} |
234 |
} else {
|
|
235 |
st->codec->codec_id = CODEC_ID_NONE;
|
|
258 |
break;
|
|
259 |
default:
|
|
236 | 260 |
av_strlcpy(st->codec->codec_name, buf, sizeof(st->codec->codec_name)); |
237 | 261 |
} |
238 | 262 |
if (read_all) { |
... | ... | |
268 | 292 |
goto skip; |
269 | 293 |
} |
270 | 294 |
st->codec->codec_tag = get_le32(pb); |
295 |
st->codec->codec_id = ff_codec_get_id(rm_codec_tags, st->codec->codec_tag); |
|
271 | 296 |
// av_log(s, AV_LOG_DEBUG, "%X %X\n", st->codec->codec_tag, MKTAG('R', 'V', '2', '0')); |
272 |
if ( st->codec->codec_tag != MKTAG('R', 'V', '1', '0') |
|
273 |
&& st->codec->codec_tag != MKTAG('R', 'V', '2', '0') |
|
274 |
&& st->codec->codec_tag != MKTAG('R', 'V', '3', '0') |
|
275 |
&& st->codec->codec_tag != MKTAG('R', 'V', '4', '0') |
|
276 |
&& st->codec->codec_tag != MKTAG('R', 'V', 'T', 'R')) |
|
297 |
if (st->codec->codec_id == CODEC_ID_NONE) |
|
277 | 298 |
goto fail1; |
278 | 299 |
st->codec->width = get_be16(pb); |
279 | 300 |
st->codec->height = get_be16(pb); |
... | ... | |
298 | 319 |
|
299 | 320 |
// av_log(s, AV_LOG_DEBUG, "fps= %d fps2= %d\n", fps, fps2); |
300 | 321 |
st->codec->time_base.den = fps * st->codec->time_base.num; |
322 |
//XXX: do we really need that? |
|
301 | 323 |
switch(((uint8_t*)st->codec->extradata)[4]>>4){ |
302 | 324 |
case 1: st->codec->codec_id = CODEC_ID_RV10; break; |
303 | 325 |
case 2: st->codec->codec_id = CODEC_ID_RV20; break; |
Also available in: Unified diff