[Ffmpeg-devel] [PATCH] Allow choosing display and screen number for x11grab device
Fri Dec 15 19:06:45 CET 2006
On Fri, Dec 15, 2006 at 03:11:16PM +0100, Michael Niedermayer wrote:
> On Wed, Dec 13, 2006 at 10:58:59PM +0100, Panagiotis Issaris wrote:
> > Hi,
> > On Wed, Dec 13, 2006 at 10:32:21PM +0100, Panagiotis Issaris wrote:
> > >[...]
> > > > ffmpeg -vd x11:0.1 -s 640x480 test.avi
> > > Furthermore, I think there are some errorhandling problems, which I did not want
> > > to fix in the same patch, as I wanted to address separate issues in separate
> > > patches.
> > This is an incremental patch with my first try to fix these error handling
> > problems. I'm not sure if this is the correct way to handle errors as I am a
> > Xlib-newbie. It seemed cleaner to me to release resources if things fail after
> > some allocations succeeded. Furthermore, there's a lot of code duplication,
> > which in Linux is avoided by using gotos :) I could also make a function that is
> > called on every failure and does all the releasing using one "if (!...)"
> > condition per call.
> i prefer a goto fail over the code duplication
Indeed, goto is always the correct solution to this problem. Writing
duplicate, huge-nested-conditional, or otherwise-nasty code for the
sake of avoiding the goto keyword is severely misguided and should be
the topic of its own "considered harmful" paper.
More information about the ffmpeg-devel