]> git.sesse.net Git - ffmpeg/blob - libavformat/daud.c
Etsi identifies DTS audio with stream_private+descriptor 0x7b (in the PMT).
[ffmpeg] / libavformat / daud.c
1 /*
2  * D-Cinema audio decoder.
3  * Copyright (c) 2005 Reimar Döffinger.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 #include "avformat.h"
20
21 static int daud_header(AVFormatContext *s, AVFormatParameters *ap) {
22     AVStream *st = av_new_stream(s, 0);
23     st->codec->codec_type = CODEC_TYPE_AUDIO;
24     st->codec->codec_id = CODEC_ID_PCM_S24DAUD;
25     st->codec->codec_tag = MKTAG('d', 'a', 'u', 'd');
26     st->codec->channels = 6;
27     st->codec->sample_rate = 96000;
28     st->codec->bit_rate = 3 * 6 * 96000 * 8;
29     st->codec->block_align = 3 * 6;
30     st->codec->bits_per_sample = 24;
31     return 0;
32 }
33
34 static int daud_packet(AVFormatContext *s, AVPacket *pkt) {
35     ByteIOContext *pb = &s->pb;
36     int ret, size;
37     if (url_feof(pb))
38         return AVERROR_IO;
39     size = get_be16(pb);
40     get_be16(pb); // unknown
41     ret = av_get_packet(pb, pkt, size);
42     pkt->stream_index = 0;
43     return ret;
44 }
45
46 static AVInputFormat daud_iformat = {
47     "daud",
48     "D-Cinema audio format",
49     0,
50     NULL,
51     daud_header,
52     daud_packet,
53     NULL,
54     NULL,
55     .extensions = "302",
56 };
57
58 int daud_init(void)
59 {
60     av_register_input_format(&daud_iformat);
61     return 0;
62 }
63