]> git.sesse.net Git - vlc/blobdiff - src/input/decoder.c
* use the latest ffmpeg-cvs again. Included dionoea's build fix (rev. [12607]). Thank...
[vlc] / src / input / decoder.c
index 576749454c284426aff60179251c2826df2a1dcb..43ecf076f5c3602be4bf2a49b371a8422f15731c 100644 (file)
@@ -537,6 +537,8 @@ static int DecoderDecode( decoder_t *p_dec, block_t *p_block )
                 p_dec->p_owner->sout.i_id = p_dec->fmt_in.i_id;
                 if( p_dec->fmt_in.psz_language )
                 {
+                    if( p_dec->p_owner->sout.psz_language )
+                        free( p_dec->p_owner->sout.psz_language );
                     p_dec->p_owner->sout.psz_language =
                         strdup( p_dec->fmt_in.psz_language );
                 }
@@ -547,7 +549,8 @@ static int DecoderDecode( decoder_t *p_dec, block_t *p_block )
 
                 if( p_dec->p_owner->p_sout_input == NULL )
                 {
-                    msg_Err( p_dec, "cannot create packetizer output" );
+                    msg_Err( p_dec, "cannot create packetizer output (%4.4s)",
+                             (char *)&p_dec->p_owner->sout.i_codec );
                     p_dec->b_error = VLC_TRUE;
 
                     while( p_sout_block )
@@ -850,10 +853,30 @@ static aout_buffer_t *aout_new_buffer( decoder_t *p_dec, int i_samples )
 
     if( p_sys->p_aout_input == NULL )
     {
+        audio_sample_format_t format;
+        int i_force_dolby = config_GetInt( p_dec, "force-dolby-surround" );
+
         p_dec->fmt_out.audio.i_format = p_dec->fmt_out.i_codec;
         p_sys->audio = p_dec->fmt_out.audio;
+
+        memcpy( &format, &p_sys->audio, sizeof( audio_sample_format_t ) );
+        if ( i_force_dolby && (format.i_original_channels&AOUT_CHAN_PHYSMASK)
+                                    == (AOUT_CHAN_LEFT|AOUT_CHAN_RIGHT) )
+        {
+            if ( i_force_dolby == 1 )
+            {
+                format.i_original_channels = format.i_original_channels |
+                                             AOUT_CHAN_DOLBYSTEREO;
+            }
+            else /* i_force_dolby == 2 */
+            {
+                format.i_original_channels = format.i_original_channels &
+                                             ~AOUT_CHAN_DOLBYSTEREO;
+            }
+        }
+
         p_sys->p_aout_input =
-            aout_DecNew( p_dec, &p_sys->p_aout, &p_sys->audio );
+            aout_DecNew( p_dec, &p_sys->p_aout, &format );
         if( p_sys->p_aout_input == NULL )
         {
             msg_Err( p_dec, "failed to create audio output" );
@@ -894,14 +917,30 @@ static picture_t *vout_new_buffer( decoder_t *p_dec )
             return NULL;
         }
 
+        if( !p_dec->fmt_out.video.i_visible_width ||
+            !p_dec->fmt_out.video.i_visible_height )
+        {
+            p_dec->fmt_out.video.i_visible_width =
+                p_dec->fmt_out.video.i_width;
+            p_dec->fmt_out.video.i_visible_height =
+                p_dec->fmt_out.video.i_height;
+        }
+
+        if( p_dec->fmt_out.video.i_visible_height == 1088 &&
+            var_CreateGetBool( p_dec, "hdtv-fix" ) )
+        {
+            p_dec->fmt_out.video.i_visible_height = 1080;
+            msg_Warn( p_dec, "Fixing broken HDTV stream (display_height=1088)");
+        }
+
         if( !p_dec->fmt_out.video.i_sar_num ||
             !p_dec->fmt_out.video.i_sar_den )
         {
-            p_dec->fmt_out.video.i_sar_num =
-              p_dec->fmt_out.video.i_aspect * p_dec->fmt_out.video.i_height;
+            p_dec->fmt_out.video.i_sar_num = p_dec->fmt_out.video.i_aspect * 
+              p_dec->fmt_out.video.i_visible_height;
 
             p_dec->fmt_out.video.i_sar_den = VOUT_ASPECT_FACTOR *
-              p_dec->fmt_out.video.i_width;
+              p_dec->fmt_out.video.i_visible_width;
         }
 
         vlc_ureduce( &p_dec->fmt_out.video.i_sar_num,
@@ -909,15 +948,6 @@ static picture_t *vout_new_buffer( decoder_t *p_dec )
                      p_dec->fmt_out.video.i_sar_num,
                      p_dec->fmt_out.video.i_sar_den, 0 );
 
-        if( !p_dec->fmt_out.video.i_visible_width ||
-            !p_dec->fmt_out.video.i_visible_height )
-        {
-            p_dec->fmt_out.video.i_visible_width =
-                p_dec->fmt_out.video.i_width;
-            p_dec->fmt_out.video.i_visible_height =
-                p_dec->fmt_out.video.i_height;
-        }
-
         p_dec->fmt_out.video.i_chroma = p_dec->fmt_out.i_codec;
         p_sys->video = p_dec->fmt_out.video;