summaryrefslogtreecommitdiff
path: root/libavcodec/utils.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2004-02-25 17:35:52 +0000
committerMichael Niedermayer <michaelni@gmx.at>2004-02-25 17:35:52 +0000
commit9740beffc65d08ba454ce4c1d904b6d9388a6544 (patch)
treeaac8e8724add20e3f08ab24c0bf7d15f847dd56f /libavcodec/utils.c
parent8ac5c1b2d343ef6c1c759d3fb5a32de984ff9ab5 (diff)
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 Originally committed as revision 2814 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r--libavcodec/utils.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index eb4b19eedc..7227e4f507 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -339,6 +339,8 @@ enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, enum Pixel
}
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 @@ void avcodec_get_context_defaults(AVCodecContext *s){
* 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 @@ AVCodecContext *avcodec_alloc_context(void){
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;
}