From 904c73d2d214c729fbeedc13c8b47afab91e296b Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 23 Nov 2013 21:37:56 +0100 Subject: demux: remove gsh field from sh_audio/sh_video/sh_sub This used to be needed to access the generic stream header from the specific headers, which in turn was needed because the decoders had access only to the specific headers. This is not the case anymore, so this can finally be removed again. Also move the "format" field from the specific headers to sh_stream. --- audio/decode/ad_lavc.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'audio/decode') diff --git a/audio/decode/ad_lavc.c b/audio/decode/ad_lavc.c index 5155faabc9..35ebce07cc 100644 --- a/audio/decode/ad_lavc.c +++ b/audio/decode/ad_lavc.c @@ -183,16 +183,17 @@ static int init(struct dec_audio *da, const char *decoder) struct ad_lavc_param *opts = &mpopts->ad_lavc_param; AVCodecContext *lavc_context; AVCodec *lavc_codec; - struct sh_audio *sh_audio = da->header->audio; + struct sh_stream *sh = da->header; + struct sh_audio *sh_audio = sh->audio; struct priv *ctx = talloc_zero(NULL, struct priv); da->priv = ctx; if (sh_audio->wf && strcmp(decoder, "pcm") == 0) { - decoder = find_pcm_decoder(tag_map, sh_audio->format, + decoder = find_pcm_decoder(tag_map, sh->format, sh_audio->wf->wBitsPerSample); } else if (sh_audio->wf && strcmp(decoder, "mp-pcm") == 0) { - decoder = find_pcm_decoder(af_map, sh_audio->format, 0); + decoder = find_pcm_decoder(af_map, sh->format, 0); ctx->force_channel_map = true; } @@ -229,7 +230,7 @@ static int init(struct dec_audio *da, const char *decoder) } } - lavc_context->codec_tag = sh_audio->format; + lavc_context->codec_tag = sh->format; lavc_context->sample_rate = sh_audio->samplerate; lavc_context->bit_rate = sh_audio->i_bps * 8; lavc_context->channel_layout = mp_chmap_to_lavc(&sh_audio->channels); @@ -247,8 +248,8 @@ static int init(struct dec_audio *da, const char *decoder) lavc_context->extradata_size); } - if (sh_audio->gsh->lav_headers) - mp_copy_lav_codec_headers(lavc_context, sh_audio->gsh->lav_headers); + if (sh->lav_headers) + mp_copy_lav_codec_headers(lavc_context, sh->lav_headers); /* open it */ if (avcodec_open2(lavc_context, lavc_codec, NULL) < 0) { -- cgit v1.2.3