]> git.sesse.net Git - ffmpeg/blob - libavcodec/ac3dec_float.c
Merge commit '58400ac133bcfb6bf8196b4e5208bc178307739b'
[ffmpeg] / libavcodec / ac3dec_float.c
1 /*
2  * AC-3 Audio Decoder
3  * This code was developed as part of Google Summer of Code 2006.
4  * E-AC-3 support was added as part of Google Summer of Code 2007.
5  *
6  * Copyright (c) 2006 Kartikey Mahendra BHATT (bhattkm at gmail dot com)
7  * Copyright (c) 2007-2008 Bartlomiej Wolowiec <bartek.wolowiec@gmail.com>
8  * Copyright (c) 2007 Justin Ruggles <justin.ruggles@gmail.com>
9  *
10  * This file is part of FFmpeg.
11  *
12  * FFmpeg is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU Lesser General Public
14  * License as published by the Free Software Foundation; either
15  * version 2.1 of the License, or (at your option) any later version.
16  *
17  * FFmpeg is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20  * Lesser General Public License for more details.
21  *
22  * You should have received a copy of the GNU Lesser General Public
23  * License along with FFmpeg; if not, write to the Free Software
24  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
25  */
26
27 /**
28  * Upmix delay samples from stereo to original channel layout.
29  */
30 #include "ac3dec.h"
31 #include "ac3dec.c"
32
33 static const AVOption options[] = {
34     { "drc_scale", "percentage of dynamic range compression to apply", OFFSET(drc_scale), AV_OPT_TYPE_FLOAT, {.dbl = 1.0}, 0.0, 6.0, PAR },
35
36 {"dmix_mode", "Preferred Stereo Downmix Mode", OFFSET(preferred_stereo_downmix), AV_OPT_TYPE_INT, {.i64 = -1 }, -1, 2, 0, "dmix_mode"},
37 {"ltrt_cmixlev",   "Lt/Rt Center Mix Level",   OFFSET(ltrt_center_mix_level),    AV_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, 0},
38 {"ltrt_surmixlev", "Lt/Rt Surround Mix Level", OFFSET(ltrt_surround_mix_level),  AV_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, 0},
39 {"loro_cmixlev",   "Lo/Ro Center Mix Level",   OFFSET(loro_center_mix_level),    AV_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, 0},
40 {"loro_surmixlev", "Lo/Ro Surround Mix Level", OFFSET(loro_surround_mix_level),  AV_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, 0},
41
42     { NULL},
43 };
44
45 static const AVClass ac3_decoder_class = {
46     .class_name = "AC3 decoder",
47     .item_name  = av_default_item_name,
48     .option     = options,
49     .version    = LIBAVUTIL_VERSION_INT,
50 };
51
52 AVCodec ff_ac3_decoder = {
53     .name           = "ac3",
54     .type           = AVMEDIA_TYPE_AUDIO,
55     .id             = AV_CODEC_ID_AC3,
56     .priv_data_size = sizeof (AC3DecodeContext),
57     .init           = ac3_decode_init,
58     .close          = ac3_decode_end,
59     .decode         = ac3_decode_frame,
60     .capabilities   = CODEC_CAP_DR1,
61     .long_name      = NULL_IF_CONFIG_SMALL("ATSC A/52A (AC-3)"),
62     .sample_fmts    = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
63                                                       AV_SAMPLE_FMT_NONE },
64     .priv_class     = &ac3_decoder_class,
65 };
66
67 #if CONFIG_EAC3_DECODER
68 static const AVClass eac3_decoder_class = {
69     .class_name = "E-AC3 decoder",
70     .item_name  = av_default_item_name,
71     .option     = options,
72     .version    = LIBAVUTIL_VERSION_INT,
73 };
74
75 AVCodec ff_eac3_decoder = {
76     .name           = "eac3",
77     .type           = AVMEDIA_TYPE_AUDIO,
78     .id             = AV_CODEC_ID_EAC3,
79     .priv_data_size = sizeof (AC3DecodeContext),
80     .init           = ac3_decode_init,
81     .close          = ac3_decode_end,
82     .decode         = ac3_decode_frame,
83     .capabilities   = CODEC_CAP_DR1,
84     .long_name      = NULL_IF_CONFIG_SMALL("ATSC A/52B (AC-3, E-AC-3)"),
85     .sample_fmts    = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
86                                                       AV_SAMPLE_FMT_NONE },
87     .priv_class     = &eac3_decoder_class,
88 };
89 #endif