[FFmpeg-devel] [PATCH 1/2] lavf: add info_probe_size option.
Stefano Sabatini
stefasab at gmail.com
Fri Jun 1 13:14:10 CEST 2012
On date Monday 2012-04-23 14:02:40 +0200, Nicolas George encoded:
> This option separates the "probe format" and "probe packets
> for various info" semantic of the probesize option.
> Input formats are now allowed to raise it if necessary under
> special circumstances (example: large rawvideo frames).
>
> Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
> ---
> libavformat/avformat.h | 6 ++++++
> libavformat/options_table.h | 1 +
> libavformat/utils.c | 8 +++++---
> libavformat/version.h | 2 +-
> 4 files changed, 13 insertions(+), 4 deletions(-)
>
>
> I originally added a more lengthy documentation in avoptions_format.texi but
> it was overwritten. I did not find where to put it.
If you want my opinion that would be an hand-written file
libavformat.texi, but that would require much maintainance work and
possible desynching.
Another problem of the print_options.c approach is that it is
specifying avconv syntax (in documentation geared towards library
usage).
> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> index d2727d4..f6850bc 100644
> --- a/libavformat/avformat.h
> +++ b/libavformat/avformat.h
> @@ -1016,6 +1016,12 @@ typedef struct AVFormatContext {
> AVIOInterruptCB interrupt_callback;
>
> /**
> + * decoding: size of data to probe for stream information;
Nit: "for getting streams information"?
> + * encoding: unused.
> + */
> + unsigned int info_probe_size;
Bickering: would be "stream_info_probe_size" or "stream_probe_size"
more suited?
Also maybe "stream_info_probesize", consistent with probesize.
Also as Michael noted move this to the end of the struct.
> +
> + /**
> * Flags to enable debugging.
> */
> int debug;
> diff --git a/libavformat/options_table.h b/libavformat/options_table.h
> index 8d57c27..0cf2680 100644
> --- a/libavformat/options_table.h
> +++ b/libavformat/options_table.h
> @@ -64,6 +64,7 @@ static const AVOption options[]={
> {"careful", "consider things that violate the spec and have not been seen in the wild as errors", 0, AV_OPT_TYPE_CONST, {.dbl = AV_EF_CAREFUL }, INT_MIN, INT_MAX, D, "err_detect"},
> {"compliant", "consider all spec non compliancies as errors", 0, AV_OPT_TYPE_CONST, {.dbl = AV_EF_COMPLIANT }, INT_MIN, INT_MAX, D, "err_detect"},
> {"aggressive", "consider things that a sane encoder shouldnt do as an error", 0, AV_OPT_TYPE_CONST, {.dbl = AV_EF_AGGRESSIVE }, INT_MIN, INT_MAX, D, "err_detect"},
> +{"info_probe_size", "maximum size to probe for stream info", OFFSET(info_probe_size), AV_OPT_TYPE_INT, {.dbl = 0}, 0, INT_MAX-1, D},
Nit: an help text tells what the option does, not what its parameter
is, so that should be "set the maximum size of data to probe...".
> {NULL},
> };
>
> diff --git a/libavformat/utils.c b/libavformat/utils.c
> index de0cb54..b33e086 100644
> --- a/libavformat/utils.c
> +++ b/libavformat/utils.c
> @@ -2471,6 +2471,8 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
> ic->streams[i]->info->last_dts = AV_NOPTS_VALUE;
> }
>
> + if (!ic->info_probe_size)
> + ic->info_probe_size = ic->probesize;
> count = 0;
> read_size = 0;
> for(;;) {
> @@ -2519,15 +2521,15 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
> }
> }
> /* we did not get all the codec info, but we read too much data */
> - if (read_size >= ic->probesize) {
> + if (read_size >= ic->info_probe_size) {
> ret = count;
> - av_log(ic, AV_LOG_DEBUG, "Probe buffer size limit %d reached\n", ic->probesize);
> + av_log(ic, AV_LOG_DEBUG, "Stream info probe buffer size limit %d reached\n", ic->info_probe_size);
> for (i = 0; i < ic->nb_streams; i++)
> if (!ic->streams[i]->r_frame_rate.num &&
> ic->streams[i]->info->duration_count <= 1)
> av_log(ic, AV_LOG_WARNING,
> "Stream #%d: not enough frames to estimate rate; "
> - "consider increasing probesize\n", i);
> + "consider increasing info_probe_size\n", i);
> break;
> }
Thanks for working on this (I actually *need* this patchset).
--
FFmpeg = Fundamental and Faithful Multimedia Perfectionist Egregious Gnome
More information about the ffmpeg-devel
mailing list