player: osd: fix zoom
[vlc.git] / modules / codec / spdif.c
blobedb3e899e478f3a40d04519e406abfcc2fcbab23
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 *****************************************************************************/
21 #ifdef HAVE_CONFIG_H
22 # include "config.h"
23 #endif
25 #include <vlc_common.h>
26 #include <vlc_plugin.h>
27 #include <vlc_aout.h>
28 #include <vlc_codec.h>
29 #include <vlc_modules.h>
31 static int OpenDecoder(vlc_object_t *);
33 vlc_module_begin()
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)
39 vlc_module_end()
41 static int
42 DecodeBlock(decoder_t *p_dec, block_t *p_block)
44 if (p_block != NULL)
45 decoder_QueueAudio( p_dec, p_block );
46 return VLCDEC_SUCCESS;
49 static int
50 OpenDecoder(vlc_object_t *p_this)
52 decoder_t *p_dec = (decoder_t*)p_this;
54 switch (p_dec->fmt_in.i_codec)
56 case VLC_CODEC_MPGA:
57 case VLC_CODEC_MP3:
58 /* Disabled by default */
59 if (!p_dec->obj.force)
60 return VLC_EGENERIC;
61 break;
62 case VLC_CODEC_A52:
63 case VLC_CODEC_EAC3:
64 case VLC_CODEC_MLP:
65 case VLC_CODEC_TRUEHD:
66 case VLC_CODEC_DTS:
67 case VLC_CODEC_SPDIFL:
68 case VLC_CODEC_SPDIFB:
69 /* Enabled by default */
70 break;
71 default:
72 return VLC_EGENERIC;
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))
82 return VLC_EGENERIC;
84 p_dec->pf_decode = DecodeBlock;
85 p_dec->pf_flush = NULL;
87 return VLC_SUCCESS;