summaryrefslogtreecommitdiffstats
path: root/libhb/rendersub.c
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2015-01-30 16:35:13 +0000
committerjstebbins <[email protected]>2015-01-30 16:35:13 +0000
commit9ada60e118b34149cffa55968c90c0a27a74b9d4 (patch)
tree023c6052dce66fde749d3df63fd8e80f6fa428e1 /libhb/rendersub.c
parentd6bcc43ea2d136a58af0664f3503e443cbe7b363 (diff)
libhb: automatically add rendersub filter when required
This requires the addition of a filter->post_init function to inform filters of the final job configuration after all filters have been initialized. Rendersub needs to know cropping, but cropping isn't known till after crop_scale filter is initialized. Since crop_scale is initialized *after* rendersub is initialized, post_init is needed. Currently, rendersub is the only filter that defines post_init. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6830 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/rendersub.c')
-rw-r--r--libhb/rendersub.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/libhb/rendersub.c b/libhb/rendersub.c
index ac05f635a..6dabf39a7 100644
--- a/libhb/rendersub.c
+++ b/libhb/rendersub.c
@@ -75,6 +75,8 @@ static void pgssub_close( hb_filter_object_t * filter );
static int hb_rendersub_init( hb_filter_object_t * filter,
hb_filter_init_t * init );
+static int hb_rendersub_post_init( hb_filter_object_t * filter, hb_job_t *job );
+
static int hb_rendersub_work( hb_filter_object_t * filter,
hb_buffer_t ** buf_in,
hb_buffer_t ** buf_out );
@@ -88,6 +90,7 @@ hb_filter_object_t hb_filter_render_sub =
.name = "Subtitle renderer",
.settings = NULL,
.init = hb_rendersub_init,
+ .post_init = hb_rendersub_post_init,
.work = hb_rendersub_work,
.close = hb_rendersub_close,
};
@@ -826,13 +829,14 @@ static int pgssub_work( hb_filter_object_t * filter,
}
static int hb_rendersub_init( hb_filter_object_t * filter,
- hb_filter_init_t * init )
+ hb_filter_init_t * init )
{
filter->private_data = calloc( 1, sizeof(struct hb_filter_private_s) );
hb_filter_private_t * pv = filter->private_data;
hb_subtitle_t *subtitle;
int ii;
+ pv->crop[0] = pv->crop[1] = pv->crop[2] = pv->crop[3] = -1;
if( filter->settings )
{
sscanf( filter->settings, "%d:%d:%d:%d",
@@ -893,6 +897,22 @@ static int hb_rendersub_init( hb_filter_object_t * filter,
}
}
+static int hb_rendersub_post_init( hb_filter_object_t * filter, hb_job_t *job )
+{
+ hb_filter_private_t * pv = filter->private_data;
+
+ if (pv->crop[0] == -1)
+ pv->crop[0] = job->crop[0];
+ if (pv->crop[1] == -1)
+ pv->crop[1] = job->crop[1];
+ if (pv->crop[2] == -1)
+ pv->crop[2] = job->crop[2];
+ if (pv->crop[3] == -1)
+ pv->crop[3] = job->crop[3];
+
+ return 0;
+}
+
static int hb_rendersub_work( hb_filter_object_t * filter,
hb_buffer_t ** buf_in,
hb_buffer_t ** buf_out )