Commit b3dc4442 authored by Gildas Bazin's avatar Gildas Bazin

* src/playlist/*: fixed memory leaks.
* modules/codec/rawvideo.c: fixed dts/pts problem and added support for fourcc IYUV.
* modules/stream_out/transcode.c: added support for fourcc IYUV.
parent f335a2a0
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* rawvideo.c: Pseudo video decoder/packetizer for raw video data * rawvideo.c: Pseudo video decoder/packetizer for raw video data
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN * Copyright (C) 2001, 2002 VideoLAN
* $Id: rawvideo.c,v 1.10 2003/12/22 02:24:51 sam Exp $ * $Id: rawvideo.c,v 1.11 2004/01/07 19:20:29 gbazin Exp $
* *
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
...@@ -178,7 +178,7 @@ static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) ...@@ -178,7 +178,7 @@ static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
p_block = *pp_block; p_block = *pp_block;
if( !p_sys->i_pts && !p_block->i_pts ) if( !p_sys->i_pts && !p_block->i_pts && !p_block->i_dts )
{ {
/* We've just started the stream, wait for the first PTS. */ /* We've just started the stream, wait for the first PTS. */
block_Release( p_block ); block_Release( p_block );
...@@ -186,9 +186,10 @@ static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) ...@@ -186,9 +186,10 @@ static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
} }
/* Date management */ /* Date management */
if( p_block->i_pts > 0 && p_block->i_pts != p_sys->i_pts ) if( p_block->i_pts > 0 || p_block->i_dts > 0 )
{ {
p_sys->i_pts = p_block->i_pts; if( p_block->i_pts > 0 ) p_sys->i_pts = p_block->i_pts;
else if( p_block->i_dts > 0 ) p_sys->i_pts = p_block->i_dts;
} }
if( p_block->i_buffer < p_sys->i_raw_size ) if( p_block->i_buffer < p_sys->i_raw_size )
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* transcode.c * transcode.c
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN * Copyright (C) 2001, 2002 VideoLAN
* $Id: transcode.c,v 1.65 2004/01/03 00:39:07 gbazin Exp $ * $Id: transcode.c,v 1.66 2004/01/07 19:20:30 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>
...@@ -564,6 +564,7 @@ static struct ...@@ -564,6 +564,7 @@ static struct
{ VLC_FOURCC( 'R', 'V', '3', '2' ), CODEC_ID_RAWVIDEO }, { VLC_FOURCC( 'R', 'V', '3', '2' ), CODEC_ID_RAWVIDEO },
{ VLC_FOURCC( 'Y', 'U', 'Y', '2' ), CODEC_ID_RAWVIDEO }, { VLC_FOURCC( 'Y', 'U', 'Y', '2' ), CODEC_ID_RAWVIDEO },
{ VLC_FOURCC( 'Y', 'V', '1', '2' ), CODEC_ID_RAWVIDEO }, { VLC_FOURCC( 'Y', 'V', '1', '2' ), CODEC_ID_RAWVIDEO },
{ VLC_FOURCC( 'I', 'Y', 'U', 'V' ), CODEC_ID_RAWVIDEO },
{ VLC_FOURCC( 0, 0, 0, 0 ), 0 } { VLC_FOURCC( 0, 0, 0, 0 ), 0 }
}; };
...@@ -588,6 +589,7 @@ static inline int get_ff_chroma( vlc_fourcc_t i_chroma ) ...@@ -588,6 +589,7 @@ static inline int get_ff_chroma( vlc_fourcc_t i_chroma )
switch( i_chroma ) switch( i_chroma )
{ {
case VLC_FOURCC( 'Y', 'V', '1', '2' ): case VLC_FOURCC( 'Y', 'V', '1', '2' ):
case VLC_FOURCC( 'I', 'Y', 'U', 'V' ):
case VLC_FOURCC( 'I', '4', '2', '0' ): case VLC_FOURCC( 'I', '4', '2', '0' ):
return PIX_FMT_YUV420P; return PIX_FMT_YUV420P;
case VLC_FOURCC( 'I', '4', '2', '2' ): case VLC_FOURCC( 'I', '4', '2', '2' ):
...@@ -967,6 +969,7 @@ static int transcode_video_ffmpeg_new( sout_stream_t *p_stream, ...@@ -967,6 +969,7 @@ static int transcode_video_ffmpeg_new( sout_stream_t *p_stream,
id->f_src.i_codec == VLC_FOURCC( 'I', '4', '4', '4' ) || id->f_src.i_codec == VLC_FOURCC( 'I', '4', '4', '4' ) ||
id->f_src.i_codec == VLC_FOURCC( 'Y', 'V', '1', '2' ) || id->f_src.i_codec == VLC_FOURCC( 'Y', 'V', '1', '2' ) ||
id->f_src.i_codec == VLC_FOURCC( 'Y', 'U', 'Y', '2' ) || id->f_src.i_codec == VLC_FOURCC( 'Y', 'U', 'Y', '2' ) ||
id->f_src.i_codec == VLC_FOURCC( 'I', 'Y', 'U', 'V' ) ||
id->f_src.i_codec == VLC_FOURCC( 'R', 'V', '1', '5' ) || id->f_src.i_codec == VLC_FOURCC( 'R', 'V', '1', '5' ) ||
id->f_src.i_codec == VLC_FOURCC( 'R', 'V', '1', '6' ) || id->f_src.i_codec == VLC_FOURCC( 'R', 'V', '1', '6' ) ||
id->f_src.i_codec == VLC_FOURCC( 'R', 'V', '2', '4' ) || id->f_src.i_codec == VLC_FOURCC( 'R', 'V', '2', '4' ) ||
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* info.c : Playlist info management * info.c : Playlist info management
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2004 VideoLAN * Copyright (C) 1999-2004 VideoLAN
* $Id: info.c,v 1.2 2004/01/06 08:50:20 zorglub Exp $ * $Id: info.c,v 1.3 2004/01/07 19:20:30 gbazin Exp $
* *
* Authors: Clment Stenac <zorglub@videolan.org> * Authors: Clment Stenac <zorglub@videolan.org>
* *
...@@ -241,7 +241,7 @@ int playlist_AddInfo( playlist_t *p_playlist, int i_item, ...@@ -241,7 +241,7 @@ int playlist_AddInfo( playlist_t *p_playlist, int i_item,
const char * psz_format, ...) const char * psz_format, ...)
{ {
va_list args; va_list args;
int i; int i, i_ret;
int i_new = VLC_TRUE; int i_new = VLC_TRUE;
playlist_item_t *p_item; playlist_item_t *p_item;
char *psz_value; char *psz_value;
...@@ -272,8 +272,7 @@ int playlist_AddInfo( playlist_t *p_playlist, int i_item, ...@@ -272,8 +272,7 @@ int playlist_AddInfo( playlist_t *p_playlist, int i_item,
#if defined(HAVE_VASPRINTF) && !defined(SYS_DARWIN) && !defined(SYS_BEOS) #if defined(HAVE_VASPRINTF) && !defined(SYS_DARWIN) && !defined(SYS_BEOS)
vasprintf( &psz_value, psz_format, args ); vasprintf( &psz_value, psz_format, args );
#else #else
psz_value = psz_value = (char*)malloc( strlen(psz_format) + INTF_MAX_MSG_SIZE );
(char*) malloc( strlen(psz_format) + INTF_MAX_MSG_SIZE );
if( psz_value == NULL ) if( psz_value == NULL )
{ {
msg_Err( p_playlist, "out of memory" ); msg_Err( p_playlist, "out of memory" );
...@@ -284,7 +283,10 @@ int playlist_AddInfo( playlist_t *p_playlist, int i_item, ...@@ -284,7 +283,10 @@ int playlist_AddInfo( playlist_t *p_playlist, int i_item,
va_end( args ); va_end( args );
return playlist_AddItemInfo( p_item , psz_cat , psz_name , psz_value ); i_ret = playlist_AddItemInfo( p_item , psz_cat , psz_name , psz_value );
free( psz_value );
return i_ret;
} }
...@@ -340,11 +342,11 @@ int playlist_AddItemInfo( playlist_item_t *p_item, ...@@ -340,11 +342,11 @@ int playlist_AddItemInfo( playlist_item_t *p_item,
va_start( args, psz_format ); va_start( args, psz_format );
/* Convert our message to a string */ /* Convert our message to a string */
#if defined(HAVE_VASPRINTF) && !defined(SYS_DARWIN) && !defined(SYS_BEOS) #if defined(HAVE_VASPRINTF) && !defined(SYS_DARWIN) && !defined(SYS_BEOS)
vasprintf( &p_info->psz_value, psz_format, args ); vasprintf( &p_info->psz_value, psz_format, args );
#else #else
p_info->psz_value = p_info->psz_value =
(char*) malloc( strlen(psz_format) + INTF_MAX_MSG_SIZE ); (char*) malloc( strlen(psz_format) + INTF_MAX_MSG_SIZE );
if( p_info->psz_value == NULL ) if( p_info->psz_value == NULL )
{ {
...@@ -471,11 +473,11 @@ int playlist_AddItemOption( playlist_item_t *p_item, ...@@ -471,11 +473,11 @@ int playlist_AddItemOption( playlist_item_t *p_item,
va_start( args, psz_format ); va_start( args, psz_format );
/* Convert our message to a string */ /* Convert our message to a string */
#if defined(HAVE_VASPRINTF) && !defined(SYS_DARWIN) && !defined(SYS_BEOS) #if defined(HAVE_VASPRINTF) && !defined(SYS_DARWIN) && !defined(SYS_BEOS)
vasprintf( &p_info->psz_value, psz_format, args ); vasprintf( &p_info->psz_value, psz_format, args );
#else #else
p_info->psz_value = p_info->psz_value =
(char*) malloc( strlen(psz_format) + INTF_MAX_MSG_SIZE ); (char*) malloc( strlen(psz_format) + INTF_MAX_MSG_SIZE );
if( p_info->psz_value == NULL ) if( p_info->psz_value == NULL )
{ {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* item-ext.c : Exported playlist item functions * item-ext.c : Exported playlist item functions
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2004 VideoLAN * Copyright (C) 1999-2004 VideoLAN
* $Id: item-ext.c,v 1.4 2004/01/06 08:50:20 zorglub Exp $ * $Id: item-ext.c,v 1.5 2004/01/07 19:20:30 gbazin Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* Clment Stenac <zorglub@videolan.org> * Clment Stenac <zorglub@videolan.org>
...@@ -332,12 +332,16 @@ int playlist_Delete( playlist_t * p_playlist, int i_pos ) ...@@ -332,12 +332,16 @@ int playlist_Delete( playlist_t * p_playlist, int i_pos )
} }
free( p_item->pp_categories[i]->pp_infos[j] ); free( p_item->pp_categories[i]->pp_infos[j] );
} }
if( p_item->pp_categories[i]->i_infos )
free( p_item->pp_categories[i]->pp_infos );
if( p_item->pp_categories[i]->psz_name) if( p_item->pp_categories[i]->psz_name)
{ {
free( p_item->pp_categories[i]->psz_name ); free( p_item->pp_categories[i]->psz_name );
} }
free( p_item->pp_categories[i] ); free( p_item->pp_categories[i] );
} }
free( p_item->pp_categories );
} }
/* XXX: what if the item is still in use? */ /* XXX: what if the item is still in use? */
......
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