[FFmpeg-devel] [RFC] ffprobe -sep option

Clément Bœsch ubitux at gmail.com
Sat Aug 20 20:52:03 CEST 2011

On Sat, Aug 20, 2011 at 08:40:24PM +0200, Stefano Sabatini wrote:
> On date Friday 2011-08-19 16:19:40 +0200, Nicolas George encoded:
> > Le decadi 30 thermidor, an CCXIX, Stefano Sabatini a écrit :
> > > which is sometimes easier to parse of the corresponding
> > > one-line-per-field output.
> > 
> > Very good news, thanks.
> > 
> > > [PACKET],codec_type=video,stream_index=0,pts=137250,pts_time=1.525000,dts=137250,dts_time=1.525000,duration=3750,duration_time=0.041667,size=16.000000,pos=1880,flags=_,[/PACKET]
> > > which is not very nice (so should I add a separate option for that?).
> > 
> > This kind of output will probably be mostly piped to cut/awk/perl, so nice
> > is not really necessary. No need to overthink it.
> Looking forward for Clement patches which provide a more generic
> solution and conflict with this one, I'll possibly base an updated
> patch on his work.

The current solution I proposed is quite hackish. I'm looking for some
something better; maybe some "writers" would be more appropriate (a
default writer for the current output, a JSON writer, a "compact" writer,
etc.). Unfortunately, it will certainly mean multiplying by 2 the size of
the current ffprobe code.

Are you OK with that?

To be more specific about the amount of code needed, writers would need a
few functions:

 - format print, to handle every cases such as rational printing);
 - string print, can be handled by format print but it's pretty common so
   it simplifies things
 - int print, since for instance JSON will not add "" around the value.

And also those 3 functions need a "zero" version which will be used at
least in JSON in order to not add a comma as separator for the first entry
(JSON doesn't support trailing comma...).

So basically, at least 6 functions to define for each writer. Right now,
the proposed patch I sent is just a hack with "if (json ...)" everywhere,
which is not really flexible.

Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110820/197f6e64/attachment.asc>

More information about the ffmpeg-devel mailing list