Commit acbd501e authored by Gildas Bazin's avatar Gildas Bazin

* modules/stream_out/transcode.c: fixed memleak. Set aspect ratio info even for raw video input.
parent b6fde88e
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* transcode.c: transcoding stream output module * transcode.c: transcoding stream output module
***************************************************************************** *****************************************************************************
* Copyright (C) 2003-2004 VideoLAN * Copyright (C) 2003-2004 VideoLAN
* $Id: transcode.c,v 1.78 2004/02/20 19:21:25 massiot Exp $ * $Id: transcode.c,v 1.79 2004/02/21 23:50:52 gbazin Exp $
* *
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Gildas Bazin <gbazin@netcourrier.com> * Gildas Bazin <gbazin@netcourrier.com>
...@@ -1041,6 +1041,16 @@ static int transcode_video_ffmpeg_new( sout_stream_t *p_stream, ...@@ -1041,6 +1041,16 @@ static int transcode_video_ffmpeg_new( sout_stream_t *p_stream,
id->ff_dec_c->width = id->f_src.video.i_width; id->ff_dec_c->width = id->f_src.video.i_width;
id->ff_dec_c->height = id->f_src.video.i_height; id->ff_dec_c->height = id->f_src.video.i_height;
id->ff_dec_c->pix_fmt = get_ff_chroma( id->f_src.i_codec ); id->ff_dec_c->pix_fmt = get_ff_chroma( id->f_src.i_codec );
#if LIBAVCODEC_BUILD >= 4687
if( id->ff_dec_c->width )
id->ff_dec_c->sample_aspect_ratio =
av_d2q( id->f_src.video.i_aspect / (double)VOUT_ASPECT_FACTOR *
id->ff_dec_c->height / id->ff_dec_c->width, 255 );
#else
id->ff_dec_c->aspect_ratio =
id->f_src.video.i_aspect / (float)VOUT_ASPECT_FACTOR;
#endif
} }
else else
{ {
...@@ -1277,8 +1287,6 @@ static int transcode_video_ffmpeg_process( sout_stream_t *p_stream, ...@@ -1277,8 +1287,6 @@ static int transcode_video_ffmpeg_process( sout_stream_t *p_stream,
picture_t * p_pic; picture_t * p_pic;
int i_plane; int i_plane;
p_pic = malloc(sizeof(picture_t));
/* decode frame */ /* decode frame */
frame = id->p_ff_pic; frame = id->p_ff_pic;
p_sys->i_input_pts = in->i_pts; p_sys->i_input_pts = in->i_pts;
...@@ -1519,6 +1527,7 @@ static int transcode_video_ffmpeg_process( sout_stream_t *p_stream, ...@@ -1519,6 +1527,7 @@ static int transcode_video_ffmpeg_process( sout_stream_t *p_stream,
} }
/* Encoding */ /* Encoding */
p_pic = malloc(sizeof(picture_t));
vout_InitPicture( VLC_OBJECT(p_stream), p_pic, vout_InitPicture( VLC_OBJECT(p_stream), p_pic,
id->p_encoder->fmt_in.i_codec, id->p_encoder->fmt_in.i_codec,
id->f_dst.video.i_width, id->f_dst.video.i_height, id->f_dst.video.i_width, id->f_dst.video.i_height,
...@@ -1530,8 +1539,11 @@ static int transcode_video_ffmpeg_process( sout_stream_t *p_stream, ...@@ -1530,8 +1539,11 @@ static int transcode_video_ffmpeg_process( sout_stream_t *p_stream,
p_pic->p[i_plane].i_pitch = frame->linesize[i_plane]; p_pic->p[i_plane].i_pitch = frame->linesize[i_plane];
if ( p_sys->i_threads >= 1 ) if ( p_sys->i_threads >= 1 )
{ {
p_pic->p[i_plane].p_pixels = malloc(p_pic->p[i_plane].i_lines * p_pic->p[i_plane].i_pitch); p_pic->p[i_plane].p_pixels = malloc(p_pic->p[i_plane].i_lines *
p_stream->p_vlc->pf_memcpy(p_pic->p[i_plane].p_pixels, frame->data[i_plane], p_pic->p[i_plane].i_lines * p_pic->p[i_plane].i_pitch); p_pic->p[i_plane].i_pitch);
p_stream->p_vlc->pf_memcpy( p_pic->p[i_plane].p_pixels,
frame->data[i_plane], p_pic->p[i_plane].i_lines *
p_pic->p[i_plane].i_pitch );
} }
else else
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment