]> git.sesse.net Git - vlc/commitdiff
* configure.ac.in: enabled xvid and ffmpeg encoders
authorGildas Bazin <gbazin@videolan.org>
Sat, 26 Apr 2003 14:54:49 +0000 (14:54 +0000)
committerGildas Bazin <gbazin@videolan.org>
Sat, 26 Apr 2003 14:54:49 +0000 (14:54 +0000)
* modules/encoder/ffmpeg/*: misc fixes + support for I422 and YUY2 input chroma.

configure.ac.in
modules/encoder/ffmpeg/encoder.c
modules/encoder/ffmpeg/video.c

index 38b5c526feb523d6ebd4aa234e7235fd09b234e0..597a8194bf72abe173cbd9174705cbb903ddbbf7 100644 (file)
@@ -1526,7 +1526,7 @@ then
     LDFLAGS="${LDFLAGS_save} ${LDFLAGS_ffmpeg}"
     AC_CHECK_HEADERS(ffmpeg/avcodec.h postproc/postprocess.h)
     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"
       dnl  XXX: we don't link with -lavcodec a 2nd time because the OS X
       dnl       linker would miserably barf on multiple definitions.
@@ -1550,7 +1550,7 @@ then
     if test -f "${real_ffmpeg_tree}/libavcodec/libavcodec.a"; then
       dnl  Use a custom libffmpeg
       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"
       CPPFLAGS_ffmpeg="${CPPFLAGS_ffmpeg} -I${real_ffmpeg_tree}/libavcodec"
 
@@ -1565,6 +1565,10 @@ then
     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
   PLUGINS="${PLUGINS} postprocessing_c"
   if test "x${ac_cv_mmx_inline}" != "xno"; then
@@ -1663,7 +1667,7 @@ then
     then
       dnl  Use a custom xvid
       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"
       CPPFLAGS_xvid="${CPPFLAGS_xvid} -I${real_xvid_tree}/src"
     else
@@ -1677,12 +1681,16 @@ then
     AC_CHECK_HEADERS(xvid.h, ,
       [ AC_MSG_ERROR([Cannot find development headers for libxvidcore...]) ])
     AC_CHECK_LIB(xvidcore, xvid_init, [
-      PLUGINS="${PLUGINS} xvid"
+      PLUGINS="${PLUGINS} xvid encoder_xvid"
       LDFLAGS_xvid="${LDFLAGS_xvid} -lxvidcore" ],
       [ AC_MSG_ERROR([Cannot find libxvidcore library...]) ])
     LDFLAGS="${LDFLAGS_save}"
     CPPFLAGS="${CPPFLAGS_save}"
   fi
+
+  dnl Duplicate the xvid CPPFLAGS and LDFLAGS for the encoder
+  LDFLAGS_encoder_xvid=${LDFLAGS_xvid}
+  CPPFLAGS_encoder_xvid=${CPPFLAGS_xvid}
 fi
 
 
@@ -2036,7 +2044,7 @@ then
       fi ])
   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
     PLUGINS="${PLUGINS} osdtext"
     CFLAGS_osdtext="${CFLAGS_osdtext} `${FREETYPE_CONFIG} --cflags`"
index b101fe9da7ba1b7c4ae5a135def3a7b64fa292f6..b3c59d57c51863771df927c7750836de7f876adf 100644 (file)
@@ -2,7 +2,7 @@
  * encoder.c : audio/video encoder using ffmpeg library
  *****************************************************************************
  * 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
  *
@@ -51,15 +51,14 @@ vlc_module_begin();
     set_description( _("ffmpeg encoder") );
     add_shortcut( "ffmpeg" );
 
-
     add_submodule();
         set_capability( "video encoder", 100 );
         set_callbacks( E_( OpenEncoderVideo ), E_( CloseEncoderVideo ) );
         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-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-max-quantizer", 31, NULL, "max 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-video-max-quant", 31, NULL, "max quantizer", "range 1-31", VLC_TRUE );
 
     add_submodule();
         set_capability( "audio encoder", 50 );
@@ -68,31 +67,3 @@ vlc_module_begin();
             add_integer( "encoder-ffmpeg-audio-bitrate", 64, NULL, "bitrate (kb/s)", "bitrate (kb/s)", VLC_TRUE );
 
 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
index f1e34ac28302211b2937cf19a7d2e4c1d295c7bd..18a4795fa522d6e3ac10b33142f164ccf45783bf 100644 (file)
@@ -2,7 +2,7 @@
  * video.c : video encoder using ffmpeg library
  *****************************************************************************
  * 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
  *
@@ -93,8 +93,15 @@ int  E_( OpenEncoderVideo ) ( vlc_object_t *p_this )
     /* *** fix parameters *** */
     /* FIXME be clever, some codec support additional chroma */
     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
     p_encoder->i_width = ( p_encoder->i_width + 15 )&0xfffff8;
@@ -127,7 +134,6 @@ void E_( CloseEncoderVideo )( vlc_object_t *p_this )
 static int  Init     ( video_encoder_t *p_encoder )
 {
     encoder_sys_t *p_sys;
-    char          *psz_codec;
     int           i_codec;
 
     /* *** allocate memory *** */
@@ -143,11 +149,11 @@ static int  Init     ( video_encoder_t *p_encoder )
     {
         case VLC_FOURCC( 'm', 'p', '1', '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;
             break;
         case VLC_FOURCC( 'm', 'p', '4', 'v' ):
-            psz_codec = "MPEG-4";
+            p_encoder->p_sys->psz_codec = "MPEG-4";
             i_codec = CODEC_ID_MPEG4;
             break;
         default:
@@ -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->width = p_encoder->i_width;
     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;
+#endif
     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->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 )
         case VLC_FOURCC( 'I', '4', '2', '0' ):
             p_frame->pict_type = PIX_FMT_YUV420P;
             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:
             return VLC_EGENERIC;
     }
@@ -202,7 +218,7 @@ static int  Init     ( 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_context p_encoder->p_sys->p_context