summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-01-12 23:48:19 +0100
committerwm4 <wm4@nowhere>2016-01-12 23:48:19 +0100
commit671df54e4dcf0675c335483d26f7f6ff9baaf76a (patch)
tree6a206ddf489474150fffa2eac651b5e8915b969c /player
parent81f3b3aafe72e5ca9ac79d29246e70dce76ebca9 (diff)
downloadmpv-671df54e4dcf0675c335483d26f7f6ff9baaf76a.tar.bz2
mpv-671df54e4dcf0675c335483d26f7f6ff9baaf76a.tar.xz
demux: merge sh_video/sh_audio/sh_sub
This is mainly a refactor. I'm hoping it will make some things easier in the future due to cleanly separating codec metadata and stream metadata. Also, declare that the "codec" field can not be NULL anymore. demux.c will set it to "" if it's NULL when added. This gets rid of a corner case everything had to handle, but which rarely happened.
Diffstat (limited to 'player')
-rw-r--r--player/audio.c2
-rw-r--r--player/command.c23
-rw-r--r--player/loadfile.c2
-rw-r--r--player/sub.c6
-rw-r--r--player/video.c4
5 files changed, 18 insertions, 19 deletions
diff --git a/player/audio.c b/player/audio.c
index 8cbdb5aefa..0655dda51e 100644
--- a/player/audio.c
+++ b/player/audio.c
@@ -218,7 +218,7 @@ void reinit_audio_chain(struct MPContext *mpctx)
mpctx->d_audio->header = sh;
mpctx->d_audio->pool = mp_audio_pool_create(mpctx->d_audio);
mpctx->d_audio->afilter = af_new(mpctx->global);
- mpctx->d_audio->afilter->replaygain_data = sh->audio->replaygain_data;
+ mpctx->d_audio->afilter->replaygain_data = sh->codec->replaygain_data;
mpctx->d_audio->spdif_passthrough = true;
mpctx->ao_buffer = mp_audio_buffer_create(NULL);
if (!audio_init_best_codec(mpctx->d_audio))
diff --git a/player/command.c b/player/command.c
index 135d092d8b..0bee671e88 100644
--- a/player/command.c
+++ b/player/command.c
@@ -1713,7 +1713,7 @@ static int mp_property_audio_codec_name(void *ctx, struct m_property *prop,
int action, void *arg)
{
MPContext *mpctx = ctx;
- const char *c = mpctx->d_audio ? mpctx->d_audio->header->codec : NULL;
+ const char *c = mpctx->d_audio ? mpctx->d_audio->header->codec->codec : NULL;
return m_property_strdup_ro(action, arg, c);
}
@@ -1930,8 +1930,7 @@ static int property_switch_track_ff(void *ctx, struct m_property *prop,
static int track_channels(struct track *track)
{
- return track->stream && track->stream->audio
- ? track->stream->audio->channels.num : 0;
+ return track->stream ? track->stream->codec->channels.num : 0;
}
static int get_track_entry(int item, int action, void *arg, void *ctx)
@@ -1939,7 +1938,7 @@ static int get_track_entry(int item, int action, void *arg, void *ctx)
struct MPContext *mpctx = ctx;
struct track *track = mpctx->tracks[item];
- const char *codec = track->stream ? track->stream->codec : NULL;
+ const char *codec = track->stream ? track->stream->codec->codec : NULL;
struct m_sub_property props[] = {
{"id", SUB_PROP_INT(track->user_tid)},
@@ -2431,7 +2430,7 @@ static int mp_property_video_format(void *ctx, struct m_property *prop,
int action, void *arg)
{
MPContext *mpctx = ctx;
- const char *c = mpctx->d_video ? mpctx->d_video->header->codec : NULL;
+ const char *c = mpctx->d_video ? mpctx->d_video->header->codec->codec : NULL;
return m_property_strdup_ro(action, arg, c);
}
@@ -2512,15 +2511,15 @@ static int mp_property_vd_imgparams(void *ctx, struct m_property *prop,
struct dec_video *vd = mpctx->d_video;
if (!vd)
return M_PROPERTY_UNAVAILABLE;
- struct sh_video *sh = vd->header->video;
+ struct mp_codec_params *c = vd->header->codec;
if (vd->vfilter->override_params.imgfmt) {
return property_imgparams(vd->vfilter->override_params, action, arg);
- } else if (sh->disp_w && sh->disp_h) {
+ } else if (c->disp_w && c->disp_h) {
// Simplistic fallback for stupid scripts querying "width"/"height"
// before the first frame is decoded.
struct m_sub_property props[] = {
- {"w", SUB_PROP_INT(sh->disp_w)},
- {"h", SUB_PROP_INT(sh->disp_h)},
+ {"w", SUB_PROP_INT(c->disp_w)},
+ {"h", SUB_PROP_INT(c->disp_h)},
{0}
};
return m_property_read_sub(props, action, arg);
@@ -2779,14 +2778,14 @@ static int mp_property_aspect(void *ctx, struct m_property *prop,
float aspect = mpctx->opts->movie_aspect;
if (mpctx->d_video && aspect <= 0) {
struct dec_video *d_video = mpctx->d_video;
- struct sh_video *sh_video = d_video->header->video;
+ struct mp_codec_params *c = d_video->header->codec;
struct mp_image_params *params = &d_video->vfilter->override_params;
if (params && params->p_w > 0 && params->p_h > 0) {
int d_w, d_h;
mp_image_params_get_dsize(params, &d_w, &d_h);
aspect = (float)d_w / d_h;
- } else if (sh_video->disp_w && sh_video->disp_h) {
- aspect = (float)sh_video->disp_w / sh_video->disp_h;
+ } else if (c->disp_w && c->disp_h) {
+ aspect = (float)c->disp_w / c->disp_h;
}
}
*(float *)arg = aspect;
diff --git a/player/loadfile.c b/player/loadfile.c
index b28b9f3cc4..cdf3d5b0f8 100644
--- a/player/loadfile.c
+++ b/player/loadfile.c
@@ -134,7 +134,7 @@ static void print_stream(struct MPContext *mpctx, struct track *t)
APPEND(b, " [P]");
if (t->title)
APPEND(b, " '%s'", t->title);
- const char *codec = s ? s->codec : NULL;
+ const char *codec = s ? s->codec->codec : NULL;
APPEND(b, " (%s)", codec ? codec : "<unknown>");
if (t->is_external)
APPEND(b, " (external)");
diff --git a/player/sub.c b/player/sub.c
index 5f2f13e88f..0492be4bc8 100644
--- a/player/sub.c
+++ b/player/sub.c
@@ -118,9 +118,9 @@ static bool init_subdec(struct MPContext *mpctx, struct track *track)
if (!track->dec_sub)
return false;
- struct sh_video *sh_video =
- mpctx->d_video ? mpctx->d_video->header->video : NULL;
- double fps = sh_video ? sh_video->fps : 25;
+ struct mp_codec_params *v_c =
+ mpctx->d_video ? mpctx->d_video->header->codec : NULL;
+ double fps = v_c ? v_c->fps : 25;
sub_control(track->dec_sub, SD_CTRL_SET_VIDEO_DEF_FPS, &fps);
// Don't do this if the file has video/audio streams. Don't do it even
diff --git a/player/video.c b/player/video.c
index 7f1ab4dc21..d54f048038 100644
--- a/player/video.c
+++ b/player/video.c
@@ -277,10 +277,10 @@ int reinit_video_chain(struct MPContext *mpctx)
d_video->log = mp_log_new(d_video, mpctx->log, "!vd");
d_video->opts = mpctx->opts;
d_video->header = sh;
- d_video->fps = sh->video->fps;
+ d_video->fps = sh->codec->fps;
d_video->vo = mpctx->video_out;
- MP_VERBOSE(d_video, "Container reported FPS: %f\n", sh->video->fps);
+ MP_VERBOSE(d_video, "Container reported FPS: %f\n", sh->codec->fps);
if (opts->force_fps) {
d_video->fps = opts->force_fps;