]> git.sesse.net Git - vlc/blobdiff - src/audio_output/dec.c
avcodec: map LCL MSZH and ZLIB
[vlc] / src / audio_output / dec.c
index dd9563967091619eefa08a42d1aad2e541987386..2dfcff013b4e863acfaa2d868411507e9a1adba6 100644 (file)
@@ -52,7 +52,7 @@ int aout_DecNew( audio_output_t *p_aout,
         return -1;
     }
 
-    if( p_format->i_rate > 192000 )
+    if( p_format->i_rate > 352800 )
     {
         msg_Err( p_aout, "excessive audio sample frequency (%u)",
                  p_format->i_rate );
@@ -78,14 +78,16 @@ int aout_DecNew( audio_output_t *p_aout,
     atomic_store (&owner->restart, 0);
     owner->input_format = *p_format;
     owner->mixer_format = owner->input_format;
+    owner->request_vout = *p_request_vout;
 
     if (aout_OutputNew (p_aout, &owner->mixer_format))
         goto error;
     aout_volume_SetFormat (owner->volume, owner->mixer_format.i_format);
 
     /* Create the audio filtering "input" pipeline */
-    if (aout_FiltersNew (p_aout, p_format, &owner->mixer_format,
-                         p_request_vout))
+    owner->filters = aout_FiltersNew (p_aout, p_format, &owner->mixer_format,
+                                      &owner->request_vout);
+    if (owner->filters == NULL)
     {
         aout_OutputDelete (p_aout);
 error:
@@ -113,7 +115,7 @@ void aout_DecDelete (audio_output_t *aout)
     aout_OutputLock (aout);
     if (owner->mixer_format.i_format)
     {
-        aout_FiltersDelete (aout);
+        aout_FiltersDelete (aout, owner->filters);
         aout_OutputDelete (aout);
     }
     aout_volume_Delete (owner->volume);
@@ -128,10 +130,8 @@ static int aout_CheckReady (audio_output_t *aout)
     int restart = atomic_exchange (&owner->restart, 0);
     if (unlikely(restart))
     {
-        const aout_request_vout_t request_vout = owner->request_vout;
-
         if (owner->mixer_format.i_format)
-            aout_FiltersDelete (aout);
+            aout_FiltersDelete (aout, owner->filters);
 
         if (restart & AOUT_RESTART_OUTPUT)
         {   /* Reinitializes the output */
@@ -149,13 +149,20 @@ static int aout_CheckReady (audio_output_t *aout)
         owner->sync.end = VLC_TS_INVALID;
         owner->sync.resamp_type = AOUT_RESAMPLING_NONE;
 
-        if (owner->mixer_format.i_format
-         && aout_FiltersNew (aout, &owner->input_format, &owner->mixer_format,
-                             &request_vout))
+        if (owner->mixer_format.i_format)
         {
-            aout_OutputDelete (aout);
-            owner->mixer_format.i_format = 0;
+            owner->filters = aout_FiltersNew (aout, &owner->input_format,
+                                              &owner->mixer_format,
+                                              &owner->request_vout);
+            if (owner->filters == NULL)
+            {
+                aout_OutputDelete (aout);
+                owner->mixer_format.i_format = 0;
+            }
         }
+        /* TODO: This would be a good time to call clean up any video output
+         * left over by an audio visualization:
+        input_resource_TerminatVout(MAGIC HERE); */
     }
     return (owner->mixer_format.i_format) ? 0 : -1;
 }
@@ -175,40 +182,12 @@ void aout_RequestRestart (audio_output_t *aout, unsigned mode)
  * Buffer management
  */
 
-/*****************************************************************************
- * aout_DecNewBuffer : ask for a new empty buffer
- *****************************************************************************/
-block_t *aout_DecNewBuffer (audio_output_t *aout, size_t samples)
-{
-    /* NOTE: the caller is responsible for serializing input change */
-    aout_owner_t *owner = aout_owner (aout);
-
-    size_t length = samples * owner->input_format.i_bytes_per_frame
-                            / owner->input_format.i_frame_length;
-    block_t *block = block_Alloc( length );
-    if( likely(block != NULL) )
-    {
-        block->i_nb_samples = samples;
-        block->i_pts = block->i_length = 0;
-    }
-    return block;
-}
-
-/*****************************************************************************
- * aout_DecDeleteBuffer : destroy an undecoded buffer
- *****************************************************************************/
-void aout_DecDeleteBuffer (audio_output_t *aout, block_t *block)
-{
-    (void) aout;
-    block_Release (block);
-}
-
 static void aout_StopResampling (audio_output_t *aout)
 {
     aout_owner_t *owner = aout_owner (aout);
 
     owner->sync.resamp_type = AOUT_RESAMPLING_NONE;
-    aout_FiltersAdjustResampling (aout, 0);
+    aout_FiltersAdjustResampling (owner->filters, 0);
 }
 
 static void aout_DecSilence (audio_output_t *aout, mtime_t length, mtime_t pts)
@@ -342,7 +321,7 @@ static void aout_DecSynchronize (audio_output_t *aout, mtime_t dec_pts,
          * value, then it is time to switch back the resampling direction. */
         adj *= -1;
 
-    if (!aout_FiltersAdjustResampling (aout, adj))
+    if (!aout_FiltersAdjustResampling (owner->filters, adj))
     {   /* Everything is back to normal: stop resampling. */
         owner->sync.resamp_type = AOUT_RESAMPLING_NONE;
         msg_Dbg (aout, "resampling stopped (drift: %"PRId64" us)", drift);
@@ -384,7 +363,7 @@ int aout_DecPlay (audio_output_t *aout, block_t *block, int input_rate)
     if (block->i_flags & BLOCK_FLAG_DISCONTINUITY)
         owner->sync.discontinuity = true;
 
-    block = aout_FiltersPlay (aout, block, input_rate);
+    block = aout_FiltersPlay (owner->filters, block, input_rate);
     if (block == NULL)
         goto lost;