Browse code

oma: PCM support

Signed-off-by: David Goldwich <david.goldwich@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>

David Goldwich authored on 2011/12/02 13:54:21
Showing 2 changed files
... ...
@@ -104,6 +104,7 @@ easier to use. The changes are:
104 104
 - OS X Video Decoder Acceleration (VDA) support
105 105
 - CRI ADX audio format demuxer
106 106
 - Playstation Portable PMP format demuxer
107
+- PCM format support in OMA demuxer
107 108
 
108 109
 
109 110
 version 0.7:
... ...
@@ -61,9 +61,10 @@ enum {
61 61
 };
62 62
 
63 63
 static const AVCodecTag codec_oma_tags[] = {
64
-    { CODEC_ID_ATRAC3,  OMA_CODECID_ATRAC3 },
65
-    { CODEC_ID_ATRAC3P, OMA_CODECID_ATRAC3P },
66
-    { CODEC_ID_MP3,     OMA_CODECID_MP3 },
64
+    { CODEC_ID_ATRAC3,      OMA_CODECID_ATRAC3 },
65
+    { CODEC_ID_ATRAC3P,     OMA_CODECID_ATRAC3P },
66
+    { CODEC_ID_MP3,         OMA_CODECID_MP3 },
67
+    { CODEC_ID_PCM_S16BE,   OMA_CODECID_LPCM },
67 68
 };
68 69
 
69 70
 static const uint64_t leaf_table[] = {
... ...
@@ -358,6 +359,16 @@ static int oma_read_header(AVFormatContext *s,
358 358
             st->need_parsing = AVSTREAM_PARSE_FULL;
359 359
             framesize = 1024;
360 360
             break;
361
+        case OMA_CODECID_LPCM:
362
+            /* PCM 44.1 kHz 16 bit stereo big-endian */
363
+            st->codec->channels = 2;
364
+            st->codec->sample_rate = 44100;
365
+            framesize = 1024;
366
+            /* bit rate = sample rate x PCM block align (= 4) x 8 */
367
+            st->codec->bit_rate = st->codec->sample_rate * 32;
368
+            st->codec->bits_per_coded_sample = av_get_bits_per_sample(st->codec->codec_id);
369
+            avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
370
+            break;
361 371
         default:
362 372
             av_log(s, AV_LOG_ERROR, "Unsupported codec %d!\n",buf[32]);
363 373
             return -1;