summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--audio/decode/ad_lavc.c7
-rw-r--r--audio/decode/dec_audio.c4
-rw-r--r--audio/decode/dec_audio.h1
-rw-r--r--player/audio.c1
-rw-r--r--player/video.c1
-rw-r--r--video/decode/dec_video.c8
-rw-r--r--video/decode/dec_video.h1
-rw-r--r--video/decode/vd_lavc.c7
8 files changed, 16 insertions, 14 deletions
diff --git a/audio/decode/ad_lavc.c b/audio/decode/ad_lavc.c
index edc9f3c0f0..eeb4526f13 100644
--- a/audio/decode/ad_lavc.c
+++ b/audio/decode/ad_lavc.c
@@ -77,8 +77,7 @@ static int init(struct dec_audio *da, const char *decoder)
struct ad_lavc_params *opts = mpopts->ad_lavc_params;
AVCodecContext *lavc_context;
AVCodec *lavc_codec;
- struct sh_stream *sh = da->header;
- struct mp_codec_params *c = sh->codec;
+ struct mp_codec_params *c = da->codec;
struct priv *ctx = talloc_zero(NULL, struct priv);
da->priv = ctx;
@@ -216,8 +215,8 @@ static int decode_packet(struct dec_audio *da, struct demux_packet *mpkt,
if (lavc_chmap.num != avctx->channels)
mp_chmap_from_channels(&lavc_chmap, avctx->channels);
if (priv->force_channel_map) {
- if (lavc_chmap.num == da->header->codec->channels.num)
- lavc_chmap = da->header->codec->channels;
+ if (lavc_chmap.num == da->codec->channels.num)
+ lavc_chmap = da->codec->channels;
}
mp_audio_set_channels(mpframe, &lavc_chmap);
diff --git a/audio/decode/dec_audio.c b/audio/decode/dec_audio.c
index 5cb69dc6d1..6d5210d179 100644
--- a/audio/decode/dec_audio.c
+++ b/audio/decode/dec_audio.c
@@ -86,7 +86,7 @@ struct mp_decoder_list *audio_decoder_list(void)
static struct mp_decoder_list *audio_select_decoders(struct dec_audio *d_audio)
{
struct MPOpts *opts = d_audio->opts;
- const char *codec = d_audio->header->codec->codec;
+ const char *codec = d_audio->codec->codec;
struct mp_decoder_list *list = audio_decoder_list();
struct mp_decoder_list *new =
@@ -144,7 +144,7 @@ int audio_init_best_codec(struct dec_audio *d_audio)
MP_VERBOSE(d_audio, "Selected audio codec: %s\n", d_audio->decoder_desc);
} else {
MP_ERR(d_audio, "Failed to initialize an audio decoder for codec '%s'.\n",
- d_audio->header->codec->codec);
+ d_audio->codec->codec);
}
talloc_free(list);
diff --git a/audio/decode/dec_audio.h b/audio/decode/dec_audio.h
index a7f878bee7..88fc40aec9 100644
--- a/audio/decode/dec_audio.h
+++ b/audio/decode/dec_audio.h
@@ -32,6 +32,7 @@ struct dec_audio {
struct mpv_global *global;
const struct ad_functions *ad_driver;
struct sh_stream *header;
+ struct mp_codec_params *codec;
char *decoder_desc;
bool try_spdif;
diff --git a/player/audio.c b/player/audio.c
index 2a0614c259..1cc85ad357 100644
--- a/player/audio.c
+++ b/player/audio.c
@@ -389,6 +389,7 @@ int init_audio_decoder(struct MPContext *mpctx, struct track *track)
d_audio->global = mpctx->global;
d_audio->opts = mpctx->opts;
d_audio->header = track->stream;
+ d_audio->codec = track->stream->codec;
d_audio->try_spdif = true;
diff --git a/player/video.c b/player/video.c
index f713a86f41..05f2f5667f 100644
--- a/player/video.c
+++ b/player/video.c
@@ -325,6 +325,7 @@ int init_video_decoder(struct MPContext *mpctx, struct track *track)
d_video->log = mp_log_new(d_video, mpctx->log, "!vd");
d_video->opts = mpctx->opts;
d_video->header = track->stream;
+ d_video->codec = track->stream->codec;
d_video->fps = d_video->header->codec->fps;
if (mpctx->vo_chain)
d_video->hwdec_info = mpctx->vo_chain->hwdec_info;
diff --git a/video/decode/dec_video.c b/video/decode/dec_video.c
index 05de748e69..0487ac383f 100644
--- a/video/decode/dec_video.c
+++ b/video/decode/dec_video.c
@@ -136,7 +136,7 @@ bool video_init_best_codec(struct dec_video *d_video)
struct mp_decoder_entry *decoder = NULL;
struct mp_decoder_list *list =
- mp_select_video_decoders(d_video->header->codec->codec, opts->video_decoders);
+ mp_select_video_decoders(d_video->codec->codec, opts->video_decoders);
mp_print_decoders(d_video->log, MSGL_V, "Codec list:", list);
@@ -164,7 +164,7 @@ bool video_init_best_codec(struct dec_video *d_video)
MP_VERBOSE(d_video, "Selected video codec: %s\n", d_video->decoder_desc);
} else {
MP_ERR(d_video, "Failed to initialize a video decoder for codec '%s'.\n",
- d_video->header->codec->codec);
+ d_video->codec->codec);
}
if (d_video->header->missing_timestamps) {
@@ -182,7 +182,7 @@ static void fix_image_params(struct dec_video *d_video,
{
struct MPOpts *opts = d_video->opts;
struct mp_image_params p = *params;
- struct mp_codec_params *c = d_video->header->codec;
+ struct mp_codec_params *c = d_video->codec;
MP_VERBOSE(d_video, "Decoder format: %s\n", mp_image_params_to_str(params));
@@ -241,7 +241,7 @@ static struct mp_image *decode_packet(struct dec_video *d_video,
int drop_frame)
{
struct MPOpts *opts = d_video->opts;
- bool avi_pts = d_video->header->codec->avi_dts && opts->correct_pts;
+ bool avi_pts = d_video->codec->avi_dts && opts->correct_pts;
struct demux_packet packet_copy;
if (packet && packet->dts == MP_NOPTS_VALUE && !avi_pts) {
diff --git a/video/decode/dec_video.h b/video/decode/dec_video.h
index 9d69e0c73b..d4c12a7bc4 100644
--- a/video/decode/dec_video.h
+++ b/video/decode/dec_video.h
@@ -34,6 +34,7 @@ struct dec_video {
const struct vd_functions *vd_driver;
struct mp_hwdec_info *hwdec_info; // video output hwdec handles
struct sh_stream *header;
+ struct mp_codec_params *codec;
char *decoder_desc;
diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c
index 2a7928b96e..ef713c2d65 100644
--- a/video/decode/vd_lavc.c
+++ b/video/decode/vd_lavc.c
@@ -359,8 +359,7 @@ static void init_avctx(struct dec_video *vd, const char *decoder,
vd_ffmpeg_ctx *ctx = vd->priv;
struct vd_lavc_params *lavc_param = vd->opts->vd_lavc_params;
bool mp_rawvideo = false;
- struct sh_stream *sh = vd->header;
- struct mp_codec_params *c = sh->codec;
+ struct mp_codec_params *c = vd->codec;
assert(!ctx->avctx);
@@ -522,8 +521,8 @@ static void update_image_params(struct dec_video *vd, AVFrame *frame,
.gamma = avcol_trc_to_mp_csp_trc(ctx->avctx->color_trc),
.chroma_location =
avchroma_location_to_mp(ctx->avctx->chroma_sample_location),
- .rotate = vd->header->codec->rotate,
- .stereo_in = vd->header->codec->stereo_mode,
+ .rotate = vd->codec->rotate,
+ .stereo_in = vd->codec->stereo_mode,
};
if (opts->video_rotate < 0) {