summaryrefslogtreecommitdiffstats
path: root/mplayer.c
diff options
context:
space:
mode:
Diffstat (limited to 'mplayer.c')
-rw-r--r--mplayer.c48
1 files changed, 15 insertions, 33 deletions
diff --git a/mplayer.c b/mplayer.c
index 59c7229c8e..ad18f62730 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -383,29 +383,25 @@ char *get_metadata(struct MPContext *mpctx, metadata_t type)
return talloc_strdup(NULL, "");
}
-static void print_stream(struct MPContext *mpctx, sh_common_t *s)
+static void print_stream(struct MPContext *mpctx, struct sh_stream *s)
{
const char *tname = "?";
const char *selopt = "?";
const char *langopt = "?";
- switch (s->stream_type) {
+ switch (s->type) {
case STREAM_VIDEO:
tname = "video"; selopt = "vid"; langopt = "vlang";
break;
case STREAM_AUDIO:
tname = "audio"; selopt = "aid"; langopt = "alang";
break;
- case STREAM_SUBTITLE:
+ case STREAM_SUB:
tname = "subtitle"; selopt = "sid"; langopt = "slang";
break;
}
mp_msg(MSGT_CPLAYER, MSGL_INFO, "[stream] ID %d: %s", s->demuxer_id, tname);
- mp_msg(MSGT_CPLAYER, MSGL_INFO, " --%s=%d", selopt, s->id);
- char *lang = NULL;
- if (s->stream_type == STREAM_AUDIO)
- lang = demuxer_audio_lang(mpctx->demuxer, s->index);
- if (s->stream_type == STREAM_SUBTITLE)
- lang = demuxer_sub_lang(mpctx->demuxer, s->index);
+ mp_msg(MSGT_CPLAYER, MSGL_INFO, " --%s=%d", selopt, s->tid);
+ char *lang = demuxer_stream_lang(mpctx->demuxer, s);
if (lang)
mp_msg(MSGT_CPLAYER, MSGL_INFO, " --%s=%s", langopt, lang);
if (s->default_track)
@@ -413,10 +409,11 @@ static void print_stream(struct MPContext *mpctx, sh_common_t *s)
if (s->title)
mp_msg(MSGT_CPLAYER, MSGL_INFO, " '%s'", s->title);
mp_msg(MSGT_CPLAYER, MSGL_INFO, " (");
- if (s->format) {
+ if (s->common_header->format) {
+ int format = s->common_header->format;
// not sure about endian crap
- char name[sizeof(s->format) + 1] = {0};
- memcpy(name, &s->format, sizeof(s->format));
+ char name[sizeof(format) + 1] = {0};
+ memcpy(name, &format, sizeof(format));
bool ok = true;
for (int n = 0; name[n]; n++) {
if ((name[n] < 32 || name[n] >= 128) && name[n] != 0)
@@ -425,9 +422,9 @@ static void print_stream(struct MPContext *mpctx, sh_common_t *s)
if (ok && strlen(name) > 0) {
mp_msg(MSGT_CPLAYER, MSGL_INFO, "%s", name);
} else {
- mp_msg(MSGT_CPLAYER, MSGL_INFO, "%#x", s->format);
+ mp_msg(MSGT_CPLAYER, MSGL_INFO, "%#x", format);
}
- } else if (s->stream_type == STREAM_SUBTITLE) {
+ } else if (s->type == STREAM_SUB) {
char t = ((sh_sub_t*)s)->type;
const char *name = NULL;
switch (t) {
@@ -439,8 +436,8 @@ static void print_stream(struct MPContext *mpctx, sh_common_t *s)
name = (char[2]){t, '\0'};
mp_msg(MSGT_CPLAYER, MSGL_INFO, "%s", name);
}
- if (s->demuxer_codecname)
- mp_msg(MSGT_CPLAYER, MSGL_INFO, "/%s", s->demuxer_codecname);
+ if (s->common_header->demuxer_codecname)
+ mp_msg(MSGT_CPLAYER, MSGL_INFO, "/%s", s->common_header->demuxer_codecname);
mp_msg(MSGT_CPLAYER, MSGL_INFO, ")");
mp_msg(MSGT_CPLAYER, MSGL_INFO, "\n");
}
@@ -520,23 +517,8 @@ static void print_file_properties(struct MPContext *mpctx, const char *filename)
}
}
}
- // xxx I think this might be invalid C
- // should resolve the crapmess in stheader.h
- for (int n = 0; n < MAX_V_STREAMS; n++) {
- sh_common_t *s = (sh_common_t*)mpctx->demuxer->v_streams[n];
- if (s)
- print_stream(mpctx, s);
- }
- for (int n = 0; n < MAX_A_STREAMS; n++) {
- sh_common_t *s = (sh_common_t*)mpctx->demuxer->a_streams[n];
- if (s)
- print_stream(mpctx, s);
- }
- for (int n = 0; n < MAX_S_STREAMS; n++) {
- sh_common_t *s = (sh_common_t*)mpctx->demuxer->s_streams[n];
- if (s)
- print_stream(mpctx, s);
- }
+ for (int n = 0; n < mpctx->demuxer->num_streams; n++)
+ print_stream(mpctx, mpctx->demuxer->streams[n]);
}
/// step size of mixer changes