[FFmpeg-devel] perror() in libav*?
Luca Abeni
lucabe72
Fri Nov 16 13:21:46 CET 2007
Hi Michael,
Michael Niedermayer wrote:
[...]
>> Index: ffmpeg/libavutil/internal.h
>> ===================================================================
>> --- ffmpeg.orig/libavutil/internal.h 2007-11-16 10:01:45.000000000 +0100
>> +++ ffmpeg/libavutil/internal.h 2007-11-16 10:09:20.000000000 +0100
>> @@ -263,7 +263,7 @@
>> {\
>> p= av_mallocz(size);\
>> if(p==NULL && (size)!=0){\
>> - perror("malloc");\
>> + av_log(NULL, AV_LOG_ERROR, "malloc: %s", strerror(errno));\
>
> no strerror(errno) is silly
> its always "shit iam out of memory" here
Ok. So, should I just use
+ av_log(NULL, AV_LOG_ERROR, "Cannot allocate memory\n");\
[...]
>> audio_fd = open(audio_device, O_RDONLY);
>> if (audio_fd < 0) {
>> - perror(audio_device);
>> + av_log(NULL, AV_LOG_ERROR, "%s: %s\n", audio_device, strerror(errno));
>> return AVERROR(EIO);
>> }
>
> dont we have a better context than NULL ?
Unfortunately, not in this function. This code is in
static int audio_open(AudioData *s, int is_output, const char *audio_device)
so we have no AVFormatContext.
If it's needed, we can fix this later, by changing the audio_open() prototype.
I assume the rest of the patches are ok? If yes, I'll commit them soon.
Thanks,
Luca
More information about the ffmpeg-devel
mailing list