[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gstreamer-cvs
Subject:    [gst-cvs] gst-plugins-bad: dvdspu: Improve PGS parsing
From:       thaytan () kemper ! freedesktop ! org (Jan Schmidt)
Date:       2009-09-28 10:17:59
Message-ID: 20090928101759.34BED10050 () kemper ! freedesktop ! org
[Download RAW message or body]

Module: gst-plugins-bad
Branch: master
Commit: 25837289c4cbf5381e40bcb80e94cf14f57e9f59
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=25837289c4cbf5381e40bcb80e94cf14f57e9f59


Author: Jan Schmidt <thaytan@noraisin.net>
Date:   Tue Sep 22 12:16:37 2009 +0100

dvdspu: Improve PGS parsing

Improve (slightly) the interpretation of PGS set-window blocks
to avoid printing warnings about unused bytes when there are multiple
window definitions.

---

 gst/dvdspu/gstspu-pgs.c |   35 +++++++++++++++++++++--------------
 1 files changed, 21 insertions(+), 14 deletions(-)

diff --git a/gst/dvdspu/gstspu-pgs.c b/gst/dvdspu/gstspu-pgs.c
index fc5a0bb..365e0c8 100644
--- a/gst/dvdspu/gstspu-pgs.c
+++ b/gst/dvdspu/gstspu-pgs.c
@@ -520,25 +520,32 @@ parse_set_window (GstDVDSpu * dvdspu, guint8 type, guint8 * \
payload,  {
   SpuState *state = &dvdspu->spu_state;
   guint8 *end = payload + len;
-  guint8 win_id, win_ver;
+  guint8 win_count, win_id;
+  gint i;
 
-  if (payload + 10 > end)
+  if (payload + 1 > end)
     return 0;
 
   dump_bytes (payload, len);
 
-  /* FIXME: This is just a guess as to what the numbers mean: */
-  win_id = payload[0];
-  win_ver = payload[1];
-  state->pgs.win_x = GST_READ_UINT16_BE (payload + 2);
-  state->pgs.win_y = GST_READ_UINT16_BE (payload + 4);
-  state->pgs.win_w = GST_READ_UINT16_BE (payload + 6);
-  state->pgs.win_h = GST_READ_UINT16_BE (payload + 8);
-  payload += 10;
-
-  PGS_DUMP ("Win ID %u version %d x %d y %d w %d h %d\n",
-      win_id, win_ver, state->pgs.win_x, state->pgs.win_y, state->pgs.win_w,
-      state->pgs.win_h);
+  win_count = payload[0];
+
+  for (i = 0; i < win_count; i++) {
+    if (payload + 9 > end)
+      return 0;
+
+    /* FIXME: Store each window ID separately into an array */
+    win_id = payload[0];
+    state->pgs.win_x = GST_READ_UINT16_BE (payload + 1);
+    state->pgs.win_y = GST_READ_UINT16_BE (payload + 3);
+    state->pgs.win_w = GST_READ_UINT16_BE (payload + 5);
+    state->pgs.win_h = GST_READ_UINT16_BE (payload + 7);
+    payload += 9;
+
+    PGS_DUMP ("Win ID %u x %d y %d w %d h %d\n",
+        win_id, state->pgs.win_x, state->pgs.win_y, state->pgs.win_w,
+        state->pgs.win_h);
+  }
 
   if (payload != end) {
     GST_ERROR ("PGS Set Window: %" G_GSSIZE_FORMAT " bytes not consumed",


------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
gstreamer-cvs mailing list
gstreamer-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gstreamer-cvs


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic