Commit 1e81f9cd authored by Gildas Bazin's avatar Gildas Bazin

* configure.ac.in: enabled xvid and ffmpeg encoders
* modules/encoder/ffmpeg/*: misc fixes + support for I422 and YUY2 input chroma.
parent b8824ca6
...@@ -1526,7 +1526,7 @@ then ...@@ -1526,7 +1526,7 @@ then
LDFLAGS="${LDFLAGS_save} ${LDFLAGS_ffmpeg}" LDFLAGS="${LDFLAGS_save} ${LDFLAGS_ffmpeg}"
AC_CHECK_HEADERS(ffmpeg/avcodec.h postproc/postprocess.h) AC_CHECK_HEADERS(ffmpeg/avcodec.h postproc/postprocess.h)
AC_CHECK_LIB(avcodec, avcodec_init, [ AC_CHECK_LIB(avcodec, avcodec_init, [
BUILTINS="${BUILTINS} ffmpeg stream_out_transcode" BUILTINS="${BUILTINS} ffmpeg stream_out_transcode encoder_ffmpeg"
LDFLAGS_ffmpeg="${LDFLAGS_ffmpeg} -lavcodec" LDFLAGS_ffmpeg="${LDFLAGS_ffmpeg} -lavcodec"
dnl XXX: we don't link with -lavcodec a 2nd time because the OS X dnl XXX: we don't link with -lavcodec a 2nd time because the OS X
dnl linker would miserably barf on multiple definitions. dnl linker would miserably barf on multiple definitions.
...@@ -1550,7 +1550,7 @@ then ...@@ -1550,7 +1550,7 @@ then
if test -f "${real_ffmpeg_tree}/libavcodec/libavcodec.a"; then if test -f "${real_ffmpeg_tree}/libavcodec/libavcodec.a"; then
dnl Use a custom libffmpeg dnl Use a custom libffmpeg
AC_MSG_RESULT(${real_ffmpeg_tree}/libavcodec/libavcodec.a) AC_MSG_RESULT(${real_ffmpeg_tree}/libavcodec/libavcodec.a)
BUILTINS="${BUILTINS} ffmpeg stream_out_transcode" BUILTINS="${BUILTINS} ffmpeg stream_out_transcode encoder_ffmpeg"
LDFLAGS_ffmpeg="${LDFLAGS_ffmpeg} -L${real_ffmpeg_tree}/libavcodec -lavcodec" LDFLAGS_ffmpeg="${LDFLAGS_ffmpeg} -L${real_ffmpeg_tree}/libavcodec -lavcodec"
CPPFLAGS_ffmpeg="${CPPFLAGS_ffmpeg} -I${real_ffmpeg_tree}/libavcodec" CPPFLAGS_ffmpeg="${CPPFLAGS_ffmpeg} -I${real_ffmpeg_tree}/libavcodec"
...@@ -1565,6 +1565,10 @@ then ...@@ -1565,6 +1565,10 @@ then
fi fi
fi fi
dnl Duplicate the ffmpeg CPPFLAGS and LDFLAGS for the encoder
LDFLAGS_encoder_ffmpeg=${LDFLAGS_ffmpeg}
CPPFLAGS_encoder_ffmpeg=${CPPFLAGS_ffmpeg}
dnl Add postprocessing modules dnl Add postprocessing modules
PLUGINS="${PLUGINS} postprocessing_c" PLUGINS="${PLUGINS} postprocessing_c"
if test "x${ac_cv_mmx_inline}" != "xno"; then if test "x${ac_cv_mmx_inline}" != "xno"; then
...@@ -1663,7 +1667,7 @@ then ...@@ -1663,7 +1667,7 @@ then
then then
dnl Use a custom xvid dnl Use a custom xvid
AC_MSG_RESULT(${real_xvid_tree}/build/generic/libxvidcore.a) AC_MSG_RESULT(${real_xvid_tree}/build/generic/libxvidcore.a)
BUILTINS="${BUILTINS} xvid" BUILTINS="${BUILTINS} xvid encoder_xvid"
LDFLAGS_xvid="${LDFLAGS_xvid} -L${real_xvid_tree}/build/generic -lxvidcore" LDFLAGS_xvid="${LDFLAGS_xvid} -L${real_xvid_tree}/build/generic -lxvidcore"
CPPFLAGS_xvid="${CPPFLAGS_xvid} -I${real_xvid_tree}/src" CPPFLAGS_xvid="${CPPFLAGS_xvid} -I${real_xvid_tree}/src"
else else
...@@ -1677,12 +1681,16 @@ then ...@@ -1677,12 +1681,16 @@ then
AC_CHECK_HEADERS(xvid.h, , AC_CHECK_HEADERS(xvid.h, ,
[ AC_MSG_ERROR([Cannot find development headers for libxvidcore...]) ]) [ AC_MSG_ERROR([Cannot find development headers for libxvidcore...]) ])
AC_CHECK_LIB(xvidcore, xvid_init, [ AC_CHECK_LIB(xvidcore, xvid_init, [
PLUGINS="${PLUGINS} xvid" PLUGINS="${PLUGINS} xvid encoder_xvid"
LDFLAGS_xvid="${LDFLAGS_xvid} -lxvidcore" ], LDFLAGS_xvid="${LDFLAGS_xvid} -lxvidcore" ],
[ AC_MSG_ERROR([Cannot find libxvidcore library...]) ]) [ AC_MSG_ERROR([Cannot find libxvidcore library...]) ])
LDFLAGS="${LDFLAGS_save}" LDFLAGS="${LDFLAGS_save}"
CPPFLAGS="${CPPFLAGS_save}" CPPFLAGS="${CPPFLAGS_save}"
fi fi
dnl Duplicate the xvid CPPFLAGS and LDFLAGS for the encoder
LDFLAGS_encoder_xvid=${LDFLAGS_xvid}
CPPFLAGS_encoder_xvid=${CPPFLAGS_xvid}
fi fi
...@@ -2036,7 +2044,7 @@ then ...@@ -2036,7 +2044,7 @@ then
fi ]) fi ])
AC_PATH_PROG(FREETYPE_CONFIG, freetype-config, no, ${FREETYPE_PATH}) AC_PATH_PROG(FREETYPE_CONFIG, freetype-config, no, ${FREETYPE_PATH})
if test "x${FREETYPE_CONFIG}" != "xno" -a "x${have_xosd}" = "xtrue" if test "x${FREETYPE_CONFIG}" != "xno"
then then
PLUGINS="${PLUGINS} osdtext" PLUGINS="${PLUGINS} osdtext"
CFLAGS_osdtext="${CFLAGS_osdtext} `${FREETYPE_CONFIG} --cflags`" CFLAGS_osdtext="${CFLAGS_osdtext} `${FREETYPE_CONFIG} --cflags`"
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* encoder.c : audio/video encoder using ffmpeg library * encoder.c : audio/video encoder using ffmpeg library
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: encoder.c,v 1.2 2003/02/20 01:52:46 sigmunau Exp $ * $Id: encoder.c,v 1.3 2003/04/26 14:54:49 gbazin Exp $
* *
* Authors: Laurent Aimar * Authors: Laurent Aimar
* *
...@@ -51,15 +51,14 @@ vlc_module_begin(); ...@@ -51,15 +51,14 @@ vlc_module_begin();
set_description( _("ffmpeg encoder") ); set_description( _("ffmpeg encoder") );
add_shortcut( "ffmpeg" ); add_shortcut( "ffmpeg" );
add_submodule(); add_submodule();
set_capability( "video encoder", 100 ); set_capability( "video encoder", 100 );
set_callbacks( E_( OpenEncoderVideo ), E_( CloseEncoderVideo ) ); set_callbacks( E_( OpenEncoderVideo ), E_( CloseEncoderVideo ) );
add_category_hint( "video setting", NULL, VLC_TRUE ); add_category_hint( "video setting", NULL, VLC_TRUE );
add_integer( "encoder-ffmpeg-video-bitrate", 1000, NULL, "bitrate (kb/s)", "bitrate (kb/s)", VLC_TRUE ); add_integer( "encoder-ffmpeg-video-bitrate", 1000, NULL, "bitrate (kb/s)", "bitrate (kb/s)", VLC_TRUE );
add_integer( "encoder-ffmpeg-video-max-key-interval", 10, NULL, "max key interval", "maximum value of frames between two keyframes", VLC_TRUE ); add_integer( "encoder-ffmpeg-video-max-key-interval", 10, NULL, "max key interval", "maximum value of frames between two keyframes", VLC_TRUE );
add_integer( "encoder-ffmpeg-min-quantizer", 2, NULL, "min quantizer", "range 1-31", VLC_TRUE ); add_integer( "encoder-ffmpeg-video-min-quant", 2, NULL, "min quantizer", "range 1-31", VLC_TRUE );
add_integer( "encoder-ffmpeg-max-quantizer", 31, NULL, "max quantizer", "range 1-31", VLC_TRUE ); add_integer( "encoder-ffmpeg-video-max-quant", 31, NULL, "max quantizer", "range 1-31", VLC_TRUE );
add_submodule(); add_submodule();
set_capability( "audio encoder", 50 ); set_capability( "audio encoder", 50 );
...@@ -68,31 +67,3 @@ vlc_module_begin(); ...@@ -68,31 +67,3 @@ vlc_module_begin();
add_integer( "encoder-ffmpeg-audio-bitrate", 64, NULL, "bitrate (kb/s)", "bitrate (kb/s)", VLC_TRUE ); add_integer( "encoder-ffmpeg-audio-bitrate", 64, NULL, "bitrate (kb/s)", "bitrate (kb/s)", VLC_TRUE );
vlc_module_end(); vlc_module_end();
#if 0
add_category_hint( "general setting", NULL );
add_integer( "encoder-xvid-bitrate", 1000, NULL, "bitrate (kb/s)", "bitrate (kb/s)" );
add_integer( "encoder-xvid-min-quantizer", 2, NULL, "min quantizer", "range 1-31" );
add_integer( "encoder-xvid-max-quantizer", 31, NULL, "max quantizer", "1-31" );
add_category_hint( "advanced setting", NULL );
add_integer( "encoder-xvid-reaction-delay-factor", -1, NULL, "rc reaction delay factor", "rate controler parameters");
add_integer( "encoder-xvid-averaging-period", -1, NULL, "rc averaging period", "rate controler parameters" );
add_integer( "encoder-xvid-buffer", -1, NULL, "rc buffer", "rate controler parameters" );
add_category_hint( "advanced frame setting", NULL );
add_string_from_list( "encoder-xvid-quantization", "MPEG", ppsz_xvid_quant_algo, NULL, "quantization algorithm", "" );
add_bool( "encoder-xvid-halfpel", 1, NULL, "half pixel motion estimation.", "" );
add_bool( "encoder-xvid-4mv", 0, NULL, "fourc vector per macroblock(need halfpel)", "" );
add_bool( "encoder-xvid-lumi-mask", 0, NULL, "use a lumimasking algorithm", "" );
add_bool( "encoder-xvid-adaptive-quant", 0, NULL, "perform an adaptative quantization", "" );
add_bool( "encoder-xvid-interlacing", 0, NULL, "use MPEG4 interlaced mode", "" );
add_string_from_list( "encoder-xvid-me", "", ppsz_xvid_me, NULL, "motion estimation", "" );
add_bool( "encoder-xvid-motion-advanceddiamond", 1, NULL, "motion advanceddiamond", "" );
add_bool( "encoder-xvid-motion-halfpeldiamond", 1, NULL, "motion halfpel diamond", "" );
add_bool( "encoder-xvid-motion-halfpelrefine", 1, NULL, "motion halfpelrefine", "" );
add_bool( "encoder-xvid-motion-extsearch", 1, NULL, "motion extsearch", "" );
add_bool( "encoder-xvid-motion-earlystop", 1, NULL, "motion earlystop", "" );
add_bool( "encoder-xvid-motion-quickstop", 1, NULL, "motion quickstop", "" );
add_bool( "encoder-xvid-motion-usesquares", 0, NULL, "use a square search", "" );
vlc_module_end();
#endif
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* video.c : video encoder using ffmpeg library * video.c : video encoder using ffmpeg library
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: video.c,v 1.2 2003/04/20 11:57:13 gbazin Exp $ * $Id: video.c,v 1.3 2003/04/26 14:54:49 gbazin Exp $
* *
* Authors: Laurent Aimar * Authors: Laurent Aimar
* *
...@@ -93,8 +93,15 @@ int E_( OpenEncoderVideo ) ( vlc_object_t *p_this ) ...@@ -93,8 +93,15 @@ int E_( OpenEncoderVideo ) ( vlc_object_t *p_this )
/* *** fix parameters *** */ /* *** fix parameters *** */
/* FIXME be clever, some codec support additional chroma */ /* FIXME be clever, some codec support additional chroma */
if( p_encoder->i_chroma != VLC_FOURCC( 'I', '4', '2', '0' ) ) if( p_encoder->i_chroma != VLC_FOURCC( 'I', '4', '2', '0' ) )
switch( p_encoder->i_chroma )
{ {
p_encoder->i_chroma = VLC_FOURCC( 'I', '4', '2', '0' ); case VLC_FOURCC( 'I', '4', '2', '0' ):
case VLC_FOURCC( 'I', '4', '2', '2' ):
case VLC_FOURCC( 'Y', 'U', 'Y', '2' ):
break;
default:
p_encoder->i_chroma = VLC_FOURCC( 'I', '4', '2', '0' );
return VLC_EGENERIC;
} }
#if 0 #if 0
p_encoder->i_width = ( p_encoder->i_width + 15 )&0xfffff8; p_encoder->i_width = ( p_encoder->i_width + 15 )&0xfffff8;
...@@ -127,7 +134,6 @@ void E_( CloseEncoderVideo )( vlc_object_t *p_this ) ...@@ -127,7 +134,6 @@ void E_( CloseEncoderVideo )( vlc_object_t *p_this )
static int Init ( video_encoder_t *p_encoder ) static int Init ( video_encoder_t *p_encoder )
{ {
encoder_sys_t *p_sys; encoder_sys_t *p_sys;
char *psz_codec;
int i_codec; int i_codec;
/* *** allocate memory *** */ /* *** allocate memory *** */
...@@ -143,11 +149,11 @@ static int Init ( video_encoder_t *p_encoder ) ...@@ -143,11 +149,11 @@ static int Init ( video_encoder_t *p_encoder )
{ {
case VLC_FOURCC( 'm', 'p', '1', 'v' ): case VLC_FOURCC( 'm', 'p', '1', 'v' ):
case VLC_FOURCC( 'm', 'p', 'g', 'v' ): case VLC_FOURCC( 'm', 'p', 'g', 'v' ):
psz_codec = "MPEG I"; p_encoder->p_sys->psz_codec = "MPEG I";
i_codec = CODEC_ID_MPEG1VIDEO; i_codec = CODEC_ID_MPEG1VIDEO;
break; break;
case VLC_FOURCC( 'm', 'p', '4', 'v' ): case VLC_FOURCC( 'm', 'p', '4', 'v' ):
psz_codec = "MPEG-4"; p_encoder->p_sys->psz_codec = "MPEG-4";
i_codec = CODEC_ID_MPEG4; i_codec = CODEC_ID_MPEG4;
break; break;
default: default:
...@@ -168,7 +174,11 @@ static int Init ( video_encoder_t *p_encoder ) ...@@ -168,7 +174,11 @@ static int Init ( video_encoder_t *p_encoder )
p_context->bit_rate = config_GetInt( p_encoder, "encoder-ffmpeg-video-bitrate" ) * 1000; p_context->bit_rate = config_GetInt( p_encoder, "encoder-ffmpeg-video-bitrate" ) * 1000;
p_context->width = p_encoder->i_width; p_context->width = p_encoder->i_width;
p_context->height= p_encoder->i_height; p_context->height= p_encoder->i_height;
#if LIBAVCODEC_BUILD >= 4662
p_context->frame_rate = 25 * DEFAULT_FRAME_RATE_BASE;
#else
p_context->frame_rate = 25 * FRAME_RATE_BASE; p_context->frame_rate = 25 * FRAME_RATE_BASE;
#endif
p_context->gop_size = config_GetInt( p_encoder, "encoder-ffmpeg-video-max-key-interval" ); p_context->gop_size = config_GetInt( p_encoder, "encoder-ffmpeg-video-max-key-interval" );
p_context->qmin = __MAX( __MIN( config_GetInt( p_encoder, "encoder-ffmpeg-video-min-quant" ), 31 ), 1 ); p_context->qmin = __MAX( __MIN( config_GetInt( p_encoder, "encoder-ffmpeg-video-min-quant" ), 31 ), 1 );
p_context->qmax = __MAX( __MIN( config_GetInt( p_encoder, "encoder-ffmpeg-video-max-quant" ), 31 ), 1 ); p_context->qmax = __MAX( __MIN( config_GetInt( p_encoder, "encoder-ffmpeg-video-max-quant" ), 31 ), 1 );
...@@ -186,6 +196,12 @@ static int Init ( video_encoder_t *p_encoder ) ...@@ -186,6 +196,12 @@ static int Init ( video_encoder_t *p_encoder )
case VLC_FOURCC( 'I', '4', '2', '0' ): case VLC_FOURCC( 'I', '4', '2', '0' ):
p_frame->pict_type = PIX_FMT_YUV420P; p_frame->pict_type = PIX_FMT_YUV420P;
break; break;
case VLC_FOURCC( 'I', '4', '2', '2' ):
p_frame->pict_type = PIX_FMT_YUV422P;
break;
case VLC_FOURCC( 'Y', 'U', 'Y', '2' ):
p_frame->pict_type = PIX_FMT_YUV422;
break;
default: default:
return VLC_EGENERIC; return VLC_EGENERIC;
} }
...@@ -202,7 +218,7 @@ static int Init ( video_encoder_t *p_encoder ) ...@@ -202,7 +218,7 @@ static int Init ( video_encoder_t *p_encoder )
* *
*****************************************************************************/ *****************************************************************************/
static int Encode ( video_encoder_t *p_encoder, static int Encode ( video_encoder_t *p_encoder,
picture_t *p_pic, void *p_data, size_t *pi_data ) picture_t *p_pic, void *p_data, size_t *pi_data )
{ {
#define p_frame p_encoder->p_sys->p_frame #define p_frame p_encoder->p_sys->p_frame
#define p_context p_encoder->p_sys->p_context #define p_context p_encoder->p_sys->p_context
......
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