diff utils.c @ 1831:cd2d7fcfab7a libavcodec

use AVFrame.pts=AV_NOPTS_VALUE instead of AVFrame.pts=0 move AV_NOPTS_VALUE & AV_TIME_BASE from avformat.h -> avcodec.h related fixes
author michael
date Wed, 25 Feb 2004 17:35:52 +0000
parents a660ef952580
children 73ee15c391bf
line wrap: on
line diff
--- a/utils.c	Wed Feb 25 02:47:53 2004 +0000
+++ b/utils.c	Wed Feb 25 17:35:52 2004 +0000
@@ -339,6 +339,8 @@
 }
 
 void avcodec_get_context_defaults(AVCodecContext *s){
+    memset(s, 0, sizeof(AVCodecContext));
+
     s->bit_rate= 800*1000;
     s->bit_rate_tolerance= s->bit_rate*10;
     s->qmin= 2;
@@ -381,7 +383,7 @@
  * this can be deallocated by simply calling free() 
  */
 AVCodecContext *avcodec_alloc_context(void){
-    AVCodecContext *avctx= av_mallocz(sizeof(AVCodecContext));
+    AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext));
     
     if(avctx==NULL) return NULL;
     
@@ -390,12 +392,22 @@
     return avctx;
 }
 
+void avcodec_get_frame_defaults(AVFrame *pic){
+    memset(pic, 0, sizeof(AVFrame));
+
+    pic->pts= AV_NOPTS_VALUE;
+}
+
 /**
  * allocates a AVPFrame and set it to defaults.
  * this can be deallocated by simply calling free() 
  */
 AVFrame *avcodec_alloc_frame(void){
-    AVFrame *pic= av_mallocz(sizeof(AVFrame));
+    AVFrame *pic= av_malloc(sizeof(AVFrame));
+    
+    if(pic==NULL) return NULL;
+    
+    avcodec_get_frame_defaults(pic);
     
     return pic;
 }