summaryrefslogtreecommitdiffstats
path: root/libhb/rendersub.c
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2012-05-05 18:22:37 +0000
committerjstebbins <[email protected]>2012-05-05 18:22:37 +0000
commit06254850dc2c1ec43d57f4d8e2026fa67967d5b9 (patch)
treec7ff6a64e1310d79f4f17b1a6bfe9aebaf88a958 /libhb/rendersub.c
parent1c8309d77ea303954f8c9e3919c595de54f173f2 (diff)
libhb: Fix problem with positions of burned-in subs
When cropping and/or scaling, the position of burned-in SSA subs was broken. Also, when scaling, the position of all other burned-in subs was broken. Part of this fix is to revert a bit of filter initialization changes that were made in this commit https://trac.handbrake.fr/changeset/4605 The other part of the fix is to add cropping parameters to the initialization of the subtitle rendering filter. This filter needs the *original* title dimensions and the crop values in order to compute the positions properly. The changes that I am reverting gave it the scaled job dimensions and the crop values. This was wrong in so many ways it's embarassing :p git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4642 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/rendersub.c')
-rw-r--r--libhb/rendersub.c26
1 files changed, 15 insertions, 11 deletions
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++ )
{