aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/oma.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-12-05 00:11:57 +0100
committerMichael Niedermayer <michaelni@gmx.at>2011-12-05 00:11:57 +0100
commit707138593af5c4783035d0b9cc2d7c8cb2137dfa (patch)
tree7ead2e3c73fd33764dede26546b0238bb40d484b /libavformat/oma.c
parent2f8b6e909dd733d9b722a5266ca516a9a5ba67e9 (diff)
parentdc6d0430503ecd7ed0d81276f977b26b4c4bd916 (diff)
downloadffmpeg-707138593af5c4783035d0b9cc2d7c8cb2137dfa.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: adpcmenc: cosmetics: pretty-printing ac3dec: cosmetics: pretty-printing yuv4mpeg: cosmetics: pretty-printing shorten: remove dead initialization roqvideodec: set AVFrame reference before reget_buffer. bmp: fix some 1bit samples. latmdec: add fate test for audio config change oma: PCM support oma: better format detection with small probe buffer oma: clearify ambiguous if condition wavpack: Properly clip samples during lossy decode Code clean-up for crc.c, lfg.c, log.c, random_see.d, rational.c and tree.c. Cleaned pixdesc.c file in libavutil zmbv.c: coding style clean-up. xan.c: coding style clean-up. mpegvideo.c: code cleanup - first 500 lines. Conflicts: Changelog libavcodec/adpcmenc.c libavcodec/bmp.c libavcodec/zmbv.c libavutil/log.c libavutil/pixdesc.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/oma.c')
-rw-r--r--libavformat/oma.c37
1 files changed, 27 insertions, 10 deletions
diff --git a/libavformat/oma.c b/libavformat/oma.c
index 2fc6cfc554..0363f7fc50 100644
--- a/libavformat/oma.c
+++ b/libavformat/oma.c
@@ -61,9 +61,10 @@ enum {
};
static const AVCodecTag codec_oma_tags[] = {
- { CODEC_ID_ATRAC3, OMA_CODECID_ATRAC3 },
- { CODEC_ID_ATRAC3P, OMA_CODECID_ATRAC3P },
- { CODEC_ID_MP3, OMA_CODECID_MP3 },
+ { CODEC_ID_ATRAC3, OMA_CODECID_ATRAC3 },
+ { CODEC_ID_ATRAC3P, OMA_CODECID_ATRAC3P },
+ { CODEC_ID_MP3, OMA_CODECID_MP3 },
+ { CODEC_ID_PCM_S16BE, OMA_CODECID_LPCM },
};
static const uint64_t leaf_table[] = {
@@ -205,8 +206,8 @@ static int decrypt_init(AVFormatContext *s, ID3v2ExtraMeta *em, uint8_t *header)
while (em) {
if (!strcmp(em->tag, "GEOB") &&
(geob = em->data) &&
- !strcmp(geob->description, "OMG_LSI") ||
- !strcmp(geob->description, "OMG_BKLSI")) {
+ (!strcmp(geob->description, "OMG_LSI") ||
+ !strcmp(geob->description, "OMG_BKLSI"))) {
break;
}
em = em->next;
@@ -361,6 +362,16 @@ static int oma_read_header(AVFormatContext *s,
st->need_parsing = AVSTREAM_PARSE_FULL;
framesize = 1024;
break;
+ case OMA_CODECID_LPCM:
+ /* PCM 44.1 kHz 16 bit stereo big-endian */
+ st->codec->channels = 2;
+ st->codec->sample_rate = 44100;
+ framesize = 1024;
+ /* bit rate = sample rate x PCM block align (= 4) x 8 */
+ st->codec->bit_rate = st->codec->sample_rate * 32;
+ st->codec->bits_per_coded_sample = av_get_bits_per_sample(st->codec->codec_id);
+ avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
+ break;
default:
av_log(s, AV_LOG_ERROR, "Unsupported codec %d!\n",buf[32]);
return -1;
@@ -397,14 +408,20 @@ static int oma_read_probe(AVProbeData *p)
unsigned tag_len = 0;
buf = p->buf;
- /* version must be 3 and flags byte zero */
- if (ff_id3v2_match(buf, ID3v2_EA3_MAGIC) && buf[3] == 3 && !buf[4])
- tag_len = ff_id3v2_tag_len(buf);
- // This check cannot overflow as tag_len has at most 28 bits
- if (p->buf_size < tag_len + 5)
+ if (p->buf_size < ID3v2_HEADER_SIZE ||
+ !ff_id3v2_match(buf, ID3v2_EA3_MAGIC) ||
+ buf[3] != 3 || // version must be 3
+ buf[4]) // flags byte zero
return 0;
+ tag_len = ff_id3v2_tag_len(buf);
+
+ /* This check cannot overflow as tag_len has at most 28 bits */
+ if (p->buf_size < tag_len + 5)
+ /* EA3 header comes late, might be outside of the probe buffer */
+ return AVPROBE_SCORE_MAX / 2;
+
buf += tag_len;
if (!memcmp(buf, "EA3", 3) && !buf[4] && buf[5] == EA3_HEADER_SIZE)