Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrançois Revol <revol@free.fr>2007-02-13 21:26:14 +0300
committerFrançois Revol <revol@free.fr>2007-02-13 21:26:14 +0300
commit8fa36ae09dddb1b639b4df5d505c0dbcf4e916e4 (patch)
tree551ead2b59bdc4b1855fb60d6c2ce6a2c7787f15 /libavformat/beosaudio.cpp
parentbcdf0d269748e2059ffa789033cd6e41739891fc (diff)
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. Originally committed as revision 7965 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/beosaudio.cpp')
-rw-r--r--libavformat/beosaudio.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/libavformat/beosaudio.cpp b/libavformat/beosaudio.cpp
index 6ac45ebb29..ae77809747 100644
--- a/libavformat/beosaudio.cpp
+++ b/libavformat/beosaudio.cpp
@@ -194,15 +194,15 @@ static int audio_open(AudioData *s, int is_output, const char *audio_device)
#ifndef HAVE_BSOUNDRECORDER
if (!is_output)
- return -EIO; /* not for now */
+ return AVERROR(EIO); /* not for now */
#endif
s->input_sem = create_sem(AUDIO_BUFFER_SIZE, "ffmpeg_ringbuffer_input");
if (s->input_sem < B_OK)
- return -EIO;
+ return AVERROR(EIO);
s->output_sem = create_sem(0, "ffmpeg_ringbuffer_output");
if (s->output_sem < B_OK) {
delete_sem(s->input_sem);
- return -EIO;
+ return AVERROR(EIO);
}
s->input_index = 0;
s->output_index = 0;
@@ -226,7 +226,7 @@ static int audio_open(AudioData *s, int is_output, const char *audio_device)
delete_sem(s->input_sem);
if (s->output_sem)
delete_sem(s->output_sem);
- return -EIO;
+ return AVERROR(EIO);
}
s->codec_id = (iformat.byte_order == B_MEDIA_LITTLE_ENDIAN)?CODEC_ID_PCM_S16LE:CODEC_ID_PCM_S16BE;
s->channels = iformat.channel_count;
@@ -252,7 +252,7 @@ static int audio_open(AudioData *s, int is_output, const char *audio_device)
delete_sem(s->input_sem);
if (s->output_sem)
delete_sem(s->output_sem);
- return -EIO;
+ return AVERROR(EIO);
}
s->player->SetCookie(s);
s->player->SetVolume(1.0);
@@ -293,7 +293,7 @@ static int audio_write_header(AVFormatContext *s1)
s->channels = st->codec->channels;
ret = audio_open(s, 1, NULL);
if (ret < 0)
- return -EIO;
+ return AVERROR(EIO);
return 0;
}
@@ -315,7 +315,7 @@ lat1 = s->player->Latency();
int amount;
len = MIN(size, AUDIO_BLOCK_SIZE);
if (acquire_sem_etc(s->input_sem, len, B_CAN_INTERRUPT, 0LL) < B_OK)
- return -EIO;
+ return AVERROR(EIO);
amount = MIN(len, (AUDIO_BUFFER_SIZE - s->input_index));
memcpy(&s->buffer[s->input_index], buf, amount);
s->input_index += amount;
@@ -356,7 +356,7 @@ static int audio_read_header(AVFormatContext *s1, AVFormatParameters *ap)
st = av_new_stream(s1, 0);
if (!st) {
- return -ENOMEM;
+ return AVERROR(ENOMEM);
}
s->sample_rate = ap->sample_rate;
s->channels = ap->channels;
@@ -364,7 +364,7 @@ static int audio_read_header(AVFormatContext *s1, AVFormatParameters *ap)
ret = audio_open(s, 0, ap->device);
if (ret < 0) {
av_free(st);
- return -EIO;
+ return AVERROR(EIO);
}
/* take real parameters */
st->codec->codec_type = CODEC_TYPE_AUDIO;
@@ -384,7 +384,7 @@ static int audio_read_packet(AVFormatContext *s1, AVPacket *pkt)
status_t err;
if (av_new_packet(pkt, s->frame_size) < 0)
- return -EIO;
+ return AVERROR(EIO);
buf = (unsigned char *)pkt->data;
size = pkt->size;
while (size > 0) {
@@ -393,7 +393,7 @@ static int audio_read_packet(AVFormatContext *s1, AVPacket *pkt)
while ((err=acquire_sem_etc(s->output_sem, len, B_CAN_INTERRUPT, 0LL)) == B_INTERRUPTED);
if (err < B_OK) {
av_free_packet(pkt);
- return -EIO;
+ return AVERROR(EIO);
}
amount = MIN(len, (AUDIO_BUFFER_SIZE - s->output_index));
memcpy(buf, &s->buffer[s->output_index], amount);