FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ac3dec_float.c
Go to the documentation of this file.
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 "eac3dec.c"
32 #include "ac3dec.c"
33 
34 static const AVOption options[] = {
35  { "drc_scale", "percentage of dynamic range compression to apply", OFFSET(drc_scale), AV_OPT_TYPE_FLOAT, {.dbl = 1.0}, 0.0, 6.0, PAR },
36  { "heavy_compr", "heavy dynamic range compression enabled", OFFSET(heavy_compression), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 1, PAR },
37  { "target_level", "target level in -dBFS (0 not applied)", OFFSET(target_level), AV_OPT_TYPE_INT, {.i64 = 0 }, -31, 0, PAR },
38 
39 {"dmix_mode", "Preferred Stereo Downmix Mode", OFFSET(preferred_stereo_downmix), AV_OPT_TYPE_INT, {.i64 = -1 }, -1, 2, 0, "dmix_mode"},
40 {"ltrt_cmixlev", "Lt/Rt Center Mix Level", OFFSET(ltrt_center_mix_level), AV_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, 0},
41 {"ltrt_surmixlev", "Lt/Rt Surround Mix Level", OFFSET(ltrt_surround_mix_level), AV_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, 0},
42 {"loro_cmixlev", "Lo/Ro Center Mix Level", OFFSET(loro_center_mix_level), AV_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, 0},
43 {"loro_surmixlev", "Lo/Ro Surround Mix Level", OFFSET(loro_surround_mix_level), AV_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, 0},
44 
45  { NULL},
46 };
47 
48 static const AVClass ac3_decoder_class = {
49  .class_name = "AC3 decoder",
50  .item_name = av_default_item_name,
51  .option = options,
52  .version = LIBAVUTIL_VERSION_INT,
53 };
54 
56  .name = "ac3",
57  .type = AVMEDIA_TYPE_AUDIO,
58  .id = AV_CODEC_ID_AC3,
59  .priv_data_size = sizeof (AC3DecodeContext),
61  .close = ac3_decode_end,
63  .capabilities = CODEC_CAP_DR1,
64  .long_name = NULL_IF_CONFIG_SMALL("ATSC A/52A (AC-3)"),
65  .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
67  .priv_class = &ac3_decoder_class,
68 };
69 
70 #if CONFIG_EAC3_DECODER
71 static const AVClass eac3_decoder_class = {
72  .class_name = "E-AC3 decoder",
73  .item_name = av_default_item_name,
74  .option = options,
75  .version = LIBAVUTIL_VERSION_INT,
76 };
77 
78 AVCodec ff_eac3_decoder = {
79  .name = "eac3",
80  .type = AVMEDIA_TYPE_AUDIO,
81  .id = AV_CODEC_ID_EAC3,
82  .priv_data_size = sizeof (AC3DecodeContext),
84  .close = ac3_decode_end,
86  .capabilities = CODEC_CAP_DR1,
87  .long_name = NULL_IF_CONFIG_SMALL("ATSC A/52B (AC-3, E-AC-3)"),
88  .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
90  .priv_class = &eac3_decoder_class,
91 };
92 #endif
float, planar
Definition: samplefmt.h:70
#define NULL
Definition: coverity.c:32
AVCodec ff_ac3_decoder
Definition: ac3dec_float.c:55
AVOption.
Definition: opt.h:255
#define LIBAVUTIL_VERSION_INT
Definition: version.h:62
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
AVCodec.
Definition: avcodec.h:3181
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
Definition: log.h:72
static av_cold int ac3_decode_end(AVCodecContext *avctx)
Uninitialize the AC-3 decoder.
Definition: ac3dec.c:1631
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
Definition: avcodec.h:789
Common code between the AC-3 and E-AC-3 decoders.
static const AVOption options[]
Upmix delay samples from stereo to original channel layout.
Definition: ac3dec_float.c:34
av_default_item_name
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:175
const char * name
Name of the codec implementation.
Definition: avcodec.h:3188
static int ac3_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
Decode a single AC-3 frame.
Definition: ac3dec.c:1405
AVSampleFormat
Audio sample formats.
Definition: samplefmt.h:59
Describe the class of an AVClass context structure.
Definition: log.h:67
Definition: af_afade.c:45
static const AVClass ac3_decoder_class
Definition: ac3dec_float.c:48
#define OFFSET(x)
Definition: ffmpeg_opt.c:2874
static int decode(AVCodecContext *avctx, void *data, int *got_sub, AVPacket *avpkt)
Definition: ccaption_dec.c:522
static av_cold int ac3_decode_init(AVCodecContext *avctx)
AVCodec initialization.
Definition: ac3dec.c:181