[libbluray-devel] defines for HDMV transport stream PIDs

hpi1 git at videolan.org
Mon Aug 18 13:29:08 CEST 2014


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Mon Aug 18 14:23:12 2014 +0300| [1e7837c1e29d7f58525cb51e601f0a52ee45f785] | committer: hpi1

defines for HDMV transport stream PIDs

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

 src/Makefile.am                              |    1 +
 src/libbluray/decoders/graphics_controller.c |    6 +++---
 src/libbluray/decoders/m2ts_filter.c         |   17 +++++++++--------
 3 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index 6fbec00..a51f41a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -51,6 +51,7 @@ libbluray_la_SOURCES = \
 	libbluray/decoders/ig.h \
 	libbluray/decoders/ig_decode.h \
 	libbluray/decoders/ig_decode.c \
+	libbluray/decoders/hdmv_pids.h \
 	libbluray/decoders/rle.h \
 	libbluray/decoders/rle.c \
 	libbluray/decoders/textst.h \
diff --git a/src/libbluray/decoders/graphics_controller.c b/src/libbluray/decoders/graphics_controller.c
index 8625f3a..18e14e6 100644
--- a/src/libbluray/decoders/graphics_controller.c
+++ b/src/libbluray/decoders/graphics_controller.c
@@ -831,7 +831,7 @@ int gc_decode_ts(GRAPHICS_CONTROLLER *gc, uint16_t pid, uint8_t *block, unsigned
         return -1;
     }
 
-    if (pid >= 0x1400 && pid < 0x1500) {
+    if (IS_HDMV_PID_IG(pid)) {
         /* IG stream */
 
         if (!gc->igp) {
@@ -875,7 +875,7 @@ int gc_decode_ts(GRAPHICS_CONTROLLER *gc, uint16_t pid, uint8_t *block, unsigned
         return 1;
     }
 
-    else if (pid >= 0x1200 && pid < 0x1300) {
+    else if (IS_HDMV_PID_PG(pid)) {
         /* PG stream */
         if (!gc->pgp) {
             gc->pgp = graphics_processor_init();
@@ -894,7 +894,7 @@ int gc_decode_ts(GRAPHICS_CONTROLLER *gc, uint16_t pid, uint8_t *block, unsigned
         return 1;
     }
 
-    else if (pid == 0x1800) {
+    else if (IS_HDMV_PID_TEXTST(pid)) {
         /* TextST stream */
         if (!gc->tgp) {
             gc->tgp = graphics_processor_init();
diff --git a/src/libbluray/decoders/m2ts_filter.c b/src/libbluray/decoders/m2ts_filter.c
index dfc462e..052a07f 100644
--- a/src/libbluray/decoders/m2ts_filter.c
+++ b/src/libbluray/decoders/m2ts_filter.c
@@ -70,16 +70,16 @@ M2TS_FILTER *m2ts_filter_init(int64_t in_pts, int64_t out_pts,
         pid = (in_pts >= 0) ? p->wipe_pid : p->pass_pid;
 
         for (ii = 0, npid = 0; ii < num_video; ii++) {
-            pid[npid++] = 0x1011 + ii;
+            pid[npid++] = HDMV_PID_VIDEO + ii;
         }
         for (ii = 0; ii < num_audio; ii++) {
-            pid[npid++] = 0x1100 + ii;
+            pid[npid++] = HDMV_PID_AUDIO_FIRST + ii;
         }
         for (ii = 0; ii < num_ig; ii++) {
-            pid[npid++] = 0x1400 + ii;
+            pid[npid++] = HDMV_PID_IG_FIRST + ii;
         }
         for (ii = 0; ii < num_pg; ii++) {
-            pid[npid++] = 0x1200 + ii;
+            pid[npid++] = HDMV_PID_PG_FIRST + ii;
         }
     }
 
@@ -238,8 +238,8 @@ static int _filter_es_pts(M2TS_FILTER *p, const uint8_t *buf, uint16_t pid)
                  * PG/IG streams are cutted before out_time (unit with pts==out_time is dropped out).
                  */
                 if (pts > p->out_pts ||
-                    (pid >= 0x1200 && pid < 0x1300 /* PG */) ||
-                    (pid >= 0x1400 && pid < 0x1500 /* IG */)) {
+                    IS_HDMV_PID_PG(pid) ||
+                    IS_HDMV_PID_IG(pid)) {
                 M2TS_TRACE("Pid 0x%04x passed OUT timestamp %"PRId64" (pts %"PRId64") -> start wiping\n", pid, p->out_pts, pts);
                 _remove_pid(p->pass_pid, pid);
                 _add_pid(p->wipe_pid, pid);
@@ -266,7 +266,7 @@ int m2ts_filter(M2TS_FILTER *p, uint8_t *buf)
     for (; buf < end; buf += 192) {
 
         uint16_t pid = ((buf[4+1] & 0x1f) << 8) | buf[4+2];
-        if (!pid) {
+        if (pid == HDMV_PID_PAT) {
             p->pat_seen = 1;
             p->pat_packets = 0;
             continue;
@@ -280,7 +280,8 @@ int m2ts_filter(M2TS_FILTER *p, uint8_t *buf)
             }
             M2TS_TRACE("NOT Wiping pid 0x%04x (inside seek buffer, PAT seen)\n", pid);
         }
-        if (pid < 0x1011) {
+        if (pid < HDMV_PID_VIDEO) {
+            /* pass PMT, PCR, SIT */
             /*M2TS_TRACE("NOT Wiping pid 0x%04x (< 0x1011)\n", pid);*/
             continue;
         }



More information about the libbluray-devel mailing list