]> git.sesse.net Git - vlc/blobdiff - modules/codec/ffmpeg/postprocess.c
Removes trailing spaces. Removes tabs.
[vlc] / modules / codec / ffmpeg / postprocess.c
index 14942e0199e04e07f055ad42a5f15ab5ab316f12..17c938947088cbfd5dbc27d5f5687fda991a1beb 100644 (file)
@@ -1,8 +1,8 @@
 /*****************************************************************************
  * postprocess.c: video postprocessing using the ffmpeg library
  *****************************************************************************
- * Copyright (C) 1999-2001 VideoLAN
- * $Id: postprocess.c,v 1.4 2003/11/23 20:37:04 gbazin Exp $
+ * Copyright (C) 1999-2001 the VideoLAN team
+ * $Id$
  *
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *          Gildas Bazin <gbazin@netcourrier.com>
  *
  * 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.
  *****************************************************************************/
 
 #include <vlc/vlc.h>
-#include <vlc/vout.h>
-#include <vlc/decoder.h>
+#include <vlc_vout.h>
+#include <vlc_codec.h>
 
 /* ffmpeg header */
 #ifdef HAVE_FFMPEG_AVCODEC_H
 
 #include "ffmpeg.h"
 
-#ifdef LIBAVCODEC_PP
-
 #ifdef HAVE_POSTPROC_POSTPROCESS_H
 #   include <postproc/postprocess.h>
 #else
 #   include <libpostproc/postprocess.h>
 #endif
 
+#ifndef PP_CPU_CAPS_ALTIVEC
+#   define PP_CPU_CAPS_ALTIVEC 0
+#endif
+
 /*****************************************************************************
  * video_postproc_sys_t : ffmpeg video postprocessing descriptor
  *****************************************************************************/
@@ -71,6 +73,7 @@ void *E_(OpenPostproc)( decoder_t *p_dec, vlc_bool_t *pb_pp )
 
     p_sys = malloc( sizeof(video_postproc_sys_t) );
     p_sys->pp_context = NULL;
+    p_sys->pp_mode = NULL;
 
     *pb_pp = VLC_FALSE;
     p_sys->pb_pp = pb_pp;
@@ -80,7 +83,7 @@ void *E_(OpenPostproc)( decoder_t *p_dec, vlc_bool_t *pb_pp )
     {
         var_Create( p_dec, "ffmpeg-pp-q",
                     VLC_VAR_INTEGER | VLC_VAR_HASCHOICE | VLC_VAR_DOINHERIT );
-        text.psz_string = _("Post-Processing");
+        text.psz_string = _("Post processing");
         var_Change( p_dec, "ffmpeg-pp-q", VLC_VAR_SETTEXT, &text, NULL );
 
         var_Get( p_dec, "ffmpeg-pp-q", &val_orig );
@@ -106,20 +109,23 @@ void *E_(OpenPostproc)( decoder_t *p_dec, vlc_bool_t *pb_pp )
     /* ***** Load post processing if enabled ***** */
     var_Get( p_dec, "ffmpeg-pp-q", &val );
     var_Set( p_dec, "ffmpeg-pp-q", val_orig );
+    if( val_orig.i_int )
+        *pb_pp = VLC_TRUE;
 
     return p_sys;
 }
 
 /*****************************************************************************
- * InitPostproc: 
+ * InitPostproc:
  *****************************************************************************/
 int E_(InitPostproc)( decoder_t *p_dec, void *p_data,
                       int i_width, int i_height, int pix_fmt )
 {
     video_postproc_sys_t *p_sys = (video_postproc_sys_t *)p_data;
-    int32_t i_cpu = p_dec->p_libvlc->i_cpu;
+    unsigned i_cpu = vlc_CPU();
     int i_flags = 0;
 
+    /* Set CPU capabilities */
     if( i_cpu & CPU_CAPABILITY_MMX )
     {
         i_flags |= PP_CPU_CAPS_MMX;
@@ -132,6 +138,10 @@ int E_(InitPostproc)( decoder_t *p_dec, void *p_data,
     {
         i_flags |= PP_CPU_CAPS_3DNOW;
     }
+    if( i_cpu & CPU_CAPABILITY_ALTIVEC )
+    {
+        i_flags |= PP_CPU_CAPS_ALTIVEC;
+    }
 
     switch( pix_fmt )
     {
@@ -157,7 +167,7 @@ int E_(InitPostproc)( decoder_t *p_dec, void *p_data,
 }
 
 /*****************************************************************************
- * PostprocPict: 
+ * PostprocPict:
  *****************************************************************************/
 int E_(PostprocPict)( decoder_t *p_dec, void *p_data,
                       picture_t *p_pic, AVFrame *p_ff_pic )
@@ -186,7 +196,7 @@ int E_(PostprocPict)( decoder_t *p_dec, void *p_data,
 }
 
 /*****************************************************************************
- * ClosePostproc: 
+ * ClosePostproc:
  *****************************************************************************/
 void E_(ClosePostproc)( decoder_t *p_dec, void *p_data )
 {
@@ -199,6 +209,8 @@ void E_(ClosePostproc)( decoder_t *p_dec, void *p_data )
     }
 
     var_DelCallback( p_dec, "ffmpeg-pp-q", PPQCallback, p_sys );
+
+    if( p_sys ) free( p_sys );
 }
 
 /*****************************************************************************
@@ -231,7 +243,7 @@ static int PPQCallback( vlc_object_t *p_this, char const *psz_cmd,
 
         if( !pp_mode )
         {
-            msg_Err( p_dec, "failed geting mode for postproc" );
+            msg_Err( p_dec, "failed getting mode for postproc" );
             newval.i_int = 0;
         }
         else
@@ -251,5 +263,3 @@ static int PPQCallback( vlc_object_t *p_this, char const *psz_cmd,
 
     return VLC_SUCCESS;
 }
-
-#endif /* LIBAVCODEC_PP */