1 /*****************************************************************************
2 * spdif.c: S/PDIF pass-though decoder
3 *****************************************************************************
4 * Copyright (C) 2016 VLC authors and VideoLAN
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation; either version 2.1 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
19 *****************************************************************************/
25 #include <vlc_common.h>
26 #include <vlc_plugin.h>
28 #include <vlc_codec.h>
29 #include <vlc_modules.h>
31 static int OpenDecoder(vlc_object_t
*);
34 set_category(CAT_INPUT
)
35 set_subcategory(SUBCAT_INPUT_ACODEC
)
36 set_description(N_("S/PDIF pass-through decoder"))
37 set_capability("audio decoder", 120)
38 set_callbacks(OpenDecoder
, NULL
)
42 DecodeBlock(decoder_t
*p_dec
, block_t
*p_block
)
45 decoder_QueueAudio( p_dec
, p_block
);
46 return VLCDEC_SUCCESS
;
50 OpenDecoder(vlc_object_t
*p_this
)
52 decoder_t
*p_dec
= (decoder_t
*)p_this
;
54 switch (p_dec
->fmt_in
.i_codec
)
58 /* Disabled by default */
59 if (!p_dec
->obj
.force
)
65 case VLC_CODEC_TRUEHD
:
67 case VLC_CODEC_SPDIFL
:
68 case VLC_CODEC_SPDIFB
:
69 /* Enabled by default */
75 /* Set output properties */
76 p_dec
->fmt_out
.i_codec
= p_dec
->fmt_in
.i_codec
;
77 p_dec
->fmt_out
.audio
= p_dec
->fmt_in
.audio
;
78 p_dec
->fmt_out
.i_profile
= p_dec
->fmt_in
.i_profile
;
79 p_dec
->fmt_out
.audio
.i_format
= p_dec
->fmt_out
.i_codec
;
81 if (decoder_UpdateAudioFormat(p_dec
))
84 p_dec
->pf_decode
= DecodeBlock
;
85 p_dec
->pf_flush
= NULL
;