[FFmpeg-devel] [PATCH 1/3] avformat: add AV_DISPOSITION_FRAME_BASED flag

wm4 nfxjfg at googlemail.com
Tue Feb 18 22:52:50 CET 2014


On Tue, 18 Feb 2014 22:47:05 +0100 (CET)
Marton Balint <cus at passwd.hu> wrote:

> 
> On Tue, 18 Feb 2014, Clément Bœsch wrote:
> 
> > On Mon, Feb 17, 2014 at 09:49:34PM +0100, wm4 wrote:
> >> This is needed to distinguish subtitles with real timestamps, and
> >> subtitles which use frame numbers. Formats like MicroDVD can have both,
> >> depending on the file header.
> >> ---
> >>  doc/APIchanges         | 3 +++
> >>  libavformat/avformat.h | 7 +++++++
> >>  2 files changed, 10 insertions(+)
> >>
> >> diff --git a/doc/APIchanges b/doc/APIchanges
> >> index 047b9bd..32532ca 100644
> >> --- a/doc/APIchanges
> >> +++ b/doc/APIchanges
> >> @@ -15,6 +15,9 @@ libavutil:     2012-10-22
> >>
> >>  API changes, most recent first:
> >>
> >> +2014-02-xx - xxxxxxx - lavf 55.33.xxx - avformat.h
> >> +  Add AV_DISPOSITION_FRAME_BASED flag to indicate subtitle timestamp type.
> >> +
> >>  2014-02-xx - xxxxxxx - lavd 55.10.100 - avdevice.h
> >>    Add avdevice_list_devices() and avdevice_free_list_devices()
> >>
> >> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> >> index c990ad6..9491c82 100644
> >> --- a/libavformat/avformat.h
> >> +++ b/libavformat/avformat.h
> >> @@ -725,6 +725,13 @@ typedef struct AVIndexEntry {
> >>  #define AV_DISPOSITION_METADATA     0x40000
> >>
> >>  /**
> >> + * This is a frame-based subtitle format. It does not contain any real
> >> + * timestamps, just frame numbers. Returned AVPackets will have the pts field
> >> + * set to the frame number, and the stream time_base is a made-up fallback.
> >> + */
> >> +#define AV_DISPOSITION_FRAME_BASED  0x80000
> >> +
> >> +/**
> >>   * Options for behavior on timestamp wrap detection.
> >>   */
> >>  #define AV_PTS_WRAP_IGNORE      0   ///< ignore the wrap
> >
> > OK so you prefer introducing a new symbol instead of adding a private
> > option the microdvd demuxer? (to read the FPS and check if it was set or
> > not).
> >
> > I'm a bit uncomfortable adding a generic flag for just a single format;
> > can you find another format in the same situation? (AQTitle?)
> >
> > If you can't, I'd really like to have the private option way...
> 
> I'd vote for a private option myself - e.g. ffmpeg users directly 
> benefit from being able to set the default time base for microdvd format 
> as a demuxer option.

Well, there are two things. First is telling the application whether
the format is frame-based or not. Second is overriding the time base in
case it's frame-based.

I'm not sure how that is supposed to integrate with ffmpeg.c.

> BTW what is the main reason for not using 0/0 or 0/1 as an unkown time 
> base? FFmpeg depens on a sane time base everywhere? Or it would break 
> existing applications?

One could use a dummy time base, and allow the application to detect
frame-based or not by checking the time base. But I'm not sure if that
is a good idea.



More information about the ffmpeg-devel mailing list