[libbluray-devel] Parse extent start points (.ssif interleaving) from clip info file extension data
hpi1
git at videolan.org
Fri Aug 31 21:39:06 CEST 2012
libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Fri Aug 31 22:26:36 2012 +0300| [0e5763df58b75a824cab95be15f6a8ff96763bfa] | committer: hpi1
Parse extent start points (.ssif interleaving) from clip info file extension data
> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=0e5763df58b75a824cab95be15f6a8ff96763bfa
---
src/examples/Makefile.am | 2 ++
src/examples/clpi_dump.c | 37 ++++++++++++++++++++++++++++++--
src/libbluray/bdnav/clpi_data.h | 11 ++++++++++
src/libbluray/bdnav/clpi_parse.c | 43 ++++++++++++++++++++++++++++++++++++++
4 files changed, 91 insertions(+), 2 deletions(-)
diff --git a/src/examples/Makefile.am b/src/examples/Makefile.am
index 9fea45b..8c570c2 100644
--- a/src/examples/Makefile.am
+++ b/src/examples/Makefile.am
@@ -31,6 +31,7 @@ mpls_dump_SOURCES = \
../util/logging.c \
../file/file_posix.c \
../file/dir_posix.c \
+ ../libbluray/bdnav/extdata_parse.c \
../libbluray/bdnav/mpls_parse.c \
../libbluray/bdnav/clpi_parse.c \
../libbluray/bdnav/navigation.c
@@ -39,6 +40,7 @@ clpi_dump_SOURCES = \
clpi_dump.c util.c util.h \
../util/logging.c \
../file/file_posix.c \
+ ../libbluray/bdnav/extdata_parse.c \
../libbluray/bdnav/clpi_parse.c
sound_dump_SOURCES = \
diff --git a/src/examples/clpi_dump.c b/src/examples/clpi_dump.c
index 35ed4fe..f949aab 100644
--- a/src/examples/clpi_dump.c
+++ b/src/examples/clpi_dump.c
@@ -259,6 +259,27 @@ _show_prog_info(CLPI_PROG_INFO *pi, int level)
}
static void
+_show_extent_start(CLPI_EXTENT_START *es, int level)
+{
+ unsigned int ii;
+
+ indent_printf(level, "Extension data: Extent Start Point");
+
+ if (!es->num_point) {
+ indent_printf(level+1, "(no data)");
+
+ } else {
+ indent_printf(level+1, "Number of Start Points: %d", es->num_point);
+
+ if (verbose) {
+ for (ii = 0; ii < es->num_point; ii++) {
+ indent_printf(level+1, "Extent %5d: SPN 0x%08X", ii, es->point[ii]);
+ }
+ }
+ }
+}
+
+static void
_show_cpi_info(CLPI_CPI *cpi, int level)
{
CLPI_EP_MAP_ENTRY *entry;
@@ -336,12 +357,13 @@ _usage(char *cmd)
" s - Shows the Sequence Info structure\n"
" p - Shows the Program Info structure\n"
" i - Shows the CPI. PTS to SPN map\n"
+" e - Shows Extent Start Table\n"
, cmd);
exit(EXIT_FAILURE);
}
-#define OPTS "vcspi"
+#define OPTS "vcspie"
int
main(int argc, char *argv[])
@@ -349,7 +371,7 @@ main(int argc, char *argv[])
CLPI_CL *cl;
int opt;
int opt_clip_info = 0, opt_seq_info = 0, opt_prog_info = 0;
- int opt_cpi_info = 0;
+ int opt_cpi_info = 0, opt_extent_start = 0;
int ii;
do {
@@ -377,6 +399,10 @@ main(int argc, char *argv[])
opt_prog_info = 1;
break;
+ case 'e':
+ opt_extent_start = 1;
+ break;
+
default:
_usage(argv[0]);
break;
@@ -409,6 +435,13 @@ main(int argc, char *argv[])
// Show cpi
_show_cpi_info(&cl->cpi, 1);
}
+ if (opt_extent_start) {
+ // Show extent start point
+ if (cl->extent_start.num_point > 0) {
+ _show_extent_start(&cl->extent_start, 1);
+ }
+ }
+
clpi_free(cl);
}
return 0;
diff --git a/src/libbluray/bdnav/clpi_data.h b/src/libbluray/bdnav/clpi_data.h
index 1cf8b95..6d36018 100644
--- a/src/libbluray/bdnav/clpi_data.h
+++ b/src/libbluray/bdnav/clpi_data.h
@@ -130,6 +130,12 @@ typedef struct
CLPI_EP_MAP_ENTRY *entry;
} CLPI_CPI;
+/* Extent start points (profile 5 / version 2.4) */
+typedef struct {
+ uint32_t num_point;
+ uint32_t *point;
+} CLPI_EXTENT_START;
+
typedef struct clpi_cl {
uint32_t type_indicator;
uint32_t type_indicator2;
@@ -143,6 +149,11 @@ typedef struct clpi_cl {
CLPI_PROG_INFO program;
CLPI_CPI cpi;
// skip clip mark & extension data
+
+ // extensions for 3D
+
+ CLPI_EXTENT_START extent_start; /* extent start points (.ssif interleaving) */
+
} CLPI_CL;
#endif // _CLPI_DATA_H_
diff --git a/src/libbluray/bdnav/clpi_parse.c b/src/libbluray/bdnav/clpi_parse.c
index 43d9e2e..16a81e7 100644
--- a/src/libbluray/bdnav/clpi_parse.c
+++ b/src/libbluray/bdnav/clpi_parse.c
@@ -20,6 +20,7 @@
#include "util/macro.h"
#include "file/file.h"
#include "util/bits.h"
+#include "extdata_parse.h"
#include "clpi_parse.h"
#include <stdlib.h>
@@ -532,6 +533,37 @@ clpi_access_point(const CLPI_CL *cl, uint32_t pkt, int next, int angle_change, u
return coarse_spn + entry->fine[jj].spn_ep;
}
+static int
+_parse_extent_start_points(BITSTREAM *bits, CLPI_EXTENT_START *es)
+{
+ unsigned int ii;
+
+ bs_skip(bits, 32); // length
+ es->num_point = bs_read(bits, 32);
+
+ es->point = malloc(es->num_point * sizeof(uint32_t));
+
+ for (ii = 0; ii < es->num_point; ii++) {
+ es->point[ii] = bs_read(bits, 32);
+ }
+
+ return 1;
+}
+
+static int _parse_clpi_extension(BITSTREAM *bits, int id1, int id2, void *handle)
+{
+ CLPI_CL *cl = handle;
+
+ if (id1 == 2) {
+ if (id2 == 4) {
+ // Extent start point
+ return _parse_extent_start_points(bits, &cl->extent_start);
+ }
+ }
+
+ return 0;
+}
+
void
clpi_free(CLPI_CL *cl)
{
@@ -572,6 +604,9 @@ clpi_free(CLPI_CL *cl)
if (cl->cpi.entry != NULL) {
X_FREE(cl->cpi.entry);
}
+
+ X_FREE(cl->extent_start.point);
+
X_FREE(cl);
}
@@ -602,6 +637,14 @@ _clpi_parse(const char *path, int verbose)
clpi_free(cl);
return NULL;
}
+
+ if (cl->ext_data_start_addr > 0) {
+ bdmv_parse_extension_data(&bits,
+ cl->ext_data_start_addr,
+ _parse_clpi_extension,
+ cl);
+ }
+
if (!_parse_clipinfo(&bits, cl)) {
file_close(fp);
clpi_free(cl);
More information about the libbluray-devel
mailing list