From 705ab7e35a35200dc862e94b99eb89a14e0f9bee Mon Sep 17 00:00:00 2001 From: Arnaud Vrac Date: Fri, 30 Aug 2013 22:08:01 +0200 Subject: [PATCH] dvdspu: handle frame size event from upstream An IDX file or codec_data normally contains the original frame size of the video. Allow upstream to provide this information by sending a custom event, which will allow scaling the overlay correctly. Part-of: --- .../gst-plugins-bad/gst/dvdspu/gstspu-vobsub.c | 11 +++++++++-- .../gst-plugins-bad/gst/dvdspu/gstspu-vobsub.h | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/subprojects/gst-plugins-bad/gst/dvdspu/gstspu-vobsub.c b/subprojects/gst-plugins-bad/gst/dvdspu/gstspu-vobsub.c index 4f4ccbfe4e..19e8c0027c 100644 --- a/subprojects/gst-plugins-bad/gst/dvdspu/gstspu-vobsub.c +++ b/subprojects/gst-plugins-bad/gst/dvdspu/gstspu-vobsub.c @@ -485,6 +485,11 @@ gstspu_vobsub_handle_dvd_event (GstDVDSpu * dvdspu, GstEvent * event) if (was_forced != forced_only) hl_change = TRUE; } + } else if (strcmp (event_type, "dvd-set-frame-size") == 0) { + gst_structure_get_int (structure, "width", &state->vobsub.frame_w); + gst_structure_get_int (structure, "height", &state->vobsub.frame_h); + GST_INFO_OBJECT (dvdspu, "Frame size is now %dx%d", + state->vobsub.frame_w, state->vobsub.frame_h); } gst_event_unref (event); @@ -509,10 +514,12 @@ gstspu_vobsub_get_render_geometry (GstDVDSpu * dvdspu, } if (display_width) - *display_width = state->info.width; + *display_width = state->vobsub.frame_w > 0 ? + state->vobsub.frame_w : state->info.width; if (display_height) - *display_height = state->info.height; + *display_height = state->vobsub.frame_h > 0 ? + state->vobsub.frame_h : state->info.height; } void diff --git a/subprojects/gst-plugins-bad/gst/dvdspu/gstspu-vobsub.h b/subprojects/gst-plugins-bad/gst/dvdspu/gstspu-vobsub.h index 0c8d0f10c4..147d6fb4b2 100644 --- a/subprojects/gst-plugins-bad/gst/dvdspu/gstspu-vobsub.h +++ b/subprojects/gst-plugins-bad/gst/dvdspu/gstspu-vobsub.h @@ -56,6 +56,7 @@ struct SpuVobsubState { SpuRect disp_rect; SpuRect hl_rect; + gint frame_w, frame_h; guint32 current_clut[16]; /* Colour lookup table from incoming events */