[vlc-commits] avcodec: fail if the specified encoder is not found

Thomas Guillem git at videolan.org
Thu Mar 29 14:04:07 CEST 2018


vlc/vlc-3.0 | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Mar 27 17:40:32 2018 +0200| [234c95094d31c311534fd2779f1a7a9bb8481303] | committer: Thomas Guillem

avcodec: fail if the specified encoder is not found

Instead of using the default avcodec encoder.

(cherry picked from commit 2d628e37d2e9d28038bc5904deb2fe3d6837e4a6)
Signed-off-by: Thomas Guillem <thomas at gllm.fr>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=234c95094d31c311534fd2779f1a7a9bb8481303
---

 modules/codec/avcodec/encoder.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c
index df8f663b86..e25d2ba0b3 100644
--- a/modules/codec/avcodec/encoder.c
+++ b/modules/codec/avcodec/encoder.c
@@ -344,12 +344,15 @@ int InitVideoEnc( vlc_object_t *p_this )
     {
         p_codec = avcodec_find_encoder_by_name( psz_encoder );
         if( !p_codec )
+        {
             msg_Err( p_this, "Encoder `%s' not found", psz_encoder );
+            return VLC_EGENERIC;
+        }
         else if( p_codec->id != i_codec_id )
         {
             msg_Err( p_this, "Encoder `%s' can't handle %4.4s",
                     psz_encoder, (char*)&p_enc->fmt_out.i_codec );
-            p_codec = NULL;
+            return VLC_EGENERIC;
         }
     }
     free( psz_encoder );



More information about the vlc-commits mailing list