diff utils.c @ 681:b3869ffff47a libavcodec

avcodec_alloc_context()
author michaelni
date Thu, 19 Sep 2002 09:13:43 +0000
parents d6955d0d7d27
children 44a1dab0205c
line wrap: on
line diff
--- a/utils.c	Wed Sep 18 18:30:31 2002 +0000
+++ b/utils.c	Thu Sep 19 09:13:43 2002 +0000
@@ -49,6 +49,27 @@
     format->next = NULL;
 }
 
+void avcodec_get_context_defaults(AVCodecContext *s){
+    s->qmin= 2;
+    s->qmax= 31;
+    s->rc_eq= "tex^qComp";
+    s->qcompress= 0.5;
+}
+
+/**
+ * allocates a AVCodecContext and set it to defaults.
+ * this can be deallocated by simply calling free() 
+ */
+AVCodecContext *avcodec_alloc_context(){
+    AVCodecContext *avctx= av_mallocz(sizeof(AVCodecContext));
+    
+    if(avctx==NULL) return NULL;
+    
+    avcodec_get_context_defaults(avctx);
+    
+    return avctx;
+}
+
 int avcodec_open(AVCodecContext *avctx, AVCodec *codec)
 {
     int ret;