Mercurial > libavcodec.hg
comparison utils.c @ 2270:21f450be6cb5 libavcodec
lowres width/height cleanup 3rd try
| author | michael |
|---|---|
| date | Mon, 27 Sep 2004 11:50:56 +0000 |
| parents | 8f605c66d1d4 |
| children | 7b345b735ac7 |
comparison
equal
deleted
inserted
replaced
| 2269:535b7dfee202 | 2270:21f450be6cb5 |
|---|---|
| 119 AVCodec **p; | 119 AVCodec **p; |
| 120 p = &first_avcodec; | 120 p = &first_avcodec; |
| 121 while (*p != NULL) p = &(*p)->next; | 121 while (*p != NULL) p = &(*p)->next; |
| 122 *p = format; | 122 *p = format; |
| 123 format->next = NULL; | 123 format->next = NULL; |
| 124 } | |
| 125 | |
| 126 void avcodec_set_dimensions(AVCodecContext *s, int width, int height){ | |
| 127 s->coded_width = width; | |
| 128 s->coded_height= height; | |
| 129 s->width = -((-width )>>s->lowres); | |
| 130 s->height= -((-height)>>s->lowres); | |
| 124 } | 131 } |
| 125 | 132 |
| 126 typedef struct InternalBuffer{ | 133 typedef struct InternalBuffer{ |
| 127 int last_pic_num; | 134 int last_pic_num; |
| 128 uint8_t *base[4]; | 135 uint8_t *base[4]; |
| 454 if (!avctx->priv_data) | 461 if (!avctx->priv_data) |
| 455 return -ENOMEM; | 462 return -ENOMEM; |
| 456 } else { | 463 } else { |
| 457 avctx->priv_data = NULL; | 464 avctx->priv_data = NULL; |
| 458 } | 465 } |
| 466 | |
| 467 if(avctx->coded_width && avctx->coded_height) | |
| 468 avcodec_set_dimensions(avctx, avctx->coded_width, avctx->coded_height); | |
| 469 else if(avctx->width && avctx->height) | |
| 470 avcodec_set_dimensions(avctx, avctx->width, avctx->height); | |
| 471 | |
| 459 ret = avctx->codec->init(avctx); | 472 ret = avctx->codec->init(avctx); |
| 460 if (ret < 0) { | 473 if (ret < 0) { |
| 461 av_freep(&avctx->priv_data); | 474 av_freep(&avctx->priv_data); |
| 462 return ret; | 475 return ret; |
| 463 } | 476 } |
