[vlc-commits] codec: svcdsub: prepare to put pf_packetize and pf_decode into a union
Zhao Zhili
git at videolan.org
Tue Jun 19 11:26:32 CEST 2018
vlc | branch: master | Zhao Zhili <quinkblack at foxmail.com> | Fri Jun 8 17:47:09 2018 +0800| [6a20d09cd262a1c1140dd7266195255343547edd] | committer: Thomas Guillem
codec: svcdsub: prepare to put pf_packetize and pf_decode into a union
Signed-off-by: Thomas Guillem <thomas at gllm.fr>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6a20d09cd262a1c1140dd7266195255343547edd
---
modules/codec/svcdsub.c | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/modules/codec/svcdsub.c b/modules/codec/svcdsub.c
index f947ffef05..7ecfdee958 100644
--- a/modules/codec/svcdsub.c
+++ b/modules/codec/svcdsub.c
@@ -108,10 +108,7 @@ typedef struct
uint8_t p_palette[4][4]; /* Palette of colors used in subtitle */
} decoder_sys_t;
-/*****************************************************************************
- * DecoderOpen: open/initialize the svcdsub decoder.
- *****************************************************************************/
-static int DecoderOpen( vlc_object_t *p_this )
+static int OpenCommon( vlc_object_t *p_this, bool b_packetizer )
{
decoder_t *p_dec = (decoder_t*)p_this;
decoder_sys_t *p_sys;
@@ -131,20 +128,28 @@ static int DecoderOpen( vlc_object_t *p_this )
p_dec->fmt_out.i_codec = VLC_CODEC_OGT;
- p_dec->pf_decode = Decode;
- p_dec->pf_packetize = Packetize;
+ if( b_packetizer )
+ p_dec->pf_packetize = Packetize;
+ else
+ p_dec->pf_decode = Decode;
return VLC_SUCCESS;
}
/*****************************************************************************
+ * DecoderOpen: open/initialize the svcdsub decoder.
+ *****************************************************************************/
+static int DecoderOpen( vlc_object_t *p_this )
+{
+ return OpenCommon( p_this, false );
+}
+
+/*****************************************************************************
* PacketizerOpen: open/initialize the svcdsub packetizer.
*****************************************************************************/
static int PacketizerOpen( vlc_object_t *p_this )
{
- if( DecoderOpen( p_this ) != VLC_SUCCESS ) return VLC_EGENERIC;
-
- return VLC_SUCCESS;
+ return OpenCommon( p_this, true );
}
/*****************************************************************************
More information about the vlc-commits
mailing list