Commit cc8dd612 authored by hpi1's avatar hpi1

Added index_dump: parse and print contents of index.bdmv

parent 74a98791
......@@ -2,7 +2,7 @@
# Set this for all builds, or use $bin_CPPFLAGS for individual
AM_CPPFLAGS = -I$(top_builddir)/src
bin_PROGRAMS=bdplus_test bdsplice mpls_dump clpi_dump libbluray_test
bin_PROGRAMS=bdplus_test bdsplice mpls_dump clpi_dump index_dump libbluray_test
bdplus_test_SOURCE=bdplus_test.c
......@@ -26,6 +26,11 @@ clpi_dump_SOURCES = \
clpi_dump_LDADD = $(BDNAV_LIB)
index_dump_SOURCES = \
index_dump.c
index_dump_LDADD = $(BDNAV_LIB)
libbluray_test_SOURCES = \
libbluray_test.c
......
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#include "../src/libbdnav/index_parse.h"
static void _indx_print_app_info(INDX_APP_INFO *app_info)
{
const char video_format_str[16][8] = {
"ignored", "480i", "576i", "480p", "1080i", "720p", "1080p", "576p"
};
const char frame_rate_str[16][16] = {
"ignored",
"23.976 Hz",
"24 Hz",
"25 Hz",
"29.97 Hz",
"reserved",
"50 Hz",
"59.94 Hz"
};
printf(" initial mode : %s\n", app_info->initial_output_mode_preference ? "3D" : "2D");
printf(" content exists: %s\n", app_info->content_exist_flag ? "Yes" : "No");
printf(" video format : %s (0x%x)\n", video_format_str[app_info->video_format], app_info->video_format);
printf(" frame rate : %s (0x%x)\n", frame_rate_str[app_info->frame_rate], app_info->frame_rate);
printf(" provider data : %32s\n", app_info->user_data);
}
static void _indx_print_hdmv_obj(INDX_HDMV_OBJ *hdmv)
{
const char *const playback_types[] = {"Movie", "Interactive", "???", "???"};
printf(" object type : HDMV\n");
printf(" playback type : %s\n", playback_types[hdmv->playback_type]);
printf(" id_ref : %u\n", hdmv->id_ref);
}
static void _indx_print_bdj_obj(INDX_BDJ_OBJ *bdj)
{
const char * const playback_types[] = {"???", "???", "Movie", "Interactive"};
printf(" object type : BD-J\n");
printf(" playback type : %s\n", playback_types[bdj->playback_type]);
printf(" name : %s\n", bdj->name);
}
static void _indx_print_play_item(INDX_PLAY_ITEM *title)
{
if (title->object_type == 1) {
_indx_print_hdmv_obj(&title->hdmv);
} else {
_indx_print_bdj_obj(&title->bdj);
}
}
static void _indx_print_title(INDX_TITLE *title)
{
if (title->object_type == 1) {
_indx_print_hdmv_obj(&title->hdmv);
} else {
_indx_print_bdj_obj(&title->bdj);
}
printf(" access type : %d\n", title->access_type);
}
static void _indx_print(INDX_ROOT *index)
{
uint32_t i;
printf("Application info:\n");
_indx_print_app_info(&index->app_info);
printf("\nFirst playback:\n");
_indx_print_play_item(&index->first_play);
printf("\nTop menu:\n");
_indx_print_play_item(&index->top_menu);
printf("\nTitles: %d\n", index->num_titles);
for (i = 0; i < index->num_titles; i++) {
printf("%02d", i);
_indx_print_title(&index->titles[i]);
}
}
int main(int argc, const char *argv[])
{
char file[1024];
INDX_ROOT *index;
if (argc != 2) {
fprintf(stderr, "usage: %s <disc_root>\n", argv[0]);
return 1;
}
sprintf(file, "%s/BDMV/index.bdmv", argv[1]);
index = indx_parse(file);
if (index) {
_indx_print(index);
indx_free(index);
}
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment