mirror of https://github.com/FFmpeg/FFmpeg.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
1.9 KiB
60 lines
1.9 KiB
19 years ago
|
/*
|
||
18 years ago
|
* D-Cinema audio demuxer
|
||
18 years ago
|
* Copyright (c) 2005 Reimar Döffinger
|
||
19 years ago
|
*
|
||
14 years ago
|
* This file is part of Libav.
|
||
18 years ago
|
*
|
||
14 years ago
|
* Libav is free software; you can redistribute it and/or
|
||
19 years ago
|
* modify it under the terms of the GNU Lesser General Public
|
||
|
* License as published by the Free Software Foundation; either
|
||
18 years ago
|
* version 2.1 of the License, or (at your option) any later version.
|
||
19 years ago
|
*
|
||
14 years ago
|
* Libav is distributed in the hope that it will be useful,
|
||
19 years ago
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||
|
* Lesser General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU Lesser General Public
|
||
14 years ago
|
* License along with Libav; if not, write to the Free Software
|
||
19 years ago
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||
19 years ago
|
*/
|
||
13 years ago
|
|
||
|
#include "libavutil/channel_layout.h"
|
||
19 years ago
|
#include "avformat.h"
|
||
|
|
||
13 years ago
|
static int daud_header(AVFormatContext *s) {
|
||
14 years ago
|
AVStream *st = avformat_new_stream(s, NULL);
|
||
17 years ago
|
if (!st)
|
||
|
return AVERROR(ENOMEM);
|
||
15 years ago
|
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
|
||
12 years ago
|
st->codec->codec_id = AV_CODEC_ID_PCM_S24DAUD;
|
||
19 years ago
|
st->codec->codec_tag = MKTAG('d', 'a', 'u', 'd');
|
||
|
st->codec->channels = 6;
|
||
13 years ago
|
st->codec->channel_layout = AV_CH_LAYOUT_5POINT1;
|
||
19 years ago
|
st->codec->sample_rate = 96000;
|
||
|
st->codec->bit_rate = 3 * 6 * 96000 * 8;
|
||
|
st->codec->block_align = 3 * 6;
|
||
16 years ago
|
st->codec->bits_per_coded_sample = 24;
|
||
19 years ago
|
return 0;
|
||
|
}
|
||
|
|
||
|
static int daud_packet(AVFormatContext *s, AVPacket *pkt) {
|
||
14 years ago
|
AVIOContext *pb = s->pb;
|
||
19 years ago
|
int ret, size;
|
||
14 years ago
|
if (pb->eof_reached)
|
||
18 years ago
|
return AVERROR(EIO);
|
||
14 years ago
|
size = avio_rb16(pb);
|
||
|
avio_rb16(pb); // unknown
|
||
19 years ago
|
ret = av_get_packet(pb, pkt, size);
|
||
|
pkt->stream_index = 0;
|
||
|
return ret;
|
||
|
}
|
||
|
|
||
14 years ago
|
AVInputFormat ff_daud_demuxer = {
|
||
14 years ago
|
.name = "daud",
|
||
12 years ago
|
.long_name = NULL_IF_CONFIG_SMALL("D-Cinema audio"),
|
||
14 years ago
|
.read_header = daud_header,
|
||
|
.read_packet = daud_packet,
|
||
13 years ago
|
.extensions = "302",
|
||
19 years ago
|
};
|