[vlc-devel] [PATCH 17/32] decoder: allow multiple calls to HoldDecoderDevice before calling UpdateFormat
Steve Lhomme
robux4 at ycbcr.xyz
Thu Sep 26 16:00:08 CEST 2019
This is how the VA's will be probed when multiple outputs are possible.
---
src/input/decoder.c | 29 +++++++++++++++++++++--------
1 file changed, 21 insertions(+), 8 deletions(-)
diff --git a/src/input/decoder.c b/src/input/decoder.c
index 049c6ed8c5b..9be761aa363 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -460,17 +460,19 @@ static void FixDisplayFormat(decoder_t *p_dec, video_format_t *fmt)
video_format_AdjustColorSpace( fmt );
}
+static int CreateVoutIfNeeded(struct decoder_owner *, vout_thread_t **, vlc_decoder_device **);
+
+
static int ModuleThread_UpdateVideoFormat( decoder_t *p_dec )
{
struct decoder_owner *p_owner = dec_get_owner( p_dec );
- vlc_mutex_lock( &p_owner->lock );
-
- vout_thread_t *p_vout = p_owner->p_vout;
- vlc_mutex_unlock( &p_owner->lock );
+ vout_thread_t *p_vout = NULL;
+ int created_vout = CreateVoutIfNeeded(p_owner, &p_vout, NULL);
+ if (created_vout == -1)
+ return -1; // error
- if (!p_vout)
- return -1;
+ // configure the new vout
video_format_t fmt;
FixDisplayFormat( p_dec, &fmt );
@@ -504,7 +506,7 @@ static int ModuleThread_UpdateVideoFormat( decoder_t *p_dec )
return input_resource_GetDisplay( p_owner->p_resource, p_owner->p_dec_dev, &cfg);
}
-static int CreateVoutIfNeeded(struct decoder_owner *p_owner, vlc_decoder_device **pp_dec_dev)
+static int CreateVoutIfNeeded(struct decoder_owner *p_owner, vout_thread_t **pp_vout, vlc_decoder_device **pp_dec_dev)
{
decoder_t *p_dec = &p_owner->dec;
bool need_vout = false;
@@ -551,7 +553,15 @@ static int CreateVoutIfNeeded(struct decoder_owner *p_owner, vlc_decoder_device
}
if( !need_vout )
+ {
+ if (pp_vout)
+ {
+ vlc_mutex_lock( &p_owner->lock );
+ *pp_vout = p_owner->p_vout;
+ vlc_mutex_unlock( &p_owner->lock );
+ }
return 0; // vout unchanged
+ }
if( !p_dec->fmt_out.video.i_width ||
!p_dec->fmt_out.video.i_height ||
@@ -582,6 +592,9 @@ static int CreateVoutIfNeeded(struct decoder_owner *p_owner, vlc_decoder_device
if (p_vout)
decoder_Notify(p_owner, on_vout_added, p_vout, order);
+ if (pp_vout)
+ *pp_vout = p_vout;
+
vlc_mutex_lock( &p_owner->lock );
p_owner->p_vout = p_vout;
if ( pp_dec_dev )
@@ -617,7 +630,7 @@ static int ModuleThread_HoldDecoderDevice( decoder_t *p_dec, vlc_decoder_device
{
struct decoder_owner *p_owner = dec_get_owner( p_dec );
- int created_vout = CreateVoutIfNeeded(p_owner, pp_dec_dev);
+ int created_vout = CreateVoutIfNeeded(p_owner, NULL, pp_dec_dev);
if (created_vout != 0)
return created_vout == -1 ? -1 : 0; // error or new vout was created with a decoder device
--
2.17.1
More information about the vlc-devel
mailing list