Mercurial > libavformat.hg
comparison daud.c @ 847:f5a33919749a libavformat
Support D-Cinema audio demuxing.
author | reimar |
---|---|
date | Fri, 02 Sep 2005 19:18:59 +0000 |
parents | |
children | edbe5c3717f9 |
comparison
equal
deleted
inserted
replaced
846:fd1c2109505e | 847:f5a33919749a |
---|---|
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 |