summaryrefslogtreecommitdiffstats
path: root/demux/demux.c
diff options
context:
space:
mode:
Diffstat (limited to 'demux/demux.c')
-rw-r--r--demux/demux.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/demux/demux.c b/demux/demux.c
index b251674496..19ad6970b0 100644
--- a/demux/demux.c
+++ b/demux/demux.c
@@ -214,13 +214,9 @@ struct sh_stream *demux_alloc_sh_stream(enum stream_type type)
.index = -1,
.ff_index = -1, // may be overwritten by demuxer
.demuxer_id = -1, // ... same
+ .codec = talloc_zero(sh, struct mp_codec_params),
};
- switch (sh->type) {
- case STREAM_VIDEO: sh->video = talloc_zero(sh, struct sh_video); break;
- case STREAM_AUDIO: sh->audio = talloc_zero(sh, struct sh_audio); break;
- case STREAM_SUB: sh->sub = talloc_zero(sh, struct sh_sub); break;
- }
-
+ sh->codec->type = type;
return sh;
}
@@ -241,6 +237,9 @@ void demux_add_sh_stream(struct demuxer *demuxer, struct sh_stream *sh)
.selected = in->autoselect,
};
+ if (!sh->codec->codec)
+ sh->codec->codec = "";
+
sh->index = in->num_streams;
if (sh->ff_index < 0)
sh->ff_index = sh->index;
@@ -855,11 +854,11 @@ static void apply_replaygain(demuxer_t *demuxer, struct replaygain_data *rg)
struct demux_internal *in = demuxer->in;
for (int n = 0; n < in->num_streams; n++) {
struct sh_stream *sh = in->streams[n];
- if (sh->audio && !sh->audio->replaygain_data) {
+ if (sh->type == STREAM_AUDIO && !sh->codec->replaygain_data) {
MP_VERBOSE(demuxer, "Replaygain: Track=%f/%f Album=%f/%f\n",
rg->track_gain, rg->track_peak,
rg->album_gain, rg->album_peak);
- sh->audio->replaygain_data = talloc_memdup(in, rg, sizeof(*rg));
+ sh->codec->replaygain_data = talloc_memdup(in, rg, sizeof(*rg));
}
}
}