[vlc-devel] [PATCH V2 4/8] aout: move profile handling to aout_DecNew

Thomas Guillem thomas at gllm.fr
Mon Oct 7 15:46:22 CEST 2019


The DTS hack will be removed in next commits.
---
 src/audio_output/aout_internal.h | 2 +-
 src/audio_output/dec.c           | 9 ++++++++-
 src/input/decoder.c              | 8 ++------
 3 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/src/audio_output/aout_internal.h b/src/audio_output/aout_internal.h
index 95a33af6f0..adb242eef6 100644
--- a/src/audio_output/aout_internal.h
+++ b/src/audio_output/aout_internal.h
@@ -133,7 +133,7 @@ void aout_FormatsPrint(vlc_object_t *, const char *,
 #define AOUT_DEC_CHANGED 1
 #define AOUT_DEC_FAILED VLC_EGENERIC
 
-int aout_DecNew(audio_output_t *, const audio_sample_format_t *,
+int aout_DecNew(audio_output_t *, const audio_sample_format_t *, int profile,
                 struct vlc_clock_t *clock, const audio_replay_gain_t *);
 void aout_DecDelete(audio_output_t *);
 int aout_DecPlay(audio_output_t *aout, block_t *block);
diff --git a/src/audio_output/dec.c b/src/audio_output/dec.c
index e67321c2e7..07161bba2f 100644
--- a/src/audio_output/dec.c
+++ b/src/audio_output/dec.c
@@ -54,7 +54,8 @@ static void aout_Drain(audio_output_t *aout)
  * Creates an audio output
  */
 int aout_DecNew(audio_output_t *p_aout, const audio_sample_format_t *p_format,
-                vlc_clock_t *clock, const audio_replay_gain_t *p_replay_gain)
+                int profile, vlc_clock_t *clock,
+                const audio_replay_gain_t *p_replay_gain)
 {
     assert(p_aout);
     assert(p_format);
@@ -92,6 +93,12 @@ int aout_DecNew(audio_output_t *p_aout, const audio_sample_format_t *p_format,
 
     atomic_store_explicit(&owner->restart, 0, memory_order_relaxed);
     owner->input_format = *p_format;
+
+    /* TODO: 3.0 HACK: we need to put i_profile inside audio_format_t for 4.0
+     * */
+    if( owner->input_format.i_format == VLC_CODEC_DTS )
+        var_SetBool( p_aout, "dtshd", profile > 0 );
+
     owner->mixer_format = owner->input_format;
     owner->sync.clock = clock;
 
diff --git a/src/input/decoder.c b/src/input/decoder.c
index ffd0467680..9019f5e210 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -361,12 +361,8 @@ static int ModuleThread_UpdateAudioFormat( decoder_t *p_dec )
         p_aout = input_resource_GetAout( p_owner->p_resource );
         if( p_aout )
         {
-            /* TODO: 3.0 HACK: we need to put i_profile inside audio_format_t
-             * for 4.0 */
-            if( p_dec->fmt_out.i_codec == VLC_CODEC_DTS )
-                var_SetBool( p_aout, "dtshd", p_dec->fmt_out.i_profile > 0 );
-
-            if( aout_DecNew( p_aout, &format, p_owner->p_clock,
+            if( aout_DecNew( p_aout, &format, p_dec->fmt_out.i_profile,
+                             p_owner->p_clock,
                              &p_dec->fmt_out.audio_replay_gain ) )
             {
                 input_resource_PutAout( p_owner->p_resource, p_aout );
-- 
2.20.1



More information about the vlc-devel mailing list