[FFmpeg-devel] perror() in libav*?
Michael Niedermayer
michaelni
Fri Nov 16 13:08:43 CET 2007
On Fri, Nov 16, 2007 at 11:06:42AM +0100, Luca Abeni wrote:
> Hi all,
>
> Luca Abeni wrote:
>>>> What do other people think?
>>> use 1
>> Ok, I'll send a patch for 1) in a short time
>
> And here are the patches:
> - remove-perror-from-libavutil.diff changes CHECKED_ALLOCZ() not to
> use perror() (calls to perror() are included in mpegvideo.o, h264.o
> and others due to this)
> - remove-perror-from-grabbers.diff fixes audio, v4l and dv1394 not
> to use perror()
> - remove-perror-from-net.diff fixes udp.c
> - Finally, avoid-perror.diff generates a linking error when perror
> is used in libav*
this is ok, commit as soon as it compiles with that!
[...]
> 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
> goto fail;\
> }\
> }
> Index: ffmpeg/libavformat/audio.c
> ===================================================================
> --- ffmpeg.orig/libavformat/audio.c 2007-11-16 10:10:30.000000000 +0100
> +++ ffmpeg/libavformat/audio.c 2007-11-16 10:14:15.000000000 +0100
> @@ -58,7 +58,7 @@
> else
> 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 ?
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Let us carefully observe those good qualities wherein our enemies excel us
and endeavor to excel them, by avoiding what is faulty, and imitating what
is excellent in them. -- Plutarch
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20071116/8cad191e/attachment.pgp>
More information about the ffmpeg-devel
mailing list