X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fcodec%2Fffmpeg%2Fchroma.c;h=3f6a3cfddfda8187bb3a29b365d49094ef852c4c;hb=8723242733a0bf6823c2a00504db088d0b809db2;hp=f7b14e45bb79388d6ee202ca0601cf0ccef01115;hpb=f2c554795a02ff8acdc070bc10a00f4640fdb8ab;p=vlc diff --git a/modules/codec/ffmpeg/chroma.c b/modules/codec/ffmpeg/chroma.c index f7b14e45bb..3f6a3cfddf 100644 --- a/modules/codec/ffmpeg/chroma.c +++ b/modules/codec/ffmpeg/chroma.c @@ -1,7 +1,7 @@ /***************************************************************************** * chroma.c: chroma conversion using ffmpeg library ***************************************************************************** - * Copyright (C) 1999-2001 VideoLAN + * Copyright (C) 1999-2001 the VideoLAN team * $Id$ * * Authors: Gildas Bazin @@ -18,14 +18,14 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ /***************************************************************************** * Preamble *****************************************************************************/ #include -#include +#include /* ffmpeg header */ #ifdef HAVE_FFMPEG_AVCODEC_H @@ -36,6 +36,7 @@ #include "ffmpeg.h" +#if !defined(HAVE_FFMPEG_SWSCALE_H) && !defined(HAVE_LIBSWSCALE_TREE) void E_(InitLibavcodec) ( vlc_object_t *p_object ); static void ChromaConversion( vout_thread_t *, picture_t *, picture_t * ); @@ -81,24 +82,23 @@ int E_(OpenChroma)( vlc_object_t *p_this ) p_vout->chroma.p_sys = malloc( sizeof( chroma_sys_t ) ); if( p_vout->chroma.p_sys == NULL ) { - return VLC_EGENERIC; + return VLC_ENOMEM; } p_vout->chroma.p_sys->i_src_vlc_chroma = p_vout->render.i_chroma; p_vout->chroma.p_sys->i_dst_vlc_chroma = p_vout->output.i_chroma; p_vout->chroma.p_sys->i_src_ffmpeg_chroma = i_ffmpeg_chroma[0]; p_vout->chroma.p_sys->i_dst_ffmpeg_chroma = i_ffmpeg_chroma[1]; + if( ( p_vout->render.i_height != p_vout->output.i_height || p_vout->render.i_width != p_vout->output.i_width ) && - ( p_vout->chroma.p_sys->i_dst_vlc_chroma == VLC_FOURCC('I','4','2','0') || + ( p_vout->chroma.p_sys->i_dst_vlc_chroma == VLC_FOURCC('I','4','2','0') || p_vout->chroma.p_sys->i_dst_vlc_chroma == VLC_FOURCC('Y','V','1','2') )) - { msg_Dbg( p_vout, "preparing to resample picture" ); - p_vout->chroma.p_sys->p_rsc = img_resample_init( p_vout->output.i_width, - p_vout->output.i_height, - p_vout->render.i_width, - p_vout->render.i_height ); + p_vout->chroma.p_sys->p_rsc = + img_resample_init( p_vout->output.i_width, p_vout->output.i_height, + p_vout->render.i_width, p_vout->render.i_height ); avpicture_alloc( &p_vout->chroma.p_sys->tmp_pic, p_vout->chroma.p_sys->i_dst_ffmpeg_chroma, p_vout->render.i_width, p_vout->render.i_height ); @@ -152,6 +152,10 @@ static void ChromaConversion( vout_thread_t *p_vout, dest_pic.data[1] = p_dest->p[2].p_pixels; dest_pic.data[2] = p_dest->p[1].p_pixels; } + if( p_vout->chroma.p_sys->i_src_ffmpeg_chroma == PIX_FMT_RGB24 ) + if( p_vout->render.i_bmask == 0x00ff0000 ) + p_vout->chroma.p_sys->i_src_ffmpeg_chroma = PIX_FMT_BGR24; + if( p_vout->chroma.p_sys->p_rsc ) { img_convert( &p_vout->chroma.p_sys->tmp_pic, @@ -184,3 +188,4 @@ void E_(CloseChroma)( vlc_object_t *p_this ) } free( p_vout->chroma.p_sys ); } +#endif /* !defined(HAVE_FFMPEG_SWSCALE_H) && !defined(HAVE_LIBSWSCALE_TREE) */