summaryrefslogtreecommitdiff
path: root/apps/codecs/librm/rm.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/librm/rm.c')
-rw-r--r--apps/codecs/librm/rm.c48
1 files changed, 40 insertions, 8 deletions
diff --git a/apps/codecs/librm/rm.c b/apps/codecs/librm/rm.c
index 00ee37a2f2..7053e7d58c 100644
--- a/apps/codecs/librm/rm.c
+++ b/apps/codecs/librm/rm.c
@@ -29,7 +29,7 @@
29 29
30#define SWAP(a, b) do{uint8_t SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0) 30#define SWAP(a, b) do{uint8_t SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0)
31 31
32static void advance_buffer(uint8_t **buf, int val) 32void advance_buffer(uint8_t **buf, int val)
33{ 33{
34 *buf += val; 34 *buf += val;
35} 35}
@@ -237,10 +237,40 @@ static int real_read_audio_stream_info(int fd, RMContext *rmctx)
237 skipped += 1; 237 skipped += 1;
238 } 238 }
239 239
240 read_uint32be(fd, &rmctx->extradata_size); 240 switch(fourcc) {
241 skipped += 4; 241 case FOURCC('c','o','o','k'):
242 read(fd, rmctx->codec_extradata, rmctx->extradata_size); 242 rmctx->codec_type = CODEC_COOK;
243 skipped += rmctx->extradata_size; 243 read_uint32be(fd, &rmctx->extradata_size);
244 skipped += 4;
245 read(fd, rmctx->codec_extradata, rmctx->extradata_size);
246 skipped += rmctx->extradata_size;
247 break;
248
249 case FOURCC('a','t','r','c'):
250DEBUGF("WERE HERE\n");
251 rmctx->codec_type = CODEC_ATRAC;
252 read_uint32be(fd, &rmctx->extradata_size);
253 skipped += 4;
254 read(fd, rmctx->codec_extradata, rmctx->extradata_size);
255 skipped += rmctx->extradata_size;
256 break;
257
258 case FOURCC('r','a','a','c'):
259 case FOURCC('r','a','c','p'):
260 rmctx->codec_type = CODEC_AAC;
261 read_uint32be(fd, &rmctx->extradata_size);
262 skipped += 4;
263 read(fd, rmctx->codec_extradata, rmctx->extradata_size);
264 skipped += rmctx->extradata_size;
265 break;
266
267 case FOURCC('d','n','e','t'):
268 rmctx->codec_type = CODEC_AC3;
269 break;
270
271 default: /* Not a supported codec */
272 return -1;
273 }
244 274
245 275
246 DEBUGF(" flavor = %d\n",flavor); 276 DEBUGF(" flavor = %d\n",flavor);
@@ -252,8 +282,10 @@ static int real_read_audio_stream_info(int fd, RMContext *rmctx)
252 DEBUGF(" channels= %d\n",rmctx->nb_channels); 282 DEBUGF(" channels= %d\n",rmctx->nb_channels);
253 DEBUGF(" fourcc = %s\n",fourcc2str(fourcc)); 283 DEBUGF(" fourcc = %s\n",fourcc2str(fourcc));
254 DEBUGF(" codec_extra_data_length = %d\n",rmctx->extradata_size); 284 DEBUGF(" codec_extra_data_length = %d\n",rmctx->extradata_size);
255 DEBUGF(" codec_extradata :\n"); 285 if(rmctx->codec_type == CODEC_COOK) {
256 print_cook_extradata(rmctx); 286 DEBUGF(" cook_extradata :\n");
287 print_cook_extradata(rmctx);
288 }
257 289
258 } 290 }
259 291
@@ -530,7 +562,7 @@ int rm_get_packet(uint8_t **src,RMContext *rmctx, RMPacket *pkt)
530 562
531 advance_buffer(src,12); 563 advance_buffer(src,12);
532 consumed += 12; 564 consumed += 12;
533 if (rmctx->codec_type == CODEC_COOK) { 565 if (rmctx->codec_type == CODEC_COOK || rmctx->codec_type == CODEC_ATRAC) {
534 for(x = 0 ; x < w/sps; x++) 566 for(x = 0 ; x < w/sps; x++)
535 { 567 {
536 place = sps*(h*x+((h+1)/2)*(y&1)+(y>>1)); 568 place = sps*(h*x+((h+1)/2)*(y&1)+(y>>1));