annotate daud.c @ 1115:8aa77d05572e libavformat

dont load the index if we cant seek back
author michael
date Wed, 14 Jun 2006 00:32:10 +0000
parents edbe5c3717f9
children d89d7ef290da
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
847
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
1 /*
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
2 * D-Cinema audio decoder.
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
3 * Copyright (c) 2005 Reimar Döffinger.
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
4 *
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
5 * This library is free software; you can redistribute it and/or
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
6 * modify it under the terms of the GNU Lesser General Public
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
7 * License as published by the Free Software Foundation; either
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
8 * version 2 of the License, or (at your option) any later version.
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
9 *
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
10 * This library is distributed in the hope that it will be useful,
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
13 * Lesser General Public License for more details.
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
14 *
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
15 * You should have received a copy of the GNU Lesser General Public
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
16 * License along with this library; if not, write to the Free Software
896
edbe5c3717f9 Update licensing information: The FSF changed postal address.
diego
parents: 847
diff changeset
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
847
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
18 */
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
19 #include "avformat.h"
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
20
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
21 static int daud_header(AVFormatContext *s, AVFormatParameters *ap) {
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
22 AVStream *st = av_new_stream(s, 0);
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
23 st->codec->codec_type = CODEC_TYPE_AUDIO;
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
24 st->codec->codec_id = CODEC_ID_PCM_S24DAUD;
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
25 st->codec->codec_tag = MKTAG('d', 'a', 'u', 'd');
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
26 st->codec->channels = 6;
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
27 st->codec->sample_rate = 96000;
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
28 st->codec->bit_rate = 3 * 6 * 96000 * 8;
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
29 st->codec->block_align = 3 * 6;
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
30 st->codec->bits_per_sample = 24;
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
31 return 0;
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
32 }
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
33
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
34 static int daud_packet(AVFormatContext *s, AVPacket *pkt) {
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
35 ByteIOContext *pb = &s->pb;
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
36 int ret, size;
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
37 if (url_feof(pb))
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
38 return AVERROR_IO;
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
39 size = get_be16(pb);
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
40 get_be16(pb); // unknown
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
41 ret = av_get_packet(pb, pkt, size);
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
42 pkt->stream_index = 0;
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
43 return ret;
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
44 }
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
45
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
46 static AVInputFormat daud_iformat = {
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
47 "daud",
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
48 "D-Cinema audio format",
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
49 0,
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
50 NULL,
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
51 daud_header,
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
52 daud_packet,
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
53 NULL,
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
54 NULL,
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
55 .extensions = "302",
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
56 };
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
57
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
58 int daud_init(void)
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
59 {
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
60 av_register_input_format(&daud_iformat);
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
61 return 0;
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
62 }
f5a33919749a Support D-Cinema audio demuxing.
reimar
parents:
diff changeset
63