[vlc-devel] [PATCH 03/30] decoder: separate the vout creation from the format update in UpdateFormat
Steve Lhomme
robux4 at ycbcr.xyz
Wed Sep 25 15:30:52 CEST 2019
---
src/input/decoder.c | 52 ++++++++++++++++++++++++++++-----------------
1 file changed, 32 insertions(+), 20 deletions(-)
diff --git a/src/input/decoder.c b/src/input/decoder.c
index 5de8e8dae98..e312f0046d2 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -459,11 +459,10 @@ static void FixDisplayFormat(decoder_t *p_dec, video_format_t *fmt)
video_format_AdjustColorSpace( fmt );
}
-static int ModuleThread_UpdateVideoFormat( decoder_t *p_dec )
+static int CreateVoutIfNeeded(struct decoder_owner *p_owner)
{
- struct decoder_owner *p_owner = dec_get_owner( p_dec );
+ decoder_t *p_dec = &p_owner->dec;
bool need_vout = false;
- bool need_format_update = false;
if( p_owner->p_vout == NULL )
{
@@ -506,22 +505,6 @@ static int ModuleThread_UpdateVideoFormat( decoder_t *p_dec )
need_vout = true;
}
- if ( memcmp( &p_dec->fmt_out.video.mastering,
- &p_owner->fmt.video.mastering,
- sizeof(p_owner->fmt.video.mastering)) )
- {
- msg_Dbg(p_dec, "vout update: mastering data");
- need_format_update = true;
- }
- if ( p_dec->fmt_out.video.lighting.MaxCLL !=
- p_owner->fmt.video.lighting.MaxCLL ||
- p_dec->fmt_out.video.lighting.MaxFALL !=
- p_owner->fmt.video.lighting.MaxFALL )
- {
- msg_Dbg(p_dec, "vout update: lighting data");
- need_format_update = true;
- }
-
if( need_vout )
{
vout_thread_t *p_vout;
@@ -591,8 +574,37 @@ static int ModuleThread_UpdateVideoFormat( decoder_t *p_dec )
vlc_fifo_Lock( p_owner->p_fifo );
p_owner->reset_out_state = true;
vlc_fifo_Unlock( p_owner->p_fifo );
+
+ return 1; // new vout was created
}
- else
+ return 0; // vout unchanged
+}
+
+static int ModuleThread_UpdateVideoFormat( decoder_t *p_dec )
+{
+ struct decoder_owner *p_owner = dec_get_owner( p_dec );
+
+ int created_vout = CreateVoutIfNeeded(p_owner);
+ if (created_vout != 0)
+ return created_vout; // error or new vout was created
+
+ bool need_format_update = false;
+ if ( memcmp( &p_dec->fmt_out.video.mastering,
+ &p_owner->fmt.video.mastering,
+ sizeof(p_owner->fmt.video.mastering)) )
+ {
+ msg_Dbg(p_dec, "vout update: mastering data");
+ need_format_update = true;
+ }
+ if ( p_dec->fmt_out.video.lighting.MaxCLL !=
+ p_owner->fmt.video.lighting.MaxCLL ||
+ p_dec->fmt_out.video.lighting.MaxFALL !=
+ p_owner->fmt.video.lighting.MaxFALL )
+ {
+ msg_Dbg(p_dec, "vout update: lighting data");
+ need_format_update = true;
+ }
+
if ( need_format_update )
{
/* the format has changed but we don't need a new vout */
--
2.17.1
More information about the vlc-devel
mailing list