[libbluray-devel] commit: add aspect ratio to BLURAY_STREAM_INFO (john )
git at videolan.org
git at videolan.org
Sat Sep 4 00:28:59 CEST 2010
libbluray | branch: master | john <john at anonymous.org> | Fri Sep 3 15:18:02 2010 -0700| [0b0f94673eb53256427b5cf49950bde258941198] | committer: john
add aspect ratio to BLURAY_STREAM_INFO
> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=0b0f94673eb53256427b5cf49950bde258941198
---
src/libbluray/bdnav/navigation.c | 18 ++++++++++++++++++
src/libbluray/bdnav/navigation.h | 1 +
src/libbluray/bluray.c | 20 ++++++++++++--------
src/libbluray/bluray.h | 2 ++
4 files changed, 33 insertions(+), 8 deletions(-)
diff --git a/src/libbluray/bdnav/navigation.c b/src/libbluray/bdnav/navigation.c
index 454aba7..eb574e0 100644
--- a/src/libbluray/bdnav/navigation.c
+++ b/src/libbluray/bdnav/navigation.c
@@ -275,6 +275,24 @@ char* nav_find_main_title(const char *root)
}
}
+uint8_t nav_lookup_aspect(NAV_CLIP *clip, int pid)
+{
+ CLPI_PROG *progs;
+ int ii, jj;
+
+ progs = clip->cl->program.progs;
+ for (ii = 0; ii < clip->cl->program.num_prog; ii++) {
+ CLPI_PROG_STREAM *ps = progs[ii].streams;
+ for (jj = 0; jj < progs[ii].num_streams; jj++) {
+ if (ps[jj].pid == pid)
+ {
+ return ps[jj].aspect;
+ }
+ }
+ }
+ return 0;
+}
+
static void
_fill_mark(NAV_TITLE *title, NAV_MARK *mark, int entry)
{
diff --git a/src/libbluray/bdnav/navigation.h b/src/libbluray/bdnav/navigation.h
index 3c5b6e0..88caa56 100644
--- a/src/libbluray/bdnav/navigation.h
+++ b/src/libbluray/bdnav/navigation.h
@@ -135,6 +135,7 @@ struct nav_title_list_s
NAV_TITLE_INFO *title_info;
};
+BD_PRIVATE uint8_t nav_lookup_aspect(NAV_CLIP *clip, int pid);
BD_PRIVATE char* nav_find_main_title(const char *root);
BD_PRIVATE NAV_TITLE* nav_title_open(const char *root, const char *playlist);
BD_PRIVATE void nav_title_close(NAV_TITLE *title);
diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c
index f0dd9a6..ffebf5c 100644
--- a/src/libbluray/bluray.c
+++ b/src/libbluray/bluray.c
@@ -956,7 +956,7 @@ uint32_t bd_get_titles(BLURAY *bd, uint8_t flags)
return bd->title_list->count;
}
-static void _copy_streams(BLURAY_STREAM_INFO *streams, MPLS_STREAM *si, int count)
+static void _copy_streams(NAV_CLIP *clip, BLURAY_STREAM_INFO *streams, MPLS_STREAM *si, int count)
{
int ii;
@@ -967,6 +967,7 @@ static void _copy_streams(BLURAY_STREAM_INFO *streams, MPLS_STREAM *si, int coun
streams[ii].char_code = si[ii].char_code;
memcpy(streams[ii].lang, si[ii].lang, 4);
streams[ii].pid = si[ii].pid;
+ streams[ii].aspect = nav_lookup_aspect(clip, si[ii].pid);
}
}
@@ -986,13 +987,16 @@ static BLURAY_TITLE_INFO* _fill_title_info(NAV_TITLE* title, uint32_t title_idx,
title_info->chapters[ii].idx = ii;
title_info->chapters[ii].start = (uint64_t)title->chap_list.mark[ii].title_time * 2;
title_info->chapters[ii].duration = (uint64_t)title->chap_list.mark[ii].duration * 2;
- title_info->chapters[ii].offset = (uint64_t)title->chap_list.mark[ii].title_pkt * 192;
+ title_info->chapters[ii].offset = (uint64_t)title->chap_list.mark[ii].title_pkt * 192L;
}
title_info->clip_count = title->clip_list.count;
title_info->clips = calloc(title_info->clip_count, sizeof(BLURAY_CLIP_INFO));
for (ii = 0; ii < title_info->clip_count; ii++) {
MPLS_PI *pi = &title->pl->play_item[ii];
BLURAY_CLIP_INFO *ci = &title_info->clips[ii];
+ NAV_CLIP *nc = &title->clip_list.clip[ii];
+
+ ci->pkt_count = nc->end_pkt - nc->start_pkt;
ci->video_stream_count = pi->stn.num_video;
ci->audio_stream_count = pi->stn.num_audio;
ci->pg_stream_count = pi->stn.num_pg + pi->stn.num_pip_pg;
@@ -1005,12 +1009,12 @@ static BLURAY_TITLE_INFO* _fill_title_info(NAV_TITLE* title, uint32_t title_idx,
ci->ig_streams = calloc(ci->ig_stream_count, sizeof(BLURAY_STREAM_INFO));
ci->sec_video_streams = calloc(ci->sec_video_stream_count, sizeof(BLURAY_STREAM_INFO));
ci->sec_audio_streams = calloc(ci->sec_audio_stream_count, sizeof(BLURAY_STREAM_INFO));
- _copy_streams(ci->video_streams, pi->stn.video, ci->video_stream_count);
- _copy_streams(ci->audio_streams, pi->stn.audio, ci->audio_stream_count);
- _copy_streams(ci->pg_streams, pi->stn.pg, ci->pg_stream_count);
- _copy_streams(ci->ig_streams, pi->stn.ig, ci->ig_stream_count);
- _copy_streams(ci->sec_video_streams, pi->stn.secondary_video, ci->sec_video_stream_count);
- _copy_streams(ci->sec_audio_streams, pi->stn.secondary_audio, ci->sec_audio_stream_count);
+ _copy_streams(nc, ci->video_streams, pi->stn.video, ci->video_stream_count);
+ _copy_streams(nc, ci->audio_streams, pi->stn.audio, ci->audio_stream_count);
+ _copy_streams(nc, ci->pg_streams, pi->stn.pg, ci->pg_stream_count);
+ _copy_streams(nc, ci->ig_streams, pi->stn.ig, ci->ig_stream_count);
+ _copy_streams(nc, ci->sec_video_streams, pi->stn.secondary_video, ci->sec_video_stream_count);
+ _copy_streams(nc, ci->sec_audio_streams, pi->stn.secondary_audio, ci->sec_audio_stream_count);
}
return title_info;
diff --git a/src/libbluray/bluray.h b/src/libbluray/bluray.h
index d84b5f9..9d0a398 100644
--- a/src/libbluray/bluray.h
+++ b/src/libbluray/bluray.h
@@ -103,9 +103,11 @@ typedef struct bd_stream_info {
uint8_t char_code;
uint8_t lang[4];
uint16_t pid;
+ uint8_t aspect;
} BLURAY_STREAM_INFO;
typedef struct bd_clip {
+ uint32_t pkt_count;
uint8_t video_stream_count;
uint8_t audio_stream_count;
uint8_t pg_stream_count;
More information about the libbluray-devel
mailing list