1
0
Fork 0

Detect Dolby Vision streams in playlist

This commit is contained in:
rapperskull 2020-04-26 23:15:52 +02:00 committed by hpi1
parent 483c5b0b2f
commit fb8f2b4729
2 changed files with 23 additions and 3 deletions

View File

@ -58,12 +58,14 @@ typedef struct
uint8_t num_secondary_audio;
uint8_t num_secondary_video;
uint8_t num_pip_pg;
uint8_t num_dv;
MPLS_STREAM *video;
MPLS_STREAM *audio;
MPLS_STREAM *pg;
MPLS_STREAM *ig;
MPLS_STREAM *secondary_audio;
MPLS_STREAM *secondary_video;
MPLS_STREAM *dv;
} MPLS_STN;
typedef struct

View File

@ -130,13 +130,13 @@ _parse_stream(BITSTREAM *bits, MPLS_STREAM *s)
break;
case 2:
case 4:
s->subpath_id = bs_read(bits, 8);
s->subclip_id = bs_read(bits, 8);
s->pid = bs_read(bits, 16);
break;
case 3:
case 4:
s->subpath_id = bs_read(bits, 8);
s->pid = bs_read(bits, 16);
break;
@ -229,9 +229,10 @@ _parse_stn(BITSTREAM *bits, MPLS_STN *stn)
stn->num_secondary_audio = bs_read(bits, 8);
stn->num_secondary_video = bs_read(bits, 8);
stn->num_pip_pg = bs_read(bits, 8);
stn->num_dv = bs_read(bits, 8);
// 5 reserve bytes
bs_skip(bits, 5 * 8);
// 4 reserve bytes
bs_skip(bits, 4 * 8);
// Primary Video Streams
ss = NULL;
@ -377,6 +378,23 @@ _parse_stn(BITSTREAM *bits, MPLS_STN *stn)
}
}
// Dolby Vision Enhancement Layer Streams
ss = NULL;
if (stn->num_dv) {
ss = calloc(stn->num_dv, sizeof(MPLS_STREAM));
if (!ss) {
return 0;
}
for (ii = 0; ii < stn->num_dv; ii++) {
if (!_parse_stream(bits, &ss[ii])) {
X_FREE(ss);
BD_DEBUG(DBG_NAV | DBG_CRIT, "error parsing dv entry\n");
return 0;
}
}
}
stn->dv = ss;
if (bs_seek_byte(bits, pos + len) < 0) {
return 0;
}