[FFmpeg-devel] [PATCH] ffprobe: rework/fix ini writer
Clément Bœsch
ubitux at gmail.com
Thu Sep 27 09:14:38 CEST 2012
On Thu, Sep 27, 2012 at 12:40:24AM +0200, Stefano Sabatini wrote:
> Do not build from scratch the section header for each section, but build
> it using the previous level buffer, thus improving efficiency.
>
> Also fix some few corner cases related to numbering which are exposed by
> the pending disposition patch.
> ---
> ffprobe.c | 48 ++++++++++++++++++++++++++++++++++--------------
> 1 files changed, 34 insertions(+), 14 deletions(-)
>
> diff --git a/ffprobe.c b/ffprobe.c
> index 8550c22..9d804b0 100644
> --- a/ffprobe.c
> +++ b/ffprobe.c
> @@ -956,6 +956,7 @@ static const Writer flat_writer = {
> typedef struct {
> const AVClass *class;
> int hierarchical;
> + AVBPrint section_header[SECTION_MAX_NB_LEVELS];
> } INIContext;
>
> #undef OFFSET
> @@ -969,6 +970,25 @@ static const AVOption ini_options[] = {
>
> DEFINE_WRITER_CLASS(ini);
>
> +static int ini_init(WriterContext *wctx)
> +{
> + INIContext *ini = wctx->priv;
> + int i;
> +
> + for (i = 0; i < SECTION_MAX_NB_LEVELS; i++)
> + av_bprint_init(&ini->section_header[i], 1, AV_BPRINT_SIZE_UNLIMITED);
> + return 0;
> +}
> +
> +static void ini_uninit(WriterContext *wctx)
> +{
> + INIContext *ini = wctx->priv;
> + int i;
> +
> + for (i = 0; i < SECTION_MAX_NB_LEVELS; i++)
> + av_bprint_finalize(&ini->section_header[i], NULL);
> +}
> +
Aren't these AVBPrint buffers kind of handy for most of the writers? If
so, it might makes sense to put them in the WriterContext.
[...]
--
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/20120927/0f5aeb9a/attachment.asc>
More information about the ffmpeg-devel
mailing list