[vlc-devel] [PATCH 1/3] chroma: chain: handle unknown chroma
Thomas Guillem
thomas at gllm.fr
Mon Jun 5 16:22:04 CEST 2017
If the filter output chroma is not set, this module can be used to find the
best chroma available (via the pi_allowed_chromas list).
---
modules/video_chroma/chain.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/modules/video_chroma/chain.c b/modules/video_chroma/chain.c
index 3cd4e9f544..28e855c294 100644
--- a/modules/video_chroma/chain.c
+++ b/modules/video_chroma/chain.c
@@ -262,6 +262,33 @@ static int BuildChromaChain( filter_t *p_filter )
i_chroma == p_filter->fmt_out.i_codec )
continue;
+ if( p_filter->fmt_out.video.i_chroma == 0 )
+ {
+ /* If the output chroma is not set, use an allowed and working
+ * chroma as the new output chroma. */
+
+ if( !p_filter->b_allow_fmt_out_change )
+ break;
+
+ fmt_mid = p_filter->fmt_out;
+ fmt_mid.video.i_chroma = fmt_mid.i_codec = i_chroma;
+ fmt_mid.video.i_rmask = 0;
+ fmt_mid.video.i_gmask = 0;
+ fmt_mid.video.i_bmask = 0;
+ video_format_FixRgb( &fmt_mid.video );
+
+ filter_chain_Reset( p_filter->p_sys->p_chain, &p_filter->fmt_in,
+ &fmt_mid );
+ if( filter_chain_AppendConverter( p_filter->p_sys->p_chain,
+ NULL, NULL ) )
+ continue;
+
+ i_ret = VLC_SUCCESS;
+ p_filter->fmt_out.i_codec = i_chroma;
+ p_filter->fmt_out.video = fmt_mid.video;
+ break;
+ }
+
msg_Dbg( p_filter, "Trying to use chroma %4.4s as middle man",
(char*)&i_chroma );
--
2.11.0
More information about the vlc-devel
mailing list