demux_mkv: cosmetics

This commit is contained in:
wm4 2014-07-05 16:42:03 +02:00
parent e21ecaa18d
commit 44d7499190
1 changed files with 27 additions and 45 deletions

View File

@ -461,13 +461,11 @@ static void parse_trackaudio(struct demuxer *demuxer, struct mkv_track *track,
}
if (audio->n_bit_depth) {
track->a_bps = audio->bit_depth;
MP_VERBOSE(demuxer, "| + Bit depth: %u\n",
track->a_bps);
MP_VERBOSE(demuxer, "| + Bit depth: %u\n", track->a_bps);
}
if (audio->n_channels) {
track->a_channels = audio->channels;
MP_VERBOSE(demuxer, "| + Channels: %u\n",
track->a_channels);
MP_VERBOSE(demuxer, "| + Channels: %u\n", track->a_channels);
} else {
track->a_channels = 1;
}
@ -478,38 +476,33 @@ static void parse_trackvideo(struct demuxer *demuxer, struct mkv_track *track,
{
if (video->n_frame_rate) {
track->v_frate = video->frame_rate;
MP_VERBOSE(demuxer, "| + Frame rate: %f\n",
track->v_frate);
MP_VERBOSE(demuxer, "| + Frame rate: %f\n", track->v_frate);
if (track->v_frate > 0)
track->default_duration = 1 / track->v_frate;
}
if (video->n_display_width) {
track->v_dwidth = video->display_width;
track->v_dwidth_set = true;
MP_VERBOSE(demuxer, "| + Display width: %u\n",
track->v_dwidth);
MP_VERBOSE(demuxer, "| + Display width: %u\n", track->v_dwidth);
}
if (video->n_display_height) {
track->v_dheight = video->display_height;
track->v_dheight_set = true;
MP_VERBOSE(demuxer, "| + Display height: %u\n",
track->v_dheight);
MP_VERBOSE(demuxer, "| + Display height: %u\n", track->v_dheight);
}
if (video->n_pixel_width) {
track->v_width = video->pixel_width;
MP_VERBOSE(demuxer, "| + Pixel width: %u\n",
track->v_width);
MP_VERBOSE(demuxer, "| + Pixel width: %u\n", track->v_width);
}
if (video->n_pixel_height) {
track->v_height = video->pixel_height;
MP_VERBOSE(demuxer, "| + Pixel height: %u\n",
track->v_height);
MP_VERBOSE(demuxer, "| + Pixel height: %u\n", track->v_height);
}
if (video->n_colour_space && video->colour_space.len == 4) {
uint8_t *d = (uint8_t *)&video->colour_space.start[0];
track->colorspace = d[0] | (d[1] << 8) | (d[2] << 16) | (d[3] << 24);
MP_VERBOSE(demuxer, "| + Colorspace: %#x\n",
(unsigned int)track->colorspace);
(unsigned int)track->colorspace);
}
}
@ -533,8 +526,7 @@ static void parse_trackentry(struct demuxer *demuxer,
track->tnum = entry->track_number;
if (track->tnum) {
MP_VERBOSE(demuxer, "| + Track number: %u\n",
track->tnum);
MP_VERBOSE(demuxer, "| + Track number: %u\n", track->tnum);
} else {
MP_ERR(demuxer, "Missing track number!\n");
}
@ -542,8 +534,7 @@ static void parse_trackentry(struct demuxer *demuxer,
if (entry->n_name) {
track->name = talloc_strndup(track, entry->name.start,
entry->name.len);
MP_VERBOSE(demuxer, "| + Name: %s\n",
track->name);
MP_VERBOSE(demuxer, "| + Name: %s\n", track->name);
}
track->type = entry->track_type;
@ -579,8 +570,7 @@ static void parse_trackentry(struct demuxer *demuxer,
if (!strcmp(track->codec_id, MKV_V_MSCOMP)
|| !strcmp(track->codec_id, MKV_A_ACM))
track->ms_compat = 1;
MP_VERBOSE(demuxer, "| + Codec ID: %s\n",
track->codec_id);
MP_VERBOSE(demuxer, "| + Codec ID: %s\n", track->codec_id);
} else {
MP_ERR(demuxer, "Missing codec ID!\n");
track->codec_id = "";
@ -591,23 +581,20 @@ static void parse_trackentry(struct demuxer *demuxer,
track->private_data = talloc_size(track, len + AV_LZO_INPUT_PADDING);
memcpy(track->private_data, entry->codec_private.start, len);
track->private_size = len;
MP_VERBOSE(demuxer, "| + CodecPrivate, length %u\n",
track->private_size);
MP_VERBOSE(demuxer, "| + CodecPrivate, length %u\n", track->private_size);
}
if (entry->n_language) {
track->language = talloc_strndup(track, entry->language.start,
entry->language.len);
MP_VERBOSE(demuxer, "| + Language: %s\n",
track->language);
MP_VERBOSE(demuxer, "| + Language: %s\n", track->language);
} else {
track->language = talloc_strdup(track, "eng");
}
if (entry->n_flag_default) {
track->default_track = entry->flag_default;
MP_VERBOSE(demuxer, "| + Default flag: %u\n",
track->default_track);
MP_VERBOSE(demuxer, "| + Default flag: %u\n", track->default_track);
} else {
track->default_track = 1;
}
@ -620,7 +607,7 @@ static void parse_trackentry(struct demuxer *demuxer,
if (!track->v_frate)
track->v_frate = 1e9 / entry->default_duration;
MP_VERBOSE(demuxer, "| + Default duration: %.3fms ( = %.3f fps)\n",
entry->default_duration / 1000000.0, track->v_frate);
entry->default_duration / 1000000.0, track->v_frate);
}
}
@ -783,8 +770,7 @@ static int demux_mkv_read_chapters(struct demuxer *demuxer)
}
if (wanted_edition >= 0 && wanted_edition < num_editions) {
selected_edition = wanted_edition;
MP_VERBOSE(demuxer, "User-specified edition: %d\n",
selected_edition);
MP_VERBOSE(demuxer, "User-specified edition: %d\n", selected_edition);
} else {
for (int i = 0; i < num_editions; i++) {
if (wanted_edition_uid &&
@ -813,10 +799,10 @@ static int demux_mkv_read_chapters(struct demuxer *demuxer)
int warn_level = idx == selected_edition ? MSGL_WARN : MSGL_V;
if (editions[idx].n_edition_flag_default)
MP_VERBOSE(demuxer, "Default edition flag: %"PRIu64
"\n", editions[idx].edition_flag_default);
"\n", editions[idx].edition_flag_default);
if (editions[idx].n_edition_flag_ordered)
MP_VERBOSE(demuxer, "Ordered chapter flag: %"PRIu64
"\n", editions[idx].edition_flag_ordered);
"\n", editions[idx].edition_flag_ordered);
int chapter_count = editions[idx].n_chapter_atom;
@ -833,8 +819,7 @@ static int demux_mkv_read_chapters(struct demuxer *demuxer)
struct bstr name = { "(unnamed)", 9 };
if (!ca->n_chapter_time_start)
MP_MSG(demuxer, warn_level,
"Chapter lacks start time\n");
MP_MSG(demuxer, warn_level, "Chapter lacks start time\n");
chapter.start = ca->chapter_time_start;
chapter.end = ca->chapter_time_end;
@ -843,8 +828,7 @@ static int demux_mkv_read_chapters(struct demuxer *demuxer)
MP_MSG(demuxer, warn_level, "Multiple chapter "
"names not supported, picking first\n");
if (!ca->chapter_display[0].n_chap_string)
MP_MSG(demuxer, warn_level, "Malformed chapter "
"name entry\n");
MP_MSG(demuxer, warn_level, "Malformed chapter name entry\n");
else
name = ca->chapter_display[0].chap_string;
}
@ -985,7 +969,7 @@ static int demux_mkv_read_attachments(demuxer_t *demuxer)
struct bstr mime = attachment->file_mime_type;
demuxer_add_attachment(demuxer, name, mime, attachment->file_data);
MP_VERBOSE(demuxer, "Attachment: %.*s, %.*s, %zu bytes\n",
BSTR_P(name), BSTR_P(mime), attachment->file_data.len);
BSTR_P(name), BSTR_P(mime), attachment->file_data.len);
}
talloc_free(parse_ctx.talloc_ctx);
@ -1674,10 +1658,8 @@ static int demux_mkv_open_sub(demuxer_t *demuxer, mkv_track_t *track)
sh->title = talloc_strdup(sh, track->name);
sh->default_track = track->default_track;
if (!subtitle_type) {
MP_ERR(demuxer, "Subtitle type '%s' is not supported.\n",
track->codec_id);
}
if (!subtitle_type)
MP_ERR(demuxer, "Subtitle type '%s' is not supported.\n", track->codec_id);
return 0;
}
@ -1694,7 +1676,7 @@ static int read_ebml_header(demuxer_t *demuxer)
return 0;
if (ebml_master.doc_type.start == NULL) {
MP_VERBOSE(demuxer, "File has EBML header but no doctype."
" Assuming \"matroska\".\n");
" Assuming \"matroska\".\n");
} else if (bstrcmp(ebml_master.doc_type, bstr0("matroska")) != 0
&& bstrcmp(ebml_master.doc_type, bstr0("webm")) != 0) {
MP_DBG(demuxer, "no head found\n");
@ -1703,8 +1685,8 @@ static int read_ebml_header(demuxer_t *demuxer)
}
if (ebml_master.doc_type_read_version > 2) {
MP_WARN(demuxer, "This looks like a Matroska file, "
"but we don't support format version %"PRIu64"\n",
ebml_master.doc_type_read_version);
"but we don't support format version %"PRIu64"\n",
ebml_master.doc_type_read_version);
talloc_free(parse_ctx.talloc_ctx);
return 0;
}
@ -1716,7 +1698,7 @@ static int read_ebml_header(demuxer_t *demuxer)
&& ebml_master.ebml_max_id_length != 4))
{
MP_WARN(demuxer, "This looks like a Matroska file, "
"but the header has bad parameters\n");
"but the header has bad parameters\n");
talloc_free(parse_ctx.talloc_ctx);
return 0;
}