]> git.sesse.net Git - x264/commitdiff
Filtering system-related fixes
authorSteven Walters <kemuri9@gmail.com>
Sun, 25 Jul 2010 23:45:27 +0000 (19:45 -0400)
committerFiona Glaser <fiona@x264.com>
Mon, 26 Jul 2010 03:46:28 +0000 (20:46 -0700)
Fix configure to check for outdated libavutil in resize filter support.
Do not print an explicit error message in ffms when requesting a frame beyond the number of frames in the source.
Mention in --*help that filtering options can be specified as name=value.
Fix the shadowing warning in the resize filter on posix systems.

configure
filters/video/resize.c
input/ffms.c
x264.c

index aeb215afc3b171e0be98220b0207d58b11c82565..565eb985206effd9cd2ee5ffdf223be715452f75 100755 (executable)
--- a/configure
+++ b/configure
@@ -549,8 +549,13 @@ if [ "$swscale" = "auto" ] ; then
     error="swscale must be at least version 0.9.0"
     if cc_check "libswscale/swscale.h" "$SWSCALE_CFLAGS $SWSCALE_LIBS" "sws_getContext(0,0,0,0,0,0,0,0,0,0);" ; then
         if cpp_check "libswscale/swscale.h" "$SWSCALE_CFLAGS" "LIBSWSCALE_VERSION_INT >= AV_VERSION_INT(0,9,0)" "$error"; then
-            define HAVE_SWSCALE
-            swscale="yes"
+            # we use colorspaces that were defined in libavutil r19775
+            if cc_check "libavutil/pixfmt.h" "$SWSCALE_CFLAGS" "enum PixelFormat pixfmt = PIX_FMT_YUV422P16LE;" ; then
+                define HAVE_SWSCALE
+                swscale="yes"
+            else
+                echo "Warning: libavutil is too old, update to ffmpeg r19775+"
+            fi
         else
             echo "Warning: ${error}"
         fi
index 3a2faa444fbb4b80148008eb7da9f2c4da2b0466..60c6693715d94401368a693516ad1da0d6c9e692 100644 (file)
@@ -178,10 +178,10 @@ static int pick_closest_supported_csp( int csp )
     }
 }
 
-static int round_dbl( double val, int precision, int truncate )
+static int round_dbl( double val, int precision, int b_truncate )
 {
     int ret = (int)(val / precision) * precision;
-    if( !truncate && (val - ret) >= (precision/2) ) // use the remainder if we're not truncating it
+    if( !b_truncate && (val - ret) >= (precision/2) ) // use the remainder if we're not truncating it
         ret += precision;
     return ret;
 }
index 84118d5359e0156e053497b1a2a65fdd731c0abc..0472cc64a9c79bd7c3d6cf946ae8c359d4e39c17 100644 (file)
@@ -41,6 +41,7 @@ typedef struct
     FFMS_Track *track;
     int reduce_pts;
     int vfr_input;
+    int num_frames;
 } ffms_hnd_t;
 
 static int FFMS_CC update_progress( int64_t current, int64_t total, void *private )
@@ -92,7 +93,7 @@ static int open_file( char *psz_filename, hnd_t *p_handle, video_info_t *info, c
 
     FFMS_DestroyIndex( idx );
     const FFMS_VideoProperties *videop = FFMS_GetVideoProperties( h->video_source );
-    info->num_frames   = videop->NumFrames;
+    info->num_frames   = h->num_frames = videop->NumFrames;
     info->sar_height   = videop->SARDen;
     info->sar_width    = videop->SARNum;
     info->fps_den      = videop->FPSDenominator;
@@ -144,10 +145,12 @@ static int picture_alloc( cli_pic_t *pic, int csp, int width, int height )
 static int read_frame( cli_pic_t *pic, hnd_t handle, int i_frame )
 {
     ffms_hnd_t *h = handle;
+    if( i_frame >= h->num_frames )
+        return -1;
     FFMS_ErrorInfo e;
     e.BufferSize = 0;
     const FFMS_Frame *frame = FFMS_GetFrame( h->video_source, i_frame, &e );
-    FAIL_IF_ERROR( !frame, "could not read frame %d\n", i_frame )
+    FAIL_IF_ERROR( !frame, "could not read frame %d \n", i_frame )
 
     memcpy( pic->img.stride, frame->Linesize, sizeof(pic->img.stride) );
     memcpy( pic->img.plane, frame->Data, sizeof(pic->img.plane) );
diff --git a/x264.c b/x264.c
index 2f4263e1baa3488bf7ba0afe1d94ba4b3eabd4a1..530ad4a8af1efaed584c8c4403471ef4f9e60b9b 100644 (file)
--- a/x264.c
+++ b/x264.c
@@ -697,6 +697,7 @@ static void Help( x264_param_t *defaults, int longhelp )
     H0( "\n" );
     H0( "Filtering:\n" );
     H0( "\n" );
+    H0( "      Filter options may be specified in the name=value format\n" );
     H0( "--vf, --video-filter <filter0>/<filter1>/... Apply video filtering to the input file\n" );
     H0( "      Available filters:\n" );
     x264_register_vid_filters();