[FFmpeg-devel] perror() in libav*?

Michael Niedermayer michaelni
Fri Nov 16 17:08:12 CET 2007


On Fri, Nov 16, 2007 at 01:21:46PM +0100, Luca Abeni wrote:
> 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");\

yes, but you have no humor
"install more ram, increase swap partition or close some of your pron downloads"
"send us <current ram price + shipping costs>*5 and we will send you a module
 to unlock the requested feature"
...


> 
> [...]
> >>          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.

yes commit!

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Thouse who are best at talking, realize last or never when they are wrong.
-------------- 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/840d83eb/attachment.pgp>



More information about the ffmpeg-devel mailing list