diff libmpcodecs/ad_ffmpeg.c @ 36372:c95bdc49af2e

ad_ffmpeg: fix commit fixing sample rate changes to actually work.
author reimar
date Wed, 16 Oct 2013 17:20:31 +0000
parents 3dfc82c0a678
children 741131acf556
line wrap: on
line diff
--- a/libmpcodecs/ad_ffmpeg.c	Tue Oct 15 18:58:55 2013 +0000
+++ b/libmpcodecs/ad_ffmpeg.c	Wed Oct 16 17:20:31 2013 +0000
@@ -68,6 +68,7 @@
     if(sh_audio->wf){
         struct adctx *c = lavc_context->opaque;
         c->srate_changed |= c->last_samplerate && c->last_samplerate != samplerate;
+        c->last_samplerate = samplerate;
         // If the decoder uses the wrong number of channels all is lost anyway.
         // sh_audio->channels=sh_audio->wf->nChannels;
 
@@ -112,7 +113,7 @@
 
     lavc_context = avcodec_alloc_context3(lavc_codec);
     sh_audio->context=lavc_context;
-    lavc_context->opaque = calloc(sizeof(struct adctx), 1);
+    lavc_context->opaque = av_mallocz(sizeof(struct adctx));
 
     snprintf(tmpstr, sizeof(tmpstr), "%f", drc_level);
     av_dict_set(&opts, "drc_scale", tmpstr, 0);