[libbluray-devel] Added decoding of Window Definition Segment (WDS)

hpi1 git at videolan.org
Fri Jun 10 11:04:42 CEST 2011


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Fri Jun 10 12:01:49 2011 +0300| [a2254288ac14deefafdc8e28ff496ae5b4de2bf5] | committer: hpi1

Added decoding of Window Definition Segment (WDS)

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=a2254288ac14deefafdc8e28ff496ae5b4de2bf5
---

 src/libbluray/decoders/pg.h        |    7 +++++++
 src/libbluray/decoders/pg_decode.c |   28 +++++++++++++++++++++++++---
 src/libbluray/decoders/pg_decode.h |    4 +++-
 3 files changed, 35 insertions(+), 4 deletions(-)

diff --git a/src/libbluray/decoders/pg.h b/src/libbluray/decoders/pg.h
index 1567a17..cbc9b99 100644
--- a/src/libbluray/decoders/pg.h
+++ b/src/libbluray/decoders/pg.h
@@ -99,4 +99,11 @@ typedef struct {
 
 } BD_PG_COMPOSITION;
 
+typedef struct {
+    int64_t       pts;
+
+    unsigned      num_windows;
+    BD_PG_WINDOW *window;
+} BD_PG_WINDOWS;
+
 #endif // _BD_PG_H_
diff --git a/src/libbluray/decoders/pg_decode.c b/src/libbluray/decoders/pg_decode.c
index 6708bac..2cafa16 100644
--- a/src/libbluray/decoders/pg_decode.c
+++ b/src/libbluray/decoders/pg_decode.c
@@ -218,6 +218,20 @@ int pg_decode_composition(BITBUFFER *bb, BD_PG_COMPOSITION *p)
     return 1;
 }
 
+int pg_decode_windows(BITBUFFER *bb, BD_PG_WINDOWS *p)
+{
+    unsigned ii;
+
+    p->num_windows = bb_read(bb, 8);
+    p->window = calloc(p->num_windows, sizeof(BD_PG_WINDOW));
+
+    for (ii = 0; ii < p->num_windows; ii++) {
+        pg_decode_window(bb, &p->window[ii]);
+    }
+
+    return 1;
+}
+
 /*
  * cleanup
  */
@@ -236,10 +250,10 @@ void pg_clean_composition(BD_PG_COMPOSITION *p)
     }
 }
 
-void pg_free_window(BD_PG_WINDOW **p)
+void pg_clean_windows(BD_PG_WINDOWS *p)
 {
-    if (p && *p) {
-        X_FREE(*p);
+    if (p) {
+        X_FREE(p->window);
     }
 }
 
@@ -265,3 +279,11 @@ void pg_free_composition(BD_PG_COMPOSITION **p)
         X_FREE(*p);
     }
 }
+
+void pg_free_windows(BD_PG_WINDOWS **p)
+{
+    if (p && *p) {
+        pg_clean_windows(*p);
+        X_FREE(*p);
+    }
+}
diff --git a/src/libbluray/decoders/pg_decode.h b/src/libbluray/decoders/pg_decode.h
index d8af2b5..975b9e2 100644
--- a/src/libbluray/decoders/pg_decode.h
+++ b/src/libbluray/decoders/pg_decode.h
@@ -43,6 +43,7 @@ BD_PRIVATE int pg_decode_palette_update(BITBUFFER *bb, BD_PG_PALETTE *p);
 BD_PRIVATE int pg_decode_palette(BITBUFFER *bb, BD_PG_PALETTE *p);
 BD_PRIVATE int pg_decode_object(BITBUFFER *bb, BD_PG_OBJECT *p);
 BD_PRIVATE int pg_decode_composition(BITBUFFER *bb, BD_PG_COMPOSITION *p);
+BD_PRIVATE int pg_decode_windows(BITBUFFER *bb, BD_PG_WINDOWS *p);
 
 /*
  * cleanup
@@ -50,10 +51,11 @@ BD_PRIVATE int pg_decode_composition(BITBUFFER *bb, BD_PG_COMPOSITION *p);
 
 BD_PRIVATE void pg_clean_object(BD_PG_OBJECT *p);
 BD_PRIVATE void pg_clean_composition(BD_PG_COMPOSITION *p);
+BD_PRIVATE void pg_clean_windows(BD_PG_WINDOWS *p);
 
-BD_PRIVATE void pg_free_window(BD_PG_WINDOW **p);
 BD_PRIVATE void pg_free_palette(BD_PG_PALETTE **p);
 BD_PRIVATE void pg_free_object(BD_PG_OBJECT **p);
 BD_PRIVATE void pg_free_composition(BD_PG_COMPOSITION **p);
+BD_PRIVATE void pg_free_windows(BD_PG_WINDOWS **p);
 
 #endif // _PG_DECODE_H_



More information about the libbluray-devel mailing list