summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gtk/src/hb-backend.c5
-rw-r--r--libhb/common.h1
-rw-r--r--libhb/cropscale.c1
-rw-r--r--libhb/deblock.c1
-rw-r--r--libhb/decomb.c1
-rw-r--r--libhb/deinterlace.c1
-rw-r--r--libhb/denoise.c1
-rw-r--r--libhb/detelecine.c1
-rw-r--r--libhb/rendersub.c26
-rw-r--r--libhb/rotate.c1
-rw-r--r--libhb/vfr.c1
-rw-r--r--libhb/work.c56
-rw-r--r--macosx/Controller.m8
-rw-r--r--test/test.c6
14 files changed, 31 insertions, 79 deletions
diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c
index 1c9d3f924..f104850e7 100644
--- a/gtk/src/hb-backend.c
+++ b/gtk/src/hb-backend.c
@@ -5081,7 +5081,10 @@ add_job(hb_handle_t *h, GValue *js, gint unique_id, gint titleindex)
{
// Add filter that renders vobsubs
filter = hb_filter_init(HB_FILTER_RENDER_SUB);
- hb_add_filter( job, filter, NULL );
+ filter_str = g_strdup_printf("%d:%d:%d:%d",
+ crop[0], crop[1], crop[2], crop[3]);
+ hb_add_filter( job, filter, filter_str );
+ g_free(filter_str);
}
diff --git a/libhb/common.h b/libhb/common.h
index 741c32e03..ab1a0c169 100644
--- a/libhb/common.h
+++ b/libhb/common.h
@@ -931,7 +931,6 @@ struct hb_filter_object_s
{
int id;
int enforce_order;
- int init_index;
char * name;
char * settings;
diff --git a/libhb/cropscale.c b/libhb/cropscale.c
index c11e931ee..11a22a44e 100644
--- a/libhb/cropscale.c
+++ b/libhb/cropscale.c
@@ -30,7 +30,6 @@ hb_filter_object_t hb_filter_crop_scale =
{
.id = HB_FILTER_CROP_SCALE,
.enforce_order = 1,
- .init_index = 0,
.name = "Crop and Scale",
.settings = NULL,
.init = hb_crop_scale_init,
diff --git a/libhb/deblock.c b/libhb/deblock.c
index 6d1f1aaec..dab622abc 100644
--- a/libhb/deblock.c
+++ b/libhb/deblock.c
@@ -63,7 +63,6 @@ hb_filter_object_t hb_filter_deblock =
{
.id = HB_FILTER_DEBLOCK,
.enforce_order = 1,
- .init_index = 0,
.name = "Deblock (pp7)",
.settings = NULL,
.init = hb_deblock_init,
diff --git a/libhb/decomb.c b/libhb/decomb.c
index 166d72f16..50773b772 100644
--- a/libhb/decomb.c
+++ b/libhb/decomb.c
@@ -232,7 +232,6 @@ hb_filter_object_t hb_filter_decomb =
{
.id = HB_FILTER_DECOMB,
.enforce_order = 1,
- .init_index = 0,
.name = "Decomb",
.settings = NULL,
.init = hb_decomb_init,
diff --git a/libhb/deinterlace.c b/libhb/deinterlace.c
index 4911f4bbc..49681512c 100644
--- a/libhb/deinterlace.c
+++ b/libhb/deinterlace.c
@@ -84,7 +84,6 @@ hb_filter_object_t hb_filter_deinterlace =
{
.id = HB_FILTER_DEINTERLACE,
.enforce_order = 1,
- .init_index = 0,
.name = "Deinterlace (ffmpeg or yadif/mcdeint)",
.settings = NULL,
.init = hb_deinterlace_init,
diff --git a/libhb/denoise.c b/libhb/denoise.c
index 48addf8e9..dfc58863d 100644
--- a/libhb/denoise.c
+++ b/libhb/denoise.c
@@ -46,7 +46,6 @@ hb_filter_object_t hb_filter_denoise =
{
.id = HB_FILTER_DENOISE,
.enforce_order = 1,
- .init_index = 0,
.name = "Denoise (hqdn3d)",
.settings = NULL,
.init = hb_denoise_init,
diff --git a/libhb/detelecine.c b/libhb/detelecine.c
index 0ec02303a..0437730f2 100644
--- a/libhb/detelecine.c
+++ b/libhb/detelecine.c
@@ -98,7 +98,6 @@ hb_filter_object_t hb_filter_detelecine =
{
.id = HB_FILTER_DETELECINE,
.enforce_order = 1,
- .init_index = 0,
.name = "Detelecine (pullup)",
.settings = NULL,
.init = hb_detelecine_init,
diff --git a/libhb/rendersub.c b/libhb/rendersub.c
index 40eaba5fe..4032a48df 100644
--- a/libhb/rendersub.c
+++ b/libhb/rendersub.c
@@ -62,7 +62,6 @@ hb_filter_object_t hb_filter_render_sub =
{
.id = HB_FILTER_RENDER_SUB,
.enforce_order = 1,
- .init_index = 1,
.name = "Subtitle renderer",
.settings = NULL,
.init = hb_rendersub_init,
@@ -268,9 +267,6 @@ static int vobsub_init( hb_filter_object_t * filter,
{
hb_filter_private_t * pv = filter->private_data;
- // VOBSUB render filter has no settings
- memcpy( pv->crop, init->crop, sizeof( int[4] ) );
-
pv->sub_list = hb_list_init();
return 0;
@@ -419,8 +415,6 @@ static int ssa_init( hb_filter_object_t * filter,
{
hb_filter_private_t * pv = filter->private_data;
- memcpy( pv->crop, init->crop, sizeof( int[4] ) );
-
pv->ssa = ass_library_init();
if ( !pv->ssa ) {
hb_error( "decssasub: libass initialization failed\n" );
@@ -481,13 +475,17 @@ static int ssa_init( hb_filter_object_t * filter,
ass_process_codec_private( pv->ssaTrack,
(char *)filter->subtitle->extradata, filter->subtitle->extradata_size );
- int width = init->width - ( init->crop[2] + init->crop[3] );
- int height = init->height - ( init->crop[0] + init->crop[1] );
+ int width = init->width - ( pv->crop[2] + pv->crop[3] );
+ int height = init->height - ( pv->crop[0] + pv->crop[1] );
ass_set_frame_size( pv->renderer, width, height);
double par = (double)init->par_width / init->par_height;
ass_set_aspect_ratio( pv->renderer, 1, par );
+ // libass will take care of positioning for us, so we don't need to
+ // compensate for crop.
+ pv->crop[0] = pv->crop[1] = pv->crop[2] = pv->crop[3] = 0;
+
return 0;
}
@@ -600,9 +598,6 @@ static int pgssub_init( hb_filter_object_t * filter,
{
hb_filter_private_t * pv = filter->private_data;
- // PGS render filter has no settings
- memcpy( pv->crop, init->crop, sizeof( int[4] ) );
-
pv->sub_list = hb_list_init();
return 0;
@@ -661,6 +656,15 @@ static int hb_rendersub_init( hb_filter_object_t * filter,
hb_subtitle_t *subtitle;
int ii;
+ if( filter->settings )
+ {
+ sscanf( filter->settings, "%d:%d:%d:%d",
+ &pv->crop[0],
+ &pv->crop[1],
+ &pv->crop[2],
+ &pv->crop[3]);
+ }
+
// Find the subtitle we need
for( ii = 0; ii < hb_list_count(init->job->title->list_subtitle); ii++ )
{
diff --git a/libhb/rotate.c b/libhb/rotate.c
index a96e6927d..5f9558764 100644
--- a/libhb/rotate.c
+++ b/libhb/rotate.c
@@ -46,7 +46,6 @@ hb_filter_object_t hb_filter_rotate =
{
.id = HB_FILTER_ROTATE,
.enforce_order = 0,
- .init_index = 2,
.name = "Rotate (rotate & flip image axes)",
.settings = NULL,
.init = hb_rotate_init,
diff --git a/libhb/vfr.c b/libhb/vfr.c
index 7c70c21d4..9c3e2e2a8 100644
--- a/libhb/vfr.c
+++ b/libhb/vfr.c
@@ -46,7 +46,6 @@ hb_filter_object_t hb_filter_vfr =
{
.id = HB_FILTER_VFR,
.enforce_order = 1,
- .init_index = 0,
.name = "Framerate Shaper",
.settings = NULL,
.init = hb_vfr_init,
diff --git a/libhb/work.c b/libhb/work.c
index f237a0a9b..50596093f 100644
--- a/libhb/work.c
+++ b/libhb/work.c
@@ -504,47 +504,6 @@ void correct_framerate( hb_job_t * job )
interjob->vrate_base = job->vrate_base;
}
-void hb_filter_init_next( hb_list_t * list, int *score, int *ret_pos )
-{
- int count = hb_list_count( list );
- int pos = *ret_pos + 1;
- int ii = 0;
- if ( pos == 0 )
- {
- hb_filter_object_t * filter = hb_list_item( list, pos );
- if ( filter->init_index == *score )
- {
- *ret_pos = pos;
- return;
- }
- pos++;
- }
- while (1)
- {
- if ( pos == count )
- {
- pos = 0;
- (*score)++;
- ii = 0;
- }
- hb_filter_object_t * filter = hb_list_item( list, pos );
- if ( filter->init_index == *score )
- {
- *ret_pos = pos;
- return;
- }
- pos++;
- ii++;
- if (ii > count)
- {
- // This is an error that should never happen
- hb_error("internal error during filter initialization");
- *ret_pos = -1;
- return;
- }
- }
-}
-
/**
* Job initialization rountine.
* Initializes fifos.
@@ -723,7 +682,6 @@ static void do_job( hb_job_t * job )
if( job->list_filter && hb_list_count( job->list_filter ) )
{
hb_filter_init_t init;
- int pos = -1, score = 0;
init.job = job;
init.pix_fmt = PIX_FMT_YUV420P;
@@ -737,19 +695,7 @@ static void do_job( hb_job_t * job )
init.cfr = 0;
for( i = 0; i < hb_list_count( job->list_filter ); i++ )
{
- // Some filters need to be initialized in a different order
- // than they are executed in the pipeline. e.g. rendersub
- // needs to be initialized after cropscale so that it knows
- // the crop settings, but it needs to be executed before
- // cropscale. so hb_filter_init_next() finds returns the
- // position of filters in initialization order.
- hb_filter_init_next( job->list_filter, &score, &pos );
- if( pos == -1)
- {
- // This is an error that should never happen!
- break;
- }
- hb_filter_object_t * filter = hb_list_item( job->list_filter, pos );
+ hb_filter_object_t * filter = hb_list_item( job->list_filter, i );
if( filter->init( filter, &init ) )
{
hb_log( "Failure to initialise filter '%s', disabling",
diff --git a/macosx/Controller.m b/macosx/Controller.m
index e3c85dffa..9d7830059 100644
--- a/macosx/Controller.m
+++ b/macosx/Controller.m
@@ -3252,7 +3252,9 @@ bool one_burned = FALSE;
if( one_burned )
{
filter = hb_filter_init( HB_FILTER_RENDER_SUB );
- hb_add_filter( job, filter, NULL );
+ hb_add_filter( job, filter, [[NSString stringWithFormat:@"%d:%d:%d:%d",
+ job->crop[0], job->crop[1],
+ job->crop[2], job->crop[3]] UTF8String] );
}
@@ -3790,7 +3792,9 @@ bool one_burned = FALSE;
if( one_burned )
{
filter = hb_filter_init( HB_FILTER_RENDER_SUB );
- hb_add_filter( job, filter, NULL );
+ hb_add_filter( job, filter, [[NSString stringWithFormat:@"%d:%d:%d:%d",
+ job->crop[0], job->crop[1],
+ job->crop[2], job->crop[3]] UTF8String] );
}
#pragma mark -
diff --git a/test/test.c b/test/test.c
index 27c7d498b..36a0eb248 100644
--- a/test/test.c
+++ b/test/test.c
@@ -2243,8 +2243,12 @@ static int HandleEvents( hb_handle_t * h )
if ( sub_burned )
{
+ char * filter_str;
+ filter_str = hb_strdup_printf("%d:%d:%d:%d",
+ job->crop[0], job->crop[1], job->crop[2], job->crop[3] );
filter = hb_filter_init( HB_FILTER_RENDER_SUB );
- hb_add_filter( job, filter, NULL);
+ hb_add_filter( job, filter, filter_str);
+ free( filter_str );
}
if( srtfile )