summaryrefslogtreecommitdiffstats
path: root/libhb/cropscale.c
diff options
context:
space:
mode:
authorJohn Stebbins <[email protected]>2015-10-24 14:06:56 -0700
committerJohn Stebbins <[email protected]>2016-01-21 12:38:42 -0700
commit10ea76c71197b302b10088d93680a4bed4bc6b8e (patch)
tree459b46b16256c39ed34fe1f0a4b9476ec3439871 /libhb/cropscale.c
parentef956e695879c716dc22c96f7f8fa24e3fa5d08c (diff)
libhb: Add libavfilter support and pad filter
New filter types HB_FILTER_AVFILTER and HB_FILTER_PAD. Settings for HB_FILTER_AVFILTER are the same as you would pass to avconv from the command line -vf option, except that we do not support multi-input or multi-output filters. Settings for HB_FILTER_PAD are "width:height:color:x_offset:y_offset". width x height is the size of the output frame after padding. color may be a w3c color name or RGB value (default black). x_offset, y_offset is the position of the video within the padded area (default centered). Any of the values may be omitted or "auto".
Diffstat (limited to 'libhb/cropscale.c')
-rw-r--r--libhb/cropscale.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/libhb/cropscale.c b/libhb/cropscale.c
index 5499156ec..4c505ff20 100644
--- a/libhb/cropscale.c
+++ b/libhb/cropscale.c
@@ -39,8 +39,7 @@ static int hb_crop_scale_work( hb_filter_object_t * filter,
hb_buffer_t ** buf_in,
hb_buffer_t ** buf_out );
-static int hb_crop_scale_info( hb_filter_object_t * filter,
- hb_filter_info_t * info );
+static hb_filter_info_t * hb_crop_scale_info( hb_filter_object_t * filter );
static void hb_crop_scale_close( hb_filter_object_t * filter );
@@ -98,17 +97,18 @@ static int hb_crop_scale_init( hb_filter_object_t * filter,
return 0;
}
-static int hb_crop_scale_info( hb_filter_object_t * filter,
- hb_filter_info_t * info )
+static hb_filter_info_t * hb_crop_scale_info( hb_filter_object_t * filter )
{
hb_filter_private_t * pv = filter->private_data;
+ hb_filter_info_t * info;
if( !pv )
- return 0;
+ return NULL;
+
+ info = calloc(1, sizeof(hb_filter_info_t));
+ info->human_readable_desc = malloc(128);
+ info->human_readable_desc[0] = 0;
- // Set init values so the next stage in the pipline
- // knows what it will be getting
- memset( info, 0, sizeof( hb_filter_info_t ) );
info->out.pix_fmt = pv->pix_fmt;
info->out.geometry.width = pv->width_out;
info->out.geometry.height = pv->height_out;
@@ -117,13 +117,13 @@ static int hb_crop_scale_info( hb_filter_object_t * filter,
int cropped_width = pv->width_in - ( pv->crop[2] + pv->crop[3] );
int cropped_height = pv->height_in - ( pv->crop[0] + pv->crop[1] );
- sprintf( info->human_readable_desc,
+ snprintf( info->human_readable_desc, 128,
"source: %d * %d, crop (%d/%d/%d/%d): %d * %d, scale: %d * %d",
pv->width_in, pv->height_in,
pv->crop[0], pv->crop[1], pv->crop[2], pv->crop[3],
cropped_width, cropped_height, pv->width_out, pv->height_out );
- return 0;
+ return info;
}
static void hb_crop_scale_close( hb_filter_object_t * filter )