]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/utils.c
Free encoder extradata in avcodec_close(). Should fix several small memory
[ffmpeg] / libavcodec / utils.c
index 99c97c189514ad5059b4489555424e09efb040c1..a66b85e9ad9a67b917a2f0d5231aa1c717b7c80e 100644 (file)
@@ -265,7 +265,9 @@ int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic){
 //picture size unneccessarily in some cases. The solution here is not
 //pretty and better ideas are welcome!
 #if HAVE_MMX
-                if(s->codec_id == CODEC_ID_SVQ1)
+                if(s->codec_id == CODEC_ID_SVQ1 || s->codec_id == CODEC_ID_VP5 ||
+                   s->codec_id == CODEC_ID_VP6 || s->codec_id == CODEC_ID_VP6F ||
+                   s->codec_id == CODEC_ID_VP6A)
                     stride_align[i]= 16;
                 else
 #endif
@@ -662,7 +664,7 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
     return ret;
 }
 
-int avcodec_close(AVCodecContext *avctx)
+av_cold int avcodec_close(AVCodecContext *avctx)
 {
     /* If there is a user-supplied mutex locking routine, call it. */
     if (ff_lockmgr_cb) {
@@ -683,6 +685,8 @@ int avcodec_close(AVCodecContext *avctx)
         avctx->codec->close(avctx);
     avcodec_default_free_buffers(avctx);
     av_freep(&avctx->priv_data);
+    if(avctx->codec->encode)
+        av_freep(&avctx->extradata);
     avctx->codec = NULL;
     entangled_thread_counter--;
 
@@ -963,6 +967,9 @@ int av_get_bits_per_sample(enum CodecID codec_id){
         return 3;
     case CODEC_ID_ADPCM_SBPRO_4:
     case CODEC_ID_ADPCM_CT:
+    case CODEC_ID_ADPCM_IMA_WAV:
+    case CODEC_ID_ADPCM_MS:
+    case CODEC_ID_ADPCM_YAMAHA:
         return 4;
     case CODEC_ID_PCM_ALAW:
     case CODEC_ID_PCM_MULAW:
@@ -1197,6 +1204,12 @@ int av_parse_video_frame_rate(AVRational *frame_rate, const char *arg)
         return 0;
 }
 
+int ff_match_2uint16(const uint16_t (*tab)[2], int size, int a, int b){
+    int i;
+    for(i=0; i<size && !(tab[i][0]==a && tab[i][1]==b); i++);
+    return i;
+}
+
 void av_log_missing_feature(void *avc, const char *feature, int want_sample)
 {
     av_log(avc, AV_LOG_WARNING, "%s not implemented. Update your FFmpeg "