[vlc-commits] transcode/video: test video conversion

Thomas Guillem git at videolan.org
Fri Jan 19 12:01:45 CET 2018


vlc/vlc-3.0 | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Jan 18 18:48:30 2018 +0100| [372da44278c7cc726c0582152f6637670baf57bb] | committer: Jean-Baptiste Kempf

transcode/video: test video conversion

No need to encode if no conversion is possible.

(cherry picked from commit 893c3bb704e1b1ed0da99da65cbc6b69d3046c33)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/stream_out/transcode/video.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/modules/stream_out/transcode/video.c b/modules/stream_out/transcode/video.c
index 60476dec45..ced0c2fe81 100644
--- a/modules/stream_out/transcode/video.c
+++ b/modules/stream_out/transcode/video.c
@@ -369,8 +369,8 @@ static void transcode_video_filter_init( sout_stream_t *p_stream,
 }
 
 /* Take care of the scaling and chroma conversions. */
-static void conversion_video_filter_append( sout_stream_id_sys_t *id,
-                                            picture_t *p_pic )
+static int conversion_video_filter_append( sout_stream_id_sys_t *id,
+                                           picture_t *p_pic )
 {
     const video_format_t *p_vid_out = video_output_format( id, p_pic );
 
@@ -381,9 +381,10 @@ static void conversion_video_filter_append( sout_stream_id_sys_t *id,
         es_format_t fmt_out;
         es_format_Init( &fmt_out, VIDEO_ES, p_vid_out->i_chroma );
         fmt_out.video = *p_vid_out;
-        filter_chain_AppendConverter( id->p_uf_chain ? id->p_uf_chain : id->p_f_chain,
-                                      &fmt_out, &id->p_encoder->fmt_in );
+        return filter_chain_AppendConverter( id->p_uf_chain ? id->p_uf_chain : id->p_f_chain,
+                                             &fmt_out, &id->p_encoder->fmt_in );
     }
+    return VLC_SUCCESS;
 }
 
 static void transcode_video_framerate_init( sout_stream_t *p_stream,
@@ -803,7 +804,8 @@ int transcode_video_process( sout_stream_t *p_stream, sout_stream_id_sys_t *id,
 
             transcode_video_encoder_init( p_stream, id, p_pic );
             transcode_video_filter_init( p_stream, id );
-            conversion_video_filter_append( id, p_pic );
+            if( conversion_video_filter_append( id, p_pic ) != VLC_SUCCESS )
+                goto error;
             memcpy( &id->fmt_input_video, &p_pic->format, sizeof(video_format_t));
         }
 
@@ -818,7 +820,8 @@ int transcode_video_process( sout_stream_t *p_stream, sout_stream_id_sys_t *id,
 
             transcode_video_encoder_init( p_stream, id, p_pic );
             transcode_video_filter_init( p_stream, id );
-            conversion_video_filter_append( id, p_pic );
+            if( conversion_video_filter_append( id, p_pic ) != VLC_SUCCESS )
+                goto error;
             memcpy( &id->fmt_input_video, &p_pic->format, sizeof(video_format_t));
 
             if( transcode_video_encoder_open( p_stream, id ) != VLC_SUCCESS )



More information about the vlc-commits mailing list