Mercurial > libavformat.hg
comparison gifdec.c @ 1787:eb16c64144ee libavformat
This fixes error handling for BeOS, removing the need for some ifdefs.
AVERROR_ defines are moved to avcodec.h as they are needed in there as well. Feel free to move that to avutil/common.h.
Bumped up avcodec/format version numbers as though it's binary compatible we will want to rebuild apps as error values changed.
Please from now on use return AVERROR(EFOO) instead of the ugly return -EFOO in your code.
This also removes the need for berrno.h.
author | mmu_man |
---|---|
date | Tue, 13 Feb 2007 18:26:14 +0000 |
parents | 74cb68ad9dce |
children | b21c2af60bc9 |
comparison
equal
deleted
inserted
replaced
1786:8cc34fe98a3b | 1787:eb16c64144ee |
---|---|
303 } | 303 } |
304 | 304 |
305 /* verify that all the image is inside the screen dimensions */ | 305 /* verify that all the image is inside the screen dimensions */ |
306 if (left + width > s->screen_width || | 306 if (left + width > s->screen_width || |
307 top + height > s->screen_height) | 307 top + height > s->screen_height) |
308 return -EINVAL; | 308 return AVERROR(EINVAL); |
309 | 309 |
310 /* build the palette */ | 310 /* build the palette */ |
311 if (s->pix_fmt == PIX_FMT_RGB24) { | 311 if (s->pix_fmt == PIX_FMT_RGB24) { |
312 line = av_malloc(width); | 312 line = av_malloc(width); |
313 if (!line) | 313 if (!line) |
314 return -ENOMEM; | 314 return AVERROR(ENOMEM); |
315 } else { | 315 } else { |
316 n = (1 << bits_per_pixel); | 316 n = (1 << bits_per_pixel); |
317 spal = palette; | 317 spal = palette; |
318 for(i = 0; i < n; i++) { | 318 for(i = 0; i < n; i++) { |
319 s->image_palette[i] = (0xff << 24) | | 319 s->image_palette[i] = (0xff << 24) | |
535 | 535 |
536 /* allocate image buffer */ | 536 /* allocate image buffer */ |
537 s->image_linesize = s->screen_width * 3; | 537 s->image_linesize = s->screen_width * 3; |
538 s->image_buf = av_malloc(s->screen_height * s->image_linesize); | 538 s->image_buf = av_malloc(s->screen_height * s->image_linesize); |
539 if (!s->image_buf) | 539 if (!s->image_buf) |
540 return -ENOMEM; | 540 return AVERROR(ENOMEM); |
541 s->pix_fmt = PIX_FMT_RGB24; | 541 s->pix_fmt = PIX_FMT_RGB24; |
542 /* now we are ready: build format streams */ | 542 /* now we are ready: build format streams */ |
543 st = av_new_stream(s1, 0); | 543 st = av_new_stream(s1, 0); |
544 if (!st) | 544 if (!st) |
545 return -1; | 545 return -1; |