]> git.sesse.net Git - vlc/blobdiff - modules/stream_out/transcode.c
* configure.ac: fix for wxWindows headers detection.
[vlc] / modules / stream_out / transcode.c
index c2099b9083b229d66a40c2b972b176aabd87928d..f5c115f772b073baa0e171ddffb438e0e373928a 100644 (file)
@@ -2,7 +2,7 @@
  * transcode.c
  *****************************************************************************
  * Copyright (C) 2001, 2002 VideoLAN
- * $Id: transcode.c,v 1.38 2003/10/09 11:48:41 gbazin Exp $
+ * $Id: transcode.c,v 1.43 2003/10/24 21:27:06 gbazin Exp $
  *
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *
@@ -1004,7 +1004,7 @@ static int transcode_audio_ffmpeg_process( sout_stream_t *p_stream,
                     p_out->i_size = header[i].bytes;
                     p_out->i_length = 0;
 
-                    p_out->i_dts = p_out->i_pts = 0;
+                    p_out->i_dts = p_out->i_pts = id->i_dts;
 
                     sout_BufferChain( out, p_out );
                 }
@@ -1223,7 +1223,7 @@ static int transcode_video_ffmpeg_new( sout_stream_t *p_stream,
 
 
     /* find encoder */
-    id->ff_enc = NULL;
+    id->ff_enc = id->ff_enc_c = NULL;
     i_ff_codec = get_ff_codec( id->f_dst.i_fourcc );
     if( i_ff_codec != 0 )
     {
@@ -1395,7 +1395,7 @@ static void transcode_video_ffmpeg_close ( sout_stream_t *p_stream, sout_stream_
     }
 
     free( id->ff_dec_c );
-    free( id->ff_enc_c );
+    if( id->ff_enc_c ) free( id->ff_enc_c );
     free( id->p_buffer );
 }
 
@@ -1496,6 +1496,8 @@ static int transcode_video_ffmpeg_process( sout_stream_t *p_stream,
                 sout_buffer_t *p_out;
                 p_out = sout_BufferNew( p_stream->p_sout, p_block->i_buffer );
                 memcpy( p_out->p_buffer, p_block->p_buffer, p_block->i_buffer);
+                p_out->i_dts = in->i_dts;
+                p_out->i_pts = in->i_dts;
                 sout_BufferChain( out, p_out );
             }
 
@@ -1600,7 +1602,6 @@ static int transcode_video_ffmpeg_process( sout_stream_t *p_stream,
         }
 
         /* convert size and crop */
-        if( !id->p_encoder )
         if( id->ff_dec_c->width  != id->f_dst.i_width ||
             id->ff_dec_c->height != id->f_dst.i_height ||
             p_sys->i_crop_top > 0 || p_sys->i_crop_bottom > 0 ||
@@ -1638,7 +1639,8 @@ static int transcode_video_ffmpeg_process( sout_stream_t *p_stream,
         }
 
         /* Set the pts of the frame being encoded (segfaults with mpeg4!)*/
-        if( id->f_dst.i_fourcc == VLC_FOURCC( 'm', 'p', 'g', 'v' ) )
+        if( id->p_encoder ||
+            id->f_dst.i_fourcc == VLC_FOURCC( 'm', 'p', 'g', 'v' ) )
             frame->pts = p_sys->i_output_pts;
         else
             frame->pts = 0;
@@ -1659,8 +1661,10 @@ static int transcode_video_ffmpeg_process( sout_stream_t *p_stream,
             int i_plane;
 
             vout_InitPicture( VLC_OBJECT(p_stream), &pic,
+                              id->p_encoder->format.video.i_chroma,
                               id->f_dst.i_width, id->f_dst.i_height,
-                              id->p_encoder->format.video.i_chroma );
+                              id->f_dst.i_width * VOUT_ASPECT_FACTOR /
+                              id->f_dst.i_height );
 
             for( i_plane = 0; i_plane < pic.i_planes; i_plane++ )
             {
@@ -1676,6 +1680,8 @@ static int transcode_video_ffmpeg_process( sout_stream_t *p_stream,
                 sout_buffer_t *p_out;
                 p_out = sout_BufferNew( p_stream->p_sout, p_block->i_buffer );
                 memcpy( p_out->p_buffer, p_block->p_buffer, p_block->i_buffer);
+                p_out->i_dts = p_block->i_dts;
+                p_out->i_pts = p_block->i_pts;
                 sout_BufferChain( out, p_out );
                 block_Release( p_block );
             }