2 * D-Cinema audio demuxer
3 * Copyright (c) 2005 Reimar Döffinger
5 * This file is part of FFmpeg.
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 #include "libavutil/channel_layout.h"
27 static int daud_header(AVFormatContext
*s
) {
28 AVStream
*st
= avformat_new_stream(s
, NULL
);
30 return AVERROR(ENOMEM
);
31 st
->codecpar
->codec_type
= AVMEDIA_TYPE_AUDIO
;
32 st
->codecpar
->codec_id
= AV_CODEC_ID_PCM_S24DAUD
;
33 st
->codecpar
->codec_tag
= MKTAG('d', 'a', 'u', 'd');
34 st
->codecpar
->ch_layout
= (AVChannelLayout
)AV_CHANNEL_LAYOUT_5POINT1
;
35 st
->codecpar
->sample_rate
= 96000;
36 st
->codecpar
->bit_rate
= 3 * 6 * 96000 * 8;
37 st
->codecpar
->block_align
= 3 * 6;
38 st
->codecpar
->bits_per_coded_sample
= 24;
40 avpriv_set_pts_info(st
, 64, 1, st
->codecpar
->sample_rate
);
45 static int daud_packet(AVFormatContext
*s
, AVPacket
*pkt
) {
46 AVIOContext
*pb
= s
->pb
;
51 avio_rb16(pb
); // unknown
52 ret
= av_get_packet(pb
, pkt
, size
);
53 pkt
->stream_index
= 0;
57 const FFInputFormat ff_daud_demuxer
= {
59 .p
.long_name
= NULL_IF_CONFIG_SMALL("D-Cinema audio"),
60 .p
.extensions
= "302,daud",
61 .read_header
= daud_header
,
62 .read_packet
= daud_packet
,