[vlc-devel] [PATCH 1/1] vout: add I420 as middle-man if filters chain fails
Rémi Denis-Courmont
remi at remlab.net
Wed May 24 16:15:04 CEST 2017
On May 24, 2017 3:58:41 PM GMT+03:00, Thomas Guillem <thomas at gllm.fr> wrote:
>Refs #18078 #14037
>Fixes #13066 #16466
>---
>src/video_output/video_output.c | 34 +++++++++++++++++++++++++++++++++-
> 1 file changed, 33 insertions(+), 1 deletion(-)
>
>diff --git a/src/video_output/video_output.c
>b/src/video_output/video_output.c
>index 730b902b24..1d55ef2791 100644
>--- a/src/video_output/video_output.c
>+++ b/src/video_output/video_output.c
>@@ -695,6 +695,37 @@ typedef struct {
> config_chain_t *cfg;
> } vout_filter_t;
>
>+static int ThreadFilterInsertMiddleMan(vout_thread_t *vout,
>filter_chain_t *chain,
>+ const char *name,
>config_chain_t *cfg)
>+{
>+ /* This function is called when a filter insertion failed. This
>function
>+ * will try to append a converter to convert from video.i_chroma
>to I420.
>+ * This chroma is used as middle-man since it's the most used by
>VLC
>+ * filters. */
>+
>+ const es_format_t *fmt_in = filter_chain_GetFmtOut(chain);
>+ if (fmt_in->video.i_chroma == VLC_CODEC_I420)
>+ return VLC_EGENERIC;
>+
>+ vlc_fourcc_t i_orig_chroma = fmt_in->video.i_chroma;
>+ es_format_t fmt_middleman = *fmt_in;
>+ fmt_middleman.video.i_chroma = VLC_CODEC_I420;
>+ if (filter_chain_AppendConverter(chain, fmt_in, &fmt_middleman) !=
>0)
>+ {
>+ msg_Err(vout, "Failed to convert from '%4.4s' to '%4.4s'",
>+ (const char *) &i_orig_chroma,
>+ (const char *) &fmt_middleman.video.i_chroma);
>+ return VLC_EGENERIC;
>+ }
>+ if (!filter_chain_AppendFilter(chain, name, cfg, NULL, NULL))
>+ return VLC_EGENERIC;
>+
>+ msg_Info(vout, "adding '%4.4s' -> '%4.4s' derive converter needed
>by '%s'"
>+ " filter", (const char *) &i_orig_chroma,
>+ (const char *) &fmt_middleman.video.i_chroma, name);
>+ return VLC_SUCCESS;
>+}
>+
> static void ThreadChangeFilters(vout_thread_t *vout,
> const video_format_t *source,
> const char *filters,
>@@ -770,7 +801,8 @@ static void ThreadChangeFilters(vout_thread_t
>*vout,
> for (size_t i = 0; i < vlc_array_count(array); i++) {
> vout_filter_t *e = vlc_array_item_at_index(array, i);
>msg_Dbg(vout, "Adding '%s' as %s", e->name, a == 0 ? "static" :
>"interactive");
>- if (!filter_chain_AppendFilter(chain, e->name, e->cfg,
>NULL, NULL)) {
>+ if (!filter_chain_AppendFilter(chain, e->name, e->cfg,
>NULL, NULL)
>+ && ThreadFilterInsertMiddleMan(vout, chain, e->name,
>e->cfg)) {
> msg_Err(vout, "Failed to add filter '%s'", e->name);
> config_ChainDestroy(e->cfg);
> }
>--
>2.11.0
>
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel
This just duplicates the functionality already found in the chain converter. Nack.
--
Rémi Denis-Courmont
More information about the vlc-devel
mailing list