[libbluray-devel] [Git][videolan/libbluray][master] 4 commits: Recognize many previously unknown fields in mpls and clpi
Petri Hintukainen
gitlab at videolan.org
Mon Jul 6 20:38:49 CEST 2020
Petri Hintukainen pushed to branch master at VideoLAN / libbluray
Commits:
72f5b928 by rapperskull at 2020-07-06T21:24:29+03:00
Recognize many previously unknown fields in mpls and clpi
- - - - -
ce3180a7 by rapperskull at 2020-07-06T21:24:29+03:00
Show cr_flag, dynamic range type, color space and HDR10+ flag for codec type 0x24 (HEVC) in clpi_dump
- - - - -
789d7e30 by rapperskull at 2020-07-06T21:24:29+03:00
Show dynamic range, color space, cr_flag and HDR10+ flag in mpls_dump
- - - - -
73fab2e2 by hpi1 at 2020-07-06T21:37:24+03:00
strncpy -> memcpy for fixed-size strings
Terminating 0 is still ensured.
Fixes build-time string truncation warnings.
- - - - -
8 changed files:
- src/devtools/clpi_dump.c
- src/devtools/mpls_dump.c
- src/devtools/strings.h
- src/libbluray/bdnav/clpi_data.h
- src/libbluray/bdnav/clpi_parse.c
- src/libbluray/bdnav/mpls_data.h
- src/libbluray/bdnav/mpls_parse.c
- src/libbluray/bdnav/navigation.c
Changes:
=====================================
src/devtools/clpi_dump.c
=====================================
@@ -72,6 +72,15 @@ _show_stream(CLPI_PROG_STREAM *ss, int level)
indent_printf(level, "Aspect %02x: %s", ss->aspect,
_lookup_str(video_aspect_map, ss->aspect));
indent_printf(level, "oc_flag %02x", ss->oc_flag);
+ if (ss->coding_type == 0x24) {
+ indent_printf(level, "cr_flag %02x", ss->cr_flag);
+ indent_printf(level, "Dynamic Range type %02x: %s", ss->dynamic_range_type,
+ _lookup_str(dynamic_range_type_map, ss->dynamic_range_type));
+ indent_printf(level, "Color Space %02x: %s", ss->color_space,
+ _lookup_str(color_space_map, ss->color_space));
+ indent_printf(level, "HDR10+ %02x: %s", ss->hdr_plus_flag,
+ ss->hdr_plus_flag ? "Yes" : "No");
+ }
break;
case 0x03:
=====================================
src/devtools/mpls_dump.c
=====================================
@@ -126,6 +126,15 @@ _show_stream(MPLS_STREAM *ss, int level)
_lookup_str(video_format_map, ss->format));
indent_printf(level, "Rate %02x: %s", ss->rate,
_lookup_str(video_rate_map, ss->rate));
+ if (ss->coding_type == 0x24) {
+ indent_printf(level, "cr_flag %02x", ss->cr_flag);
+ indent_printf(level, "Dynamic Range type %02x: %s", ss->dynamic_range_type,
+ _lookup_str(dynamic_range_type_map, ss->dynamic_range_type));
+ indent_printf(level, "Color Space %02x: %s", ss->color_space,
+ _lookup_str(color_space_map, ss->color_space));
+ indent_printf(level, "HDR10+ %02x: %s", ss->hdr_plus_flag,
+ ss->hdr_plus_flag ? "Yes" : "No");
+ }
break;
case 0x03:
=====================================
src/devtools/strings.h
=====================================
@@ -95,6 +95,19 @@ const VALUE_MAP audio_rate_map[] = {
{0, NULL}
};
+const VALUE_MAP dynamic_range_type_map[] = {
+ {0, "SDR"},
+ {1, "HDR10"},
+ {2, "Dolby Vision"},
+ {0, NULL}
+};
+
+const VALUE_MAP color_space_map[] = {
+ {1, "BT.709"},
+ {2, "BT.2020"},
+ {0, NULL}
+};
+
static inline const char *
_lookup_str(const VALUE_MAP *map, int val)
{
=====================================
src/libbluray/bdnav/clpi_data.h
=====================================
@@ -90,6 +90,11 @@ typedef struct
uint8_t oc_flag;
uint8_t char_code;
char lang[4];
+ uint8_t cr_flag;
+ uint8_t dynamic_range_type;
+ uint8_t color_space;
+ uint8_t hdr_plus_flag;
+ uint8_t isrc[12]; /* International Standard Recording Code (usually empty or all zeroes) */
} CLPI_PROG_STREAM;
typedef struct
=====================================
src/libbluray/bdnav/clpi_parse.c
=====================================
@@ -54,6 +54,7 @@ _parse_stream_attr(BITSTREAM *bits, CLPI_PROG_STREAM *ss)
pos = bs_pos(bits) >> 3;
ss->lang[0] = '\0';
+ memset(ss->isrc,'\0',12);
ss->coding_type = bs_read(bits, 8);
switch (ss->coding_type) {
case 0x01:
@@ -67,7 +68,15 @@ _parse_stream_attr(BITSTREAM *bits, CLPI_PROG_STREAM *ss)
ss->aspect = bs_read(bits, 4);
bs_skip(bits, 2);
ss->oc_flag = bs_read(bits, 1);
- bs_skip(bits, 1);
+ if (ss->coding_type == 0x24) {
+ ss->cr_flag = bs_read(bits, 1);
+ ss->dynamic_range_type = bs_read(bits, 4);
+ ss->color_space = bs_read(bits, 4);
+ ss->hdr_plus_flag = bs_read(bits, 1);
+ bs_skip(bits, 7);
+ } else {
+ bs_skip(bits, 17);
+ }
break;
case 0x03:
@@ -90,6 +99,7 @@ _parse_stream_attr(BITSTREAM *bits, CLPI_PROG_STREAM *ss)
case 0x91:
case 0xa0:
bs_read_string(bits, ss->lang, 3);
+ bs_skip(bits, 8);
break;
case 0x92:
@@ -102,6 +112,7 @@ _parse_stream_attr(BITSTREAM *bits, CLPI_PROG_STREAM *ss)
break;
};
ss->lang[3] = '\0';
+ bs_read_bytes(bits, ss->isrc, 12);
// Skip over any padding
if (bs_seek_byte(bits, pos + len) < 0) {
@@ -899,8 +910,13 @@ clpi_copy(const CLPI_CL* src_cl)
dest_cl->program.progs[ii].streams[jj].rate = src_cl->program.progs[ii].streams[jj].rate;
dest_cl->program.progs[ii].streams[jj].aspect = src_cl->program.progs[ii].streams[jj].aspect;
dest_cl->program.progs[ii].streams[jj].oc_flag = src_cl->program.progs[ii].streams[jj].oc_flag;
+ dest_cl->program.progs[ii].streams[jj].cr_flag = src_cl->program.progs[ii].streams[jj].cr_flag;
+ dest_cl->program.progs[ii].streams[jj].dynamic_range_type = src_cl->program.progs[ii].streams[jj].dynamic_range_type;
+ dest_cl->program.progs[ii].streams[jj].color_space = src_cl->program.progs[ii].streams[jj].color_space;
+ dest_cl->program.progs[ii].streams[jj].hdr_plus_flag = src_cl->program.progs[ii].streams[jj].hdr_plus_flag;
dest_cl->program.progs[ii].streams[jj].char_code = src_cl->program.progs[ii].streams[jj].char_code;
memcpy(dest_cl->program.progs[ii].streams[jj].lang,src_cl->program.progs[ii].streams[jj].lang,4);
+ memcpy(dest_cl->program.progs[ii].streams[jj].isrc,src_cl->program.progs[ii].streams[jj].isrc,12);
}
}
=====================================
src/libbluray/bdnav/mpls_data.h
=====================================
@@ -37,6 +37,10 @@ typedef struct
uint8_t subclip_id;
uint8_t format;
uint8_t rate;
+ uint8_t dynamic_range_type;
+ uint8_t color_space;
+ uint8_t cr_flag;
+ uint8_t hdr_plus_flag;
uint8_t char_code;
char lang[4];
// Secondary audio specific fields
@@ -110,6 +114,7 @@ typedef struct
uint8_t audio_mix_flag;
uint8_t lossless_bypass_flag;
uint8_t mvc_base_view_r_flag;
+ uint8_t sdr_conversion_notification_flag;
} MPLS_AI;
typedef struct
@@ -131,7 +136,8 @@ typedef enum {
//mpls_sub_path_ = 5, /* Out-of-mux Synchronous elementary streams */
mpls_sub_path_async_pip = 6, /* Out-of-mux Asynchronous Picture-in-Picture presentation */
mpls_sub_path_sync_pip = 7, /* In-mux Synchronous Picture-in-Picture presentation */
- mpls_sub_path_ss_viseo = 8, /* SS Video */
+ mpls_sub_path_ss_video = 8, /* SS Video */
+ mpls_sub_path_dv_el = 10, /* Dolby Vision Enhancement Layer */
} mpls_sub_path_type;
typedef struct
@@ -218,8 +224,8 @@ typedef struct mpls_pl
MPLS_PIP_METADATA *ext_pip_data; // pip metadata extension
// extension data (Static Metadata)
- uint8_t ext_static_metadata_count;
- MPLS_STATIC_METADATA *ext_static_metadata;
+ uint8_t ext_static_metadata_count;
+ MPLS_STATIC_METADATA *ext_static_metadata;
} MPLS_PL;
=====================================
src/libbluray/bdnav/mpls_parse.c
=====================================
@@ -79,9 +79,10 @@ _parse_appinfo(BITSTREAM *bits, MPLS_AI *ai)
ai->audio_mix_flag = bs_read(bits, 1);
ai->lossless_bypass_flag = bs_read(bits, 1);
ai->mvc_base_view_r_flag = bs_read(bits, 1);
+ ai->sdr_conversion_notification_flag = bs_read(bits, 1);
#if 0
// Reserved
- bs_skip(bits, 12);
+ bs_skip(bits, 11);
bs_seek_byte(bits, pos + len);
#endif
return 1;
@@ -163,6 +164,12 @@ _parse_stream(BITSTREAM *bits, MPLS_STREAM *s)
case 0x24:
s->format = bs_read(bits, 4);
s->rate = bs_read(bits, 4);
+ if (s->coding_type == 0x24) {
+ s->dynamic_range_type = bs_read(bits, 4);
+ s->color_space = bs_read(bits, 4);
+ s->cr_flag = bs_read(bits, 1);
+ s->hdr_plus_flag = bs_read(bits, 1);
+ }
break;
case 0x03:
@@ -1073,6 +1080,7 @@ _parse_mpls_extension(BITSTREAM *bits, int id1, int id2, void *handle)
if (id1 == 3) {
if (id2 == 5) {
+ // Static metadata extension
return _parse_static_metadata_extension(bits, pl);
}
}
=====================================
src/libbluray/bdnav/navigation.c
=====================================
@@ -480,7 +480,7 @@ NAV_TITLE_LIST* nav_get_title_list(BD_DISC *disc, uint32_t flags, uint32_t min_t
}
}
- strncpy(title_list->title_info[ii].name, ent.d_name, 11);
+ memcpy(title_list->title_info[ii].name, ent.d_name, 10);
title_list->title_info[ii].name[10] = '\0';
title_list->title_info[ii].ref = ii;
title_list->title_info[ii].mpls_id = atoi(ent.d_name);
@@ -641,8 +641,8 @@ static void _fill_clip(NAV_TITLE *title,
clip->angle = title->angle;
}
- strncpy(clip->name, mpls_clip[clip->angle].clip_id, 5);
- strncpy(&clip->name[5], ".m2ts", 6);
+ memcpy(clip->name, mpls_clip[clip->angle].clip_id, 5);
+ memcpy(&clip->name[5], ".m2ts", 6);
clip->clip_id = atoi(mpls_clip[clip->angle].clip_id);
clpi_free(&clip->cl);
View it on GitLab: https://code.videolan.org/videolan/libbluray/-/compare/a3fbfe66b078a98e3f538914593f47ffa9550f11...73fab2e278f3da5214c357830976efcb9fda3767
--
View it on GitLab: https://code.videolan.org/videolan/libbluray/-/compare/a3fbfe66b078a98e3f538914593f47ffa9550f11...73fab2e278f3da5214c357830976efcb9fda3767
You're receiving this email because of your account on code.videolan.org.
More information about the libbluray-devel
mailing list