[FFmpeg-devel] [PATCH] avformat: export probe score

Michael Niedermayer michaelni at gmx.at
Wed Aug 28 00:27:56 CEST 2013


On Tue, Aug 27, 2013 at 09:47:16PM +0000, Paul B Mahol wrote:
> On 8/27/13, Michael Niedermayer <michaelni at gmx.at> wrote:
> > Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> > ---
> >  doc/formats.texi            |    4 ++++
> >  libavformat/avformat.h      |   18 ++++++++++++++++--
> >  libavformat/options_table.h |    1 +
> >  libavformat/utils.c         |   18 ++++++++++++++----
> >  4 files changed, 35 insertions(+), 6 deletions(-)
> >
> > diff --git a/doc/formats.texi b/doc/formats.texi
> > index e179755..21d4685 100644
> > --- a/doc/formats.texi
> > +++ b/doc/formats.texi
> > @@ -137,6 +137,10 @@ non-monotonic negative timestamps.
> >  Flush the underlying I/O stream after each packet. Default 1 enables it,
> > and
> >  has the effect of reducing the latency; 0 disables it and may slightly
> >  increase performance in some cases.
> > +
> > + at item probe_score @var{integer} (@emph{input})
> > +This field is only accessable programatically, its value represents the
> > score
> > +by which the format was detected.
> >  @end table
> >
> >  @c man end FORMAT OPTIONS
> > diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> > index 77efc61..b414a0c 100644
> > --- a/libavformat/avformat.h
> > +++ b/libavformat/avformat.h
> > @@ -1237,6 +1237,13 @@ typedef struct AVFormatContext {
> >       */
> >      int flush_packets;
> >
> > +    /**
> > +     * format probing score
> > +     * - encoding: unused
> > +     * - decoding: set by avformat, read by user via AVOptions (NO direct
> > access)
> > +     */
> > +    int probe_score;
> > +
> >      /*****************************************************************
> >       * All fields below this line are not part of the public API. They
> >       * may not be used outside of libavformat and can be changed and
> > @@ -1504,13 +1511,20 @@ AVInputFormat *av_probe_input_format3(AVProbeData
> > *pd, int is_opened, int *score
> >   * @param logctx the log context
> >   * @param offset the offset within the bytestream to probe from
> >   * @param max_probe_size the maximum probe buffer size (zero for default)
> > - * @return 0 in case of success, a negative value corresponding to an
> > + * @return the score in case of success, a negative value corresponding to
> > an
> > + *         the maximal score is AVPROBE_SCORE_MAX
> >   * AVERROR code otherwise
> >   */
> > +int av_probe_input_buffer2(AVIOContext *pb, AVInputFormat **fmt,
> > +                           const char *filename, void *logctx,
> > +                           unsigned int offset, unsigned int
> > max_probe_size);
> > +
> > +/**
> > + * Like av_probe_input_buffer2() but returns 0 on success
> > + */
> >  int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt,
> >                            const char *filename, void *logctx,
> >                            unsigned int offset, unsigned int
> > max_probe_size);
> > -
> >  /**
> >   * Open an input stream and read the header. The codecs are not opened.
> >   * The stream must be closed with avformat_close_input().
> > diff --git a/libavformat/options_table.h b/libavformat/options_table.h
> > index a87868e..5392e22 100644
> > --- a/libavformat/options_table.h
> > +++ b/libavformat/options_table.h
> > @@ -76,6 +76,7 @@ static const AVOption avformat_options[] = {
> >  {"skip_initial_bytes", "skip initial bytes", OFFSET(skip_initial_bytes),
> > AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX-1, D},
> >  {"correct_ts_overflow", "correct single timestamp overflows",
> > OFFSET(correct_ts_overflow), AV_OPT_TYPE_INT, {.i64 = 1}, 0, 1, D},
> >  {"flush_packets", "enable flushing of the I/O context after each packet",
> > OFFSET(flush_packets), AV_OPT_TYPE_INT, {.i64 = 1}, 0, 1, E},
> > +{"probe_score", "score with which the format was probed",
> > OFFSET(probe_score), AV_OPT_TYPE_INT, {.i64 = 0}, 0, AVPROBE_SCORE_MAX,},
> 
> This stills allow user to set it? (for example with ffmpeg)

it should not, and now it also does not

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

What does censorship reveal? It reveals fear. -- Julian Assange
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130828/ff9a2c2b/attachment.asc>


More information about the ffmpeg-devel mailing list