plugin: Fix scaled subtitles position on anamorph video

GStreamer does not take pixel aspect ratio into account for overlay rectangles.
If we do so, we end up with subtitles that are displayed off-center.
Behave like any other GStreamer sink on this matter.
This commit is contained in:
Rafał Dzięgiel
2022-05-27 19:38:02 +02:00
parent 87b3fbc15a
commit 5289b2f0a4
3 changed files with 17 additions and 12 deletions

View File

@@ -59,7 +59,6 @@ gst_clapper_paintable_init (GstClapperPaintable *self)
self->par_n = DEFAULT_PAR_N;
self->par_d = DEFAULT_PAR_D;
self->pixel_aspect = ((gdouble) self->par_d / self->par_n);
g_mutex_init (&self->lock);
g_mutex_init (&self->importer_lock);
@@ -159,8 +158,6 @@ invalidate_paintable_size_internal (GstClapperPaintable *self)
display_ratio_num = self->display_ratio_num;
display_ratio_den = self->display_ratio_den;
self->pixel_aspect = ((gdouble) self->par_d / self->par_n);
GST_CLAPPER_PAINTABLE_UNLOCK (self);
if (video_height % display_ratio_den == 0) {
@@ -361,8 +358,7 @@ gst_clapper_paintable_snapshot_internal (GstClapperPaintable *self,
GST_CLAPPER_PAINTABLE_IMPORTER_LOCK (self);
if (self->importer) {
gst_clapper_importer_snapshot (self->importer, snapshot, width, height,
scale_x * self->pixel_aspect, scale_y);
gst_clapper_importer_snapshot (self->importer, snapshot, width, height);
} else {
GST_LOG_OBJECT (self, "No texture importer, drawing black");
gtk_snapshot_append_color (snapshot, &self->bg, &GRAPHENE_RECT_INIT (0, 0, width, height));