Skip to content

Commit ee692b1

Browse files
author
Robert McNamara
committed
libmythbluray: Lots of upstream updates.
I hadn't realized I hadn't committed the last set, so now it's two full sets of updates. Covers d1398c1a6c86aebb78a1dafd319f5fa6f3df4b4 (5-4-11) through 6ee2766038e90731683272e348aaa2aa9d5d199 (5-14-11).
1 parent 0bddcdb commit ee692b1

File tree

19 files changed

+234
-143
lines changed

19 files changed

+234
-143
lines changed

mythtv/libs/libmythbluray/bdnav/meta_parse.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,12 @@
3131

3232
#include <stdlib.h>
3333
#include <string.h>
34-
#include <strings.h>
3534
#include <errno.h>
3635

36+
#ifdef HAVE_STRINGS_H
37+
#include <strings.h>
38+
#endif
39+
3740
#ifdef HAVE_LIBXML2
3841
#include <libxml/parser.h>
3942
#include <libxml/xmlmemory.h>
@@ -114,6 +117,7 @@ static void _findMetaXMLfiles(META_ROOT *meta, const char *device_path)
114117
meta->dl_entries[i].filename = str_printf("%s", ent.d_name);
115118
strncpy(meta->dl_entries[i].language_code, ent.d_name+5,3);
116119
meta->dl_entries[i].language_code[3] = '\0';
120+
str_tolower(meta->dl_entries[i].language_code);
117121
}
118122
}
119123
dir_close(dir);
@@ -187,15 +191,15 @@ META_DL *meta_get(META_ROOT *meta_root, const char *language_code)
187191

188192
if (language_code) {
189193
for (i = 0; i < meta_root->dl_count; i++) {
190-
if (strcasecmp(language_code, meta_root->dl_entries[i].language_code) == 0) {
194+
if (strcmp(language_code, meta_root->dl_entries[i].language_code) == 0) {
191195
return &meta_root->dl_entries[i];
192196
}
193197
}
194198
BD_DEBUG(DBG_DIR, "requested disclib language '%s' not found\n", language_code);
195199
}
196200

197201
for (i = 0; i < meta_root->dl_count; i++) {
198-
if (strcasecmp(DEFAULT_LANGUAGE, meta_root->dl_entries[i].language_code) == 0) {
202+
if (strcmp(DEFAULT_LANGUAGE, meta_root->dl_entries[i].language_code) == 0) {
199203
BD_DEBUG(DBG_DIR, "using default disclib language '"DEFAULT_LANGUAGE"'\n");
200204
return &meta_root->dl_entries[i];
201205
}

mythtv/libs/libmythbluray/bdnav/navigation.c

Lines changed: 22 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,7 @@ _extrapolate_title(NAV_TITLE *title)
388388
static void _fill_clip(NAV_TITLE *title,
389389
MPLS_CLIP *mpls_clip,
390390
uint8_t connection_condition, uint32_t in_time, uint32_t out_time,
391+
unsigned pi_angle_count,
391392
NAV_CLIP *clip,
392393
unsigned ref, uint32_t *pos, uint32_t *time)
393394

@@ -396,13 +397,20 @@ static void _fill_clip(NAV_TITLE *title,
396397

397398
clip->title = title;
398399
clip->ref = ref;
399-
clip->angle = 0;
400+
401+
if (title->angle >= pi_angle_count) {
402+
clip->angle = 0;
403+
} else {
404+
clip->angle = title->angle;
405+
}
406+
400407
strncpy(clip->name, mpls_clip[clip->angle].clip_id, 5);
401408
strncpy(&clip->name[5], ".m2ts", 6);
402409
clip->clip_id = atoi(mpls_clip[clip->angle].clip_id);
403410

404411
path = str_printf("%s"DIR_SEP"BDMV"DIR_SEP"CLIPINF"DIR_SEP"%s.clpi",
405412
title->root, mpls_clip[clip->angle].clip_id);
413+
clpi_free(clip->cl);
406414
clip->cl = clpi_parse(path, 0);
407415
X_FREE(path);
408416
if (clip->cl == NULL) {
@@ -432,7 +440,7 @@ static void _fill_clip(NAV_TITLE *title,
432440
*time += clip->out_time - clip->in_time;
433441
}
434442

435-
NAV_TITLE* nav_title_open(const char *root, const char *playlist)
443+
NAV_TITLE* nav_title_open(const char *root, const char *playlist, unsigned angle)
436444
{
437445
NAV_TITLE *title = NULL;
438446
char *path;
@@ -451,7 +459,7 @@ NAV_TITLE* nav_title_open(const char *root, const char *playlist)
451459
path = str_printf("%s" DIR_SEP "BDMV" DIR_SEP "PLAYLIST" DIR_SEP "%s",
452460
root, playlist);
453461
title->angle_count = 0;
454-
title->angle = 0;
462+
title->angle = angle;
455463
title->pl = mpls_parse(path, 0);
456464
if (title->pl == NULL) {
457465
BD_DEBUG(DBG_NAV, "Fail: Playlist parse %s\n", path);
@@ -472,7 +480,8 @@ NAV_TITLE* nav_title_open(const char *root, const char *playlist)
472480

473481
clip = &title->clip_list.clip[ii];
474482

475-
_fill_clip(title, pi->clip, pi->connection_condition, pi->in_time, pi->out_time, clip, ii, &pos, &time);
483+
_fill_clip(title, pi->clip, pi->connection_condition, pi->in_time, pi->out_time, pi->angle_count,
484+
clip, ii, &pos, &time);
476485
}
477486

478487
// sub paths
@@ -493,7 +502,8 @@ NAV_TITLE* nav_title_open(const char *root, const char *playlist)
493502
MPLS_SUB_PI *pi = &title->pl->sub_path[ss].sub_play_item[ii];
494503
NAV_CLIP *clip = &sub_path->clip_list.clip[ii];
495504

496-
_fill_clip(title, pi->clip, pi->connection_condition, pi->in_time, pi->out_time, clip, ii, &pos, &time);
505+
_fill_clip(title, pi->clip, pi->connection_condition, pi->in_time, pi->out_time, 0,
506+
clip, ii, &pos, &time);
497507
}
498508
}
499509
}
@@ -511,6 +521,11 @@ NAV_TITLE* nav_title_open(const char *root, const char *playlist)
511521
title->mark_list.mark = calloc(title->pl->mark_count, sizeof(NAV_MARK));
512522

513523
_extrapolate_title(title);
524+
525+
if (title->angle >= title->angle_count) {
526+
title->angle = 0;
527+
}
528+
514529
return title;
515530
}
516531

@@ -744,7 +759,6 @@ NAV_CLIP* nav_next_clip(NAV_TITLE *title, NAV_CLIP *clip)
744759

745760
NAV_CLIP* nav_set_angle(NAV_TITLE *title, NAV_CLIP *clip, unsigned angle)
746761
{
747-
char *path;
748762
int ii;
749763
uint32_t pos = 0;
750764
uint32_t time = 0;
@@ -770,48 +784,9 @@ NAV_CLIP* nav_set_angle(NAV_TITLE *title, NAV_CLIP *clip, unsigned angle)
770784

771785
pi = &title->pl->play_item[ii];
772786
clip = &title->clip_list.clip[ii];
773-
if (title->angle >= pi->angle_count) {
774-
clip->angle = 0;
775-
} else {
776-
clip->angle = title->angle;
777-
}
778-
779-
clpi_free(clip->cl);
780-
781-
clip->ref = ii;
782-
strncpy(clip->name, pi->clip[clip->angle].clip_id, 5);
783-
strncpy(&clip->name[5], ".m2ts", 6);
784-
clip->clip_id = atoi(pi->clip[clip->angle].clip_id);
785787

786-
path = str_printf("%s"DIR_SEP"BDMV"DIR_SEP"CLIPINF"DIR_SEP"%s.clpi",
787-
title->root, pi->clip[clip->angle].clip_id);
788-
clip->cl = clpi_parse(path, 0);
789-
X_FREE(path);
790-
if (clip->cl == NULL) {
791-
clip->start_pkt = 0;
792-
clip->end_pkt = 0;
793-
continue;
794-
}
795-
switch (pi->connection_condition) {
796-
case 5:
797-
case 6:
798-
clip->start_pkt = 0;
799-
clip->connection = CONNECT_SEAMLESS;
800-
break;
801-
default:
802-
clip->start_pkt = clpi_lookup_spn(clip->cl, pi->in_time, 1,
803-
pi->clip[clip->angle].stc_id);
804-
clip->connection = CONNECT_NON_SEAMLESS;
805-
break;
806-
}
807-
clip->end_pkt = clpi_lookup_spn(clip->cl, pi->out_time, 0,
808-
pi->clip[clip->angle].stc_id);
809-
clip->in_time = pi->in_time;
810-
clip->out_time = pi->out_time;
811-
clip->pos = pos;
812-
pos += clip->end_pkt - clip->start_pkt;
813-
clip->start_time = time;
814-
time += clip->out_time - clip->in_time;
788+
_fill_clip(title, pi->clip, pi->connection_condition, pi->in_time, pi->out_time, pi->angle_count,
789+
clip, ii, &pos, &time);
815790
}
816791
_extrapolate_title(title);
817792
return clip;

mythtv/libs/libmythbluray/bdnav/navigation.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ struct nav_title_list_s
141141

142142
BD_PRIVATE uint8_t nav_lookup_aspect(NAV_CLIP *clip, int pid);
143143
BD_PRIVATE char* nav_find_main_title(const char *root);
144-
BD_PRIVATE NAV_TITLE* nav_title_open(const char *root, const char *playlist);
144+
BD_PRIVATE NAV_TITLE* nav_title_open(const char *root, const char *playlist, unsigned angle);
145145
BD_PRIVATE void nav_title_close(NAV_TITLE *title);
146146
BD_PRIVATE NAV_CLIP* nav_next_clip(NAV_TITLE *title, NAV_CLIP *clip);
147147
BD_PRIVATE NAV_CLIP* nav_packet_search(NAV_TITLE *title, uint32_t pkt, uint32_t *clip_pkt,

mythtv/libs/libmythbluray/bdnav/uo_mask_table.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ static inline BD_UO_MASK bd_uo_mask_combine(BD_UO_MASK a, BD_UO_MASK b)
6767
unsigned i;
6868

6969
for (i = 0; i < sizeof(BD_UO_MASK); i++) {
70-
po[i] = pa[i] & pb[i];
70+
po[i] = pa[i] | pb[i];
7171
}
7272

7373
return o;

mythtv/libs/libmythbluray/bluray.c

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ typedef struct {
8181
/* current aligned unit */
8282
uint16_t int_buf_off;
8383

84+
BD_UO_MASK uo_mask;
85+
8486
} BD_STREAM;
8587

8688
typedef struct {
@@ -297,6 +299,9 @@ static void _close_m2ts(BD_STREAM *st)
297299
file_close(st->fp);
298300
st->fp = NULL;
299301
}
302+
303+
/* reset UO mask */
304+
memset(&st->uo_mask, 0, sizeof(st->uo_mask));
300305
}
301306

302307
static int _open_m2ts(BLURAY *bd, BD_STREAM *st)
@@ -340,6 +345,10 @@ static int _open_m2ts(BLURAY *bd, BD_STREAM *st)
340345
}
341346

342347
if (st == &bd->st0) {
348+
MPLS_PL *pl = st->clip->title->pl;
349+
st->uo_mask = bd_uo_mask_combine(pl->app_info.uo_mask,
350+
pl->play_item[st->clip->ref].uo_mask);
351+
343352
_update_clip_psrs(bd, st->clip);
344353
}
345354

@@ -750,7 +759,8 @@ static int _libbdplus_open(BLURAY *bd, const char *keyfile_path)
750759
return 0;
751760
}
752761

753-
bd->bdplus = bd->bdplus_init(bd->device_path, keyfile_path, _libaacs_get_vid(bd) ?: vid);
762+
const uint8_t *aacs_vid = (const uint8_t *)_libaacs_get_vid(bd);
763+
bd->bdplus = bd->bdplus_init(bd->device_path, keyfile_path, aacs_vid ? aacs_vid : vid);
754764

755765
if (bd->bdplus) {
756766
BD_DEBUG(DBG_BLURAY,"libbdplus initialized\n");
@@ -1311,11 +1321,11 @@ static void _close_playlist(BLURAY *bd)
13111321
}
13121322
}
13131323

1314-
static int _open_playlist(BLURAY *bd, const char *f_name)
1324+
static int _open_playlist(BLURAY *bd, const char *f_name, unsigned angle)
13151325
{
13161326
_close_playlist(bd);
13171327

1318-
bd->title = nav_title_open(bd->device_path, f_name);
1328+
bd->title = nav_title_open(bd->device_path, f_name, angle);
13191329
if (bd->title == NULL) {
13201330
BD_DEBUG(DBG_BLURAY | DBG_CRIT, "Unable to open title %s! (%p)\n",
13211331
f_name, bd);
@@ -1359,7 +1369,7 @@ int bd_select_playlist(BLURAY *bd, uint32_t playlist)
13591369
}
13601370
}
13611371

1362-
result = _open_playlist(bd, f_name);
1372+
result = _open_playlist(bd, f_name, 0);
13631373

13641374
X_FREE(f_name);
13651375
return result;
@@ -1385,7 +1395,7 @@ int bd_select_title(BLURAY *bd, uint32_t title_idx)
13851395
bd->title_idx = title_idx;
13861396
f_name = bd->title_list->title_info[title_idx].name;
13871397

1388-
return _open_playlist(bd, f_name);
1398+
return _open_playlist(bd, f_name, 0);
13891399
}
13901400

13911401
uint32_t bd_get_current_title(BLURAY *bd)
@@ -1535,7 +1545,7 @@ static BLURAY_TITLE_INFO *_get_title_info(BLURAY *bd, uint32_t title_idx, uint32
15351545
NAV_TITLE *title;
15361546
BLURAY_TITLE_INFO *title_info;
15371547

1538-
title = nav_title_open(bd->device_path, mpls_name);
1548+
title = nav_title_open(bd->device_path, mpls_name, 0);
15391549
if (title == NULL) {
15401550
BD_DEBUG(DBG_BLURAY | DBG_CRIT, "Unable to open title %s! (%p)\n",
15411551
mpls_name, bd);
@@ -1924,6 +1934,11 @@ int bd_play_title(BLURAY *bd, unsigned title)
19241934
return 0;
19251935
}
19261936

1937+
if (bd->st0.uo_mask.title_search) {
1938+
BD_DEBUG(DBG_BLURAY|DBG_CRIT, "title search masked by stream\n");
1939+
return 0;
1940+
}
1941+
19271942
if (bd->title_type == title_hdmv) {
19281943
if (hdmv_vm_get_uo_mask(bd->hdmv_vm) & HDMV_TITLE_SEARCH_MASK) {
19291944
BD_DEBUG(DBG_BLURAY|DBG_CRIT, "title search masked by movie object\n");
@@ -1945,6 +1960,11 @@ int bd_menu_call(BLURAY *bd, int64_t pts)
19451960
return 0;
19461961
}
19471962

1963+
if (bd->st0.uo_mask.menu_call) {
1964+
BD_DEBUG(DBG_BLURAY|DBG_CRIT, "menu call masked by stream\n");
1965+
return 0;
1966+
}
1967+
19481968
if (bd->title_type == title_hdmv) {
19491969
if (hdmv_vm_get_uo_mask(bd->hdmv_vm) & HDMV_MENU_CALL_MASK) {
19501970
BD_DEBUG(DBG_BLURAY|DBG_CRIT, "menu call masked by movie object\n");
@@ -2028,7 +2048,6 @@ static void _process_hdmv_vm_event(BLURAY *bd, HDMV_EVENT *hev)
20282048
break;
20292049

20302050
case HDMV_EVENT_IG_END:
2031-
BD_DEBUG(DBG_BLURAY|DBG_CRIT, "HDMV_EVENT_IG_END\n");
20322051
_run_gc(bd, GC_CTRL_IG_END, 0);
20332052
break;
20342053

0 commit comments

Comments
 (0)