summaryrefslogtreecommitdiff
path: root/apps/codecs/librm
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/librm')
-rw-r--r--apps/codecs/librm/rm.c14
-rw-r--r--apps/codecs/librm/rm.h7
2 files changed, 18 insertions, 3 deletions
diff --git a/apps/codecs/librm/rm.c b/apps/codecs/librm/rm.c
index c802a0c5a9..b205e7f88d 100644
--- a/apps/codecs/librm/rm.c
+++ b/apps/codecs/librm/rm.c
@@ -27,6 +27,8 @@
27#include "codeclib.h" 27#include "codeclib.h"
28#endif 28#endif
29 29
30#define SWAP(a, b) do{uint8_t SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0)
31
30void advance_buffer(uint8_t **buf, int val) 32void advance_buffer(uint8_t **buf, int val)
31{ 33{
32 *buf += val; 34 *buf += val;
@@ -464,7 +466,6 @@ void rm_get_packet_fd(int fd,RMContext *rmctx, RMPacket *pkt)
464 " stream = %d\n" 466 " stream = %d\n"
465 " timestmp= %d\n",pkt->version,pkt->length,pkt->stream_number,pkt->timestamp); 467 " timestmp= %d\n",pkt->version,pkt->length,pkt->stream_number,pkt->timestamp);
466 468
467 //getchar();
468 if(pkt->version == 0) 469 if(pkt->version == 0)
469 { 470 {
470 read_uint8(fd,&packet_group); 471 read_uint8(fd,&packet_group);
@@ -550,7 +551,16 @@ int rm_get_packet(uint8_t **src,RMContext *rmctx, RMPacket *pkt)
550 } 551 }
551 rmctx->audio_pkt_cnt = --rmctx->sub_packet_cnt; 552 rmctx->audio_pkt_cnt = --rmctx->sub_packet_cnt;
552 } 553 }
553 } 554 }
555
556 else if (rmctx->codec_type == CODEC_AC3) {
557 /* The byte order of the data is reversed from standard AC3 */
558 for(x = 0; x < pkt->length - PACKET_HEADER_SIZE; x+=2) {
559 SWAP((*src)[0], (*src)[1]);
560 *src += 2;
561 }
562 *src -= x;
563 }
554 rmctx->audio_pkt_cnt++; 564 rmctx->audio_pkt_cnt++;
555 }while(++(rmctx->sub_packet_cnt) < h); 565 }while(++(rmctx->sub_packet_cnt) < h);
556 566
diff --git a/apps/codecs/librm/rm.h b/apps/codecs/librm/rm.h
index 12e9b18fa3..86fe5e7f1a 100644
--- a/apps/codecs/librm/rm.h
+++ b/apps/codecs/librm/rm.h
@@ -28,7 +28,12 @@
28#define DATA_HEADER_SIZE 18 28#define DATA_HEADER_SIZE 18
29#define PACKET_HEADER_SIZE 12 29#define PACKET_HEADER_SIZE 12
30 30
31enum codecs{CODEC_COOK, CODEC_AAC}; 31enum codecs {
32 CODEC_COOK,
33 CODEC_AAC,
34 CODEC_AC3
35};
36
32typedef struct rm_packet 37typedef struct rm_packet
33{ 38{
34 uint8_t *frames[100]; /* Pointers to ordered audio frames in buffer */ 39 uint8_t *frames[100]; /* Pointers to ordered audio frames in buffer */