]> git.sesse.net Git - vlc/blobdiff - modules/video_filter/scale.c
#transcode{vfilter=...} only works with video filter2 filters.
[vlc] / modules / video_filter / scale.c
index 82e3f321d314b7749d8524f5d44012e449abfbd1..8ca7e20660bcf5c9d3de952a0dbb34ff2ad9ea85 100644 (file)
@@ -19,7 +19,7 @@
  *
  * 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.
  *****************************************************************************/
 
 /*****************************************************************************
@@ -53,7 +53,7 @@ vlc_module_begin();
     set_description( _("Video scaling filter") );
     set_capability( "video filter2", 10000 );
     set_category( CAT_VIDEO );
-    set_subcategory( SUBCAT_VIDEO_VFILTER );
+    set_subcategory( SUBCAT_VIDEO_VFILTER2 );
     set_callbacks( OpenFilter, CloseFilter );
 vlc_module_end();
 
@@ -105,10 +105,11 @@ static void CloseFilter( vlc_object_t *p_this )
  ****************************************************************************/
 static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
 {
-    filter_sys_t *p_sys = p_filter->p_sys;
     picture_t *p_pic_dst;
     int i_plane, i, j, k, l;
 
+    if( !p_pic ) return NULL;
+    
     /* Request output picture */
     p_pic_dst = p_filter->pf_vout_buffer_new( p_filter );
     if( !p_pic_dst )
@@ -132,12 +133,16 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
                   p_filter->fmt_out.video.i_height / 2 ) /
                 p_filter->fmt_out.video.i_height;
 
+            l = __MIN( (int)p_filter->fmt_in.video.i_height - 1, l );
+
             for( j = 0; j < p_pic_dst->p[i_plane].i_visible_pitch; j++ )
             {
                 k = ( p_filter->fmt_in.video.i_width * j +
                       p_filter->fmt_out.video.i_width / 2 ) /
                     p_filter->fmt_out.video.i_width;
 
+                k = __MIN( (int)p_filter->fmt_in.video.i_width - 1, k );
+
                 p_dst[i * i_dst_pitch + j] = p_src[l * i_src_pitch + k];
             }
         }