comparison 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
comparison
equal deleted inserted replaced
1830:024752284c25 1831:cd2d7fcfab7a
337 enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, enum PixelFormat * fmt){ 337 enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, enum PixelFormat * fmt){
338 return fmt[0]; 338 return fmt[0];
339 } 339 }
340 340
341 void avcodec_get_context_defaults(AVCodecContext *s){ 341 void avcodec_get_context_defaults(AVCodecContext *s){
342 memset(s, 0, sizeof(AVCodecContext));
343
342 s->bit_rate= 800*1000; 344 s->bit_rate= 800*1000;
343 s->bit_rate_tolerance= s->bit_rate*10; 345 s->bit_rate_tolerance= s->bit_rate*10;
344 s->qmin= 2; 346 s->qmin= 2;
345 s->qmax= 31; 347 s->qmax= 31;
346 s->mb_qmin= 2; 348 s->mb_qmin= 2;
379 /** 381 /**
380 * allocates a AVCodecContext and set it to defaults. 382 * allocates a AVCodecContext and set it to defaults.
381 * this can be deallocated by simply calling free() 383 * this can be deallocated by simply calling free()
382 */ 384 */
383 AVCodecContext *avcodec_alloc_context(void){ 385 AVCodecContext *avcodec_alloc_context(void){
384 AVCodecContext *avctx= av_mallocz(sizeof(AVCodecContext)); 386 AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext));
385 387
386 if(avctx==NULL) return NULL; 388 if(avctx==NULL) return NULL;
387 389
388 avcodec_get_context_defaults(avctx); 390 avcodec_get_context_defaults(avctx);
389 391
390 return avctx; 392 return avctx;
393 }
394
395 void avcodec_get_frame_defaults(AVFrame *pic){
396 memset(pic, 0, sizeof(AVFrame));
397
398 pic->pts= AV_NOPTS_VALUE;
391 } 399 }
392 400
393 /** 401 /**
394 * allocates a AVPFrame and set it to defaults. 402 * allocates a AVPFrame and set it to defaults.
395 * this can be deallocated by simply calling free() 403 * this can be deallocated by simply calling free()
396 */ 404 */
397 AVFrame *avcodec_alloc_frame(void){ 405 AVFrame *avcodec_alloc_frame(void){
398 AVFrame *pic= av_mallocz(sizeof(AVFrame)); 406 AVFrame *pic= av_malloc(sizeof(AVFrame));
407
408 if(pic==NULL) return NULL;
409
410 avcodec_get_frame_defaults(pic);
399 411
400 return pic; 412 return pic;
401 } 413 }
402 414
403 int avcodec_open(AVCodecContext *avctx, AVCodec *codec) 415 int avcodec_open(AVCodecContext *avctx, AVCodec *codec)