From f2b039da77fc66119d556e575822c2b8d328cdaf Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 15 Feb 2016 20:34:45 +0100 Subject: audio/video: expose codec info as separate field Preparation for the timeline rewrite. The codec will be able to change, the stream header not. --- audio/decode/ad_lavc.c | 7 +++---- audio/decode/dec_audio.c | 4 ++-- audio/decode/dec_audio.h | 1 + 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'audio') 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; -- cgit v1.2.3