<html><head></head><body>Maybe keep the not common code in not common functions? Otherwise LGTM<br><br><div class="gmail_quote">Le 8 juin 2018 08:42:49 GMT+03:00, Zhao Zhili <quinkblack@foxmail.com> a écrit :<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail">---<br> modules/codec/vorbis.c | 42 +++++++++++++++++++-----------------------<br> 1 file changed, 19 insertions(+), 23 deletions(-)<br><br>diff --git a/modules/codec/vorbis.c b/modules/codec/vorbis.c<br>index a1577d6..7939005 100644<br>--- a/modules/codec/vorbis.c<br>+++ b/modules/codec/vorbis.c<br>@@ -227,10 +227,7 @@ static const char *const ppsz_enc_options[] = {<br> };<br> #endif<br> <br>-/*****************************************************************************<br>- * OpenDecoder: probe the decoder and return score<br>- *****************************************************************************/<br>-static int OpenDecoder( vlc_object_t *p_this )<br>+static int OpenCommon( vlc_object_t *p_this, bool b_packetizer )<br> {<br> decoder_t *p_dec = (decoder_t*)p_this;<br> decoder_sys_t *p_sys;<br>@@ -246,42 +243,41 @@ static int OpenDecoder( vlc_object_t *p_this )<br> /* Misc init */<br> date_Set( &p_sys->end_date, VLC_TS_INVALID );<br> p_sys->i_last_block_size = 0;<br>- p_sys->b_packetizer = false;<br>+ p_sys->b_packetizer = b_packetizer;<br> p_sys->b_has_headers = false;<br> <br> /* Take care of vorbis init */<br> vorbis_info_init( &p_sys->vi );<br> vorbis_comment_init( &p_sys->vc );<br> <br>- /* Set output properties */<br>+ if( b_packetizer )<br>+ {<br>+ p_dec->fmt_out.i_codec = VLC_CODEC_VORBIS;<br>+ p_dec->pf_packetize = Packetize;<br>+ }<br>+ else<br>+ {<br> #ifdef MODULE_NAME_IS_tremor<br>- p_dec->fmt_out.i_codec = VLC_CODEC_S32N;<br>+ p_dec->fmt_out.i_codec = VLC_CODEC_S32N;<br> #else<br>- p_dec->fmt_out.i_codec = VLC_CODEC_FL32;<br>+ p_dec->fmt_out.i_codec = VLC_CODEC_FL32;<br> #endif<br>+ p_dec->pf_decode = DecodeAudio;<br>+ }<br> <br>- /* Set callbacks */<br>- p_dec->pf_decode = DecodeAudio;<br>- p_dec->pf_packetize = Packetize;<br> p_dec->pf_flush = Flush;<br> <br> return VLC_SUCCESS;<br> }<br> <br>-static int OpenPacketizer( vlc_object_t *p_this )<br>+static int OpenDecoder( vlc_object_t *p_this )<br> {<br>- decoder_t *p_dec = (decoder_t*)p_this;<br>- decoder_sys_t *p_sys = p_dec->p_sys;<br>-<br>- int i_ret = OpenDecoder( p_this );<br>-<br>- if( i_ret == VLC_SUCCESS )<br>- {<br>- p_sys->b_packetizer = true;<br>- p_dec->fmt_out.i_codec = VLC_CODEC_VORBIS;<br>- }<br>+ return OpenCommon( p_this, false );<br>+}<br> <br>- return i_ret;<br>+static int OpenPacketizer( vlc_object_t *p_this )<br>+{<br>+ return OpenCommon( p_this, true );<br> }<br> <br> /****************************************************************************</pre></blockquote></div><br>
-- <br>
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.</body></html>