[FFmpeg-cvslog] lavf: add an API to get output timestamps.
Nicolas George
git at videolan.org
Fri Jul 1 10:06:07 CEST 2011
ffmpeg | branch: master | Nicolas George <nicolas.george at normalesup.org> | Thu Jun 30 19:45:22 2011 +0200| [b442ca69d9d3cc50f00b43a25b200631cfb1e9ec] | committer: Nicolas George
lavf: add an API to get output timestamps.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b442ca69d9d3cc50f00b43a25b200631cfb1e9ec
---
libavformat/avformat.h | 21 +++++++++++++++++++++
libavformat/utils.c | 9 +++++++++
2 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 1734649..6069f19 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -316,6 +316,9 @@ typedef struct AVOutputFormat {
const AVClass *priv_class; ///< AVClass for the private context
+ void (*get_output_timestamp)(struct AVFormatContext *s, int stream,
+ int64_t *dts, int64_t *wall);
+
/* private fields */
struct AVOutputFormat *next;
} AVOutputFormat;
@@ -1518,6 +1521,24 @@ int av_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out,
*/
int av_write_trailer(AVFormatContext *s);
+/**
+ * Get timing information for the data currently output.
+ * The exact meaning of "currently output" depends on the format.
+ * It is mostly relevant for devices that have an internal buffer and/or
+ * work in real time.
+ * @param s media file handle
+ * @param stream stream in the media file
+ * @param dts[out] DTS of the last packet output for the stream, in stream
+ * time_base units
+ * @param wall[out] absolute time when that packet whas output,
+ * in microsecond
+ * @return 0 if OK, AVERROR(ENOSYS) if the format does not support it
+ * Note: some formats or devices may not allow to measure dts and wall
+ * atomically.
+ */
+int av_get_output_timestamp(struct AVFormatContext *s, int stream,
+ int64_t *dts, int64_t *wall);
+
#if FF_API_DUMP_FORMAT
/**
* @deprecated Deprecated in favor of av_dump_format().
diff --git a/libavformat/utils.c b/libavformat/utils.c
index b3f0e12..da240f6 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -3285,6 +3285,15 @@ fail:
return ret;
}
+int av_get_output_timestamp(struct AVFormatContext *s, int stream,
+ int64_t *dts, int64_t *wall)
+{
+ if (!s->oformat || !s->oformat->get_output_timestamp)
+ return AVERROR(ENOSYS);
+ s->oformat->get_output_timestamp(s, stream, dts, wall);
+ return 0;
+}
+
void ff_program_add_stream_index(AVFormatContext *ac, int progid, unsigned int idx)
{
int i, j;
More information about the ffmpeg-cvslog
mailing list