]> git.sesse.net Git - vlc/commitdiff
* include/vlc_block_helper.h: small bugfix to block_FindStartcodeFromOffset().
authorGildas Bazin <gbazin@videolan.org>
Sun, 7 Dec 2003 12:11:13 +0000 (12:11 +0000)
committerGildas Bazin <gbazin@videolan.org>
Sun, 7 Dec 2003 12:11:13 +0000 (12:11 +0000)
* modules/packetizer/mpegvideo.c: get aspect ratio for MPEG2 video streams (still needs to be done for MPEG1).
* modules/codec/libmpeg2.c: use p_dec->fmt_in.video.i_aspect if available.
* modules/stream_out/transcode.c, modules/codec/ffmpeg/encoder.c: respect aspect ratio during transcoding.

include/vlc_block_helper.h
modules/codec/ffmpeg/encoder.c
modules/codec/libmpeg2.c
modules/packetizer/mpegvideo.c
modules/stream_out/transcode.c

index f22f7fcf4434184738502a443fa499568505064b..69e5b464004ef5d04c3e7e88224ba9efabd71211 100644 (file)
@@ -2,7 +2,7 @@
  * vlc_block_helper.h: Helper functions for data blocks management.
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: vlc_block_helper.h,v 1.6 2003/12/06 23:25:23 gbazin Exp $
+ * $Id: vlc_block_helper.h,v 1.7 2003/12/07 12:11:13 gbazin Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
@@ -501,6 +501,7 @@ static inline int block_FindStartcodeFromOffset(
         *pi_offset += i_offset;
     }
 
+    *pi_offset -= i_match;
     return VLC_EGENERIC;
 }
 
index e290803f8c909289e212774a2c671b4bb691e210..8e33375dda0cb93d6b6983154890dbae40971091 100644 (file)
@@ -2,7 +2,7 @@
  * encoder.c: video and audio encoder using the ffmpeg library
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: encoder.c,v 1.18 2003/12/04 23:15:01 gbazin Exp $
+ * $Id: encoder.c,v 1.19 2003/12/07 12:11:13 gbazin Exp $
  *
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *          Gildas Bazin <gbazin@netcourrier.com>
@@ -183,8 +183,9 @@ int E_(OpenEncoder)( vlc_object_t *p_this )
 
 #if LIBAVCODEC_BUILD >= 4687
         p_context->sample_aspect_ratio =
-            av_d2q( p_enc->fmt_in.video.i_aspect * p_context->height /
-                    p_context->width / VOUT_ASPECT_FACTOR, 255 );
+            (AVRational){ p_enc->fmt_in.video.i_aspect *
+                          (int64_t)p_context->height / p_context->width,
+                          VOUT_ASPECT_FACTOR };
 #else
         p_context->aspect_ratio = ((float)p_enc->fmt_in.video.i_aspect) /
             VOUT_ASPECT_FACTOR;
index 8734f0abd915b3abab05d8c332e77287377ae743..be775ebf4edbaee699524747fbee4d31ddfd4a23 100755 (executable)
@@ -2,7 +2,7 @@
  * libmpeg2.c: mpeg2 video decoder module making use of libmpeg2.
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: libmpeg2.c,v 1.36 2003/12/05 14:58:03 gbazin Exp $
+ * $Id: libmpeg2.c,v 1.37 2003/12/07 12:11:13 gbazin Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *          Christophe Massiot <massiot@via.ecp.fr>
@@ -233,6 +233,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
             if( p_dec->fmt_in.video.i_aspect )
             {
                 p_sys->i_aspect = p_dec->fmt_in.video.i_aspect;
+                if( p_sys->i_aspect <= AR_221_1_PICTURE )
                 switch( p_sys->i_aspect )
                 {
                 case AR_3_4_PICTURE:
@@ -245,7 +246,6 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
                     p_sys->i_aspect = VOUT_ASPECT_FACTOR * 221 / 100;
                     break;
                 case AR_SQUARE_PICTURE:
-                default:
                     p_sys->i_aspect = VOUT_ASPECT_FACTOR *
                                    p_sys->p_info->sequence->width /
                                    p_sys->p_info->sequence->height;
index f612389773e6e664ae47bacdd855f9ab9f26f200..0999f96a6a79a87ee9e41dac89262c9e38d716af 100644 (file)
@@ -2,7 +2,7 @@
  * mpegvideo.c: parse and packetize an MPEG1/2 video stream
  *****************************************************************************
  * Copyright (C) 2001, 2002 VideoLAN
- * $Id: mpegvideo.c,v 1.24 2003/12/06 23:25:23 gbazin Exp $
+ * $Id: mpegvideo.c,v 1.25 2003/12/07 12:11:13 gbazin Exp $
  *
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *          Eric Petit <titer@videolan.org>
@@ -512,12 +512,10 @@ static block_t *ParseMPEGBlock( decoder_t *p_dec, block_t *p_frag )
                     p_frag->p_buffer[9]&0x80 ? VLC_TRUE : VLC_FALSE;
             }
 
-#if 0
             p_dec->fmt_out.video.i_aspect =
                 mpeg2_aspect[p_sys->i_aspect_ratio_info][0] *
                 VOUT_ASPECT_FACTOR /
                 mpeg2_aspect[p_sys->i_aspect_ratio_info][1];
-#endif
 
         }
         else if( i_type == 0x08 )
index 321e5d6b73f7d9b9031c3ef46de1d895319a0a0c..3a2b8fd7c49afde4c3cf1daa485ba4c7027c6a63 100644 (file)
@@ -2,7 +2,7 @@
  * transcode.c
  *****************************************************************************
  * Copyright (C) 2001, 2002 VideoLAN
- * $Id: transcode.c,v 1.59 2003/12/06 22:53:07 jpsaman Exp $
+ * $Id: transcode.c,v 1.60 2003/12/07 12:11:13 gbazin Exp $
  *
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *          Gildas Bazin <gbazin@netcourrier.com>
@@ -1057,7 +1057,13 @@ static int transcode_video_ffmpeg_new( sout_stream_t *p_stream,
         id->p_encoder->fmt_in.video.i_aspect = VOUT_ASPECT_FACTOR *
             id->ff_dec_c->aspect_ratio;
 #endif
+    }
 
+    /* Check whether a particular aspect ratio was requested */
+    if( id->f_src.video.i_aspect )
+    {
+        id->p_encoder->fmt_in.video.i_aspect = id->f_src.video.i_aspect;
+        id->f_dst.video.i_aspect = id->f_src.video.i_aspect;
     }
 
     id->p_encoder->fmt_out = id->p_encoder->fmt_in;