diff utils.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 5d72afc6c8aa
children 302115721ef5
line wrap: on
line diff
--- a/utils.c	Tue Feb 13 08:21:47 2007 +0000
+++ b/utils.c	Tue Feb 13 18:26:14 2007 +0000
@@ -478,7 +478,7 @@
             /* read probe data */
             pd->buf= av_realloc(pd->buf, probe_size);
             pd->buf_size = get_buffer(pb, pd->buf, probe_size);
-            if (url_fseek(pb, 0, SEEK_SET) == (offset_t)-EPIPE) {
+            if (url_fseek(pb, 0, SEEK_SET) == (offset_t)AVERROR(EPIPE)) {
                 url_fclose(pb);
                 if (url_fopen(pb, filename, URL_RDONLY) < 0) {
                     file_opened = 0;
@@ -805,7 +805,7 @@
             /* read next packet */
             ret = av_read_packet(s, &s->cur_pkt);
             if (ret < 0) {
-                if (ret == -EAGAIN)
+                if (ret == AVERROR(EAGAIN))
                     return ret;
                 /* return the last frames, if any */
                 for(i = 0; i < s->nb_streams; i++) {
@@ -916,7 +916,7 @@
             AVPacketList **plast_pktl= &s->packet_buffer;
             int ret= av_read_frame_internal(s, pkt);
             if(ret<0){
-                if(pktl && ret != -EAGAIN){
+                if(pktl && ret != AVERROR(EAGAIN)){
                     eof=1;
                     continue;
                 }else