* [FFmpeg-devel] [PATCH] avformat: add AVFormatContext.first_pts_wallclock
@ 2022-06-16 9:09 Gyan Doshi
2022-06-18 4:01 ` Gyan Doshi
0 siblings, 1 reply; 6+ messages in thread
From: Gyan Doshi @ 2022-06-16 9:09 UTC (permalink / raw)
To: ffmpeg-devel
Stores wallclock time for the first packet received with a pts.
---
doc/APIchanges | 3 +++
libavformat/avformat.h | 10 ++++++++++
libavformat/demux.c | 3 +++
libavformat/options.c | 1 +
libavformat/version.h | 2 +-
5 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/doc/APIchanges b/doc/APIchanges
index 5857e67ae6..3d472b8963 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -14,6 +14,9 @@ libavutil: 2021-04-27
API changes, most recent first:
+2022-06-xx - xxxxxxxxxx - lavf 59.26.100 - avformat.h
+ Add and set AVFormatContext.first_pts_wallclock field.
+
2022-06-12 - xxxxxxxxxx - lavf 59.25.100 - avio.h
Add avio_vprintf(), similar to avio_printf() but allow to use it
from within a function taking a variable argument list as input.
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index f12fa7d904..56f9656a68 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1808,6 +1808,16 @@ typedef struct AVFormatContext {
*/
int max_probe_packets;
+ /**
+ * Wallclock start time of the stream in real world time, in microseconds
+ * since the Unix epoch (00:00 1st January 1970). That is, the first packet
+ * with a set pts was received at this real world time.
+ * - demuxing: Set by libavformat. Users may want to use start_time_realtime
+ * if set.
+ * - muxing: unused.
+ */
+ int64_t first_pts_wallclock;
+
/**
* A callback for closing the streams opened with AVFormatContext.io_open().
*
diff --git a/libavformat/demux.c b/libavformat/demux.c
index 1620716716..9335a6efcd 100644
--- a/libavformat/demux.c
+++ b/libavformat/demux.c
@@ -628,6 +628,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
force_codec_ids(s, st);
+ if (s->first_pts_wallclock == AV_NOPTS_VALUE && pkt->pts != AV_NOPTS_VALUE)
+ s->first_pts_wallclock = av_gettime();
+
/* TODO: audio: time filter; video: frame reordering (pts != dts) */
if (s->use_wallclock_as_timestamps)
pkt->dts = pkt->pts = av_rescale_q(av_gettime(), AV_TIME_BASE_Q, st->time_base);
diff --git a/libavformat/options.c b/libavformat/options.c
index 0079a06d9a..4cc168939f 100644
--- a/libavformat/options.c
+++ b/libavformat/options.c
@@ -184,6 +184,7 @@ AVFormatContext *avformat_alloc_context(void)
return NULL;
}
+ s->first_pts_wallclock = AV_NOPTS_VALUE;
si->shortest_end = AV_NOPTS_VALUE;
return s;
diff --git a/libavformat/version.h b/libavformat/version.h
index 966ebb7ed3..0708d619c0 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -31,7 +31,7 @@
#include "version_major.h"
-#define LIBAVFORMAT_VERSION_MINOR 25
+#define LIBAVFORMAT_VERSION_MINOR 26
#define LIBAVFORMAT_VERSION_MICRO 100
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
--
2.36.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avformat: add AVFormatContext.first_pts_wallclock
2022-06-16 9:09 [FFmpeg-devel] [PATCH] avformat: add AVFormatContext.first_pts_wallclock Gyan Doshi
@ 2022-06-18 4:01 ` Gyan Doshi
2022-06-18 5:00 ` Andreas Rheinhardt
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Gyan Doshi @ 2022-06-18 4:01 UTC (permalink / raw)
To: ffmpeg-devel
On 2022-06-16 02:39 pm, Gyan Doshi wrote:
> Stores wallclock time for the first packet received with a pts.
Comments?
> ---
> doc/APIchanges | 3 +++
> libavformat/avformat.h | 10 ++++++++++
> libavformat/demux.c | 3 +++
> libavformat/options.c | 1 +
> libavformat/version.h | 2 +-
> 5 files changed, 18 insertions(+), 1 deletion(-)
>
> diff --git a/doc/APIchanges b/doc/APIchanges
> index 5857e67ae6..3d472b8963 100644
> --- a/doc/APIchanges
> +++ b/doc/APIchanges
> @@ -14,6 +14,9 @@ libavutil: 2021-04-27
>
> API changes, most recent first:
>
> +2022-06-xx - xxxxxxxxxx - lavf 59.26.100 - avformat.h
> + Add and set AVFormatContext.first_pts_wallclock field.
> +
> 2022-06-12 - xxxxxxxxxx - lavf 59.25.100 - avio.h
> Add avio_vprintf(), similar to avio_printf() but allow to use it
> from within a function taking a variable argument list as input.
> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> index f12fa7d904..56f9656a68 100644
> --- a/libavformat/avformat.h
> +++ b/libavformat/avformat.h
> @@ -1808,6 +1808,16 @@ typedef struct AVFormatContext {
> */
> int max_probe_packets;
>
> + /**
> + * Wallclock start time of the stream in real world time, in microseconds
> + * since the Unix epoch (00:00 1st January 1970). That is, the first packet
> + * with a set pts was received at this real world time.
> + * - demuxing: Set by libavformat. Users may want to use start_time_realtime
> + * if set.
> + * - muxing: unused.
> + */
> + int64_t first_pts_wallclock;
> +
> /**
> * A callback for closing the streams opened with AVFormatContext.io_open().
> *
> diff --git a/libavformat/demux.c b/libavformat/demux.c
> index 1620716716..9335a6efcd 100644
> --- a/libavformat/demux.c
> +++ b/libavformat/demux.c
> @@ -628,6 +628,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
>
> force_codec_ids(s, st);
>
> + if (s->first_pts_wallclock == AV_NOPTS_VALUE && pkt->pts != AV_NOPTS_VALUE)
> + s->first_pts_wallclock = av_gettime();
> +
> /* TODO: audio: time filter; video: frame reordering (pts != dts) */
> if (s->use_wallclock_as_timestamps)
> pkt->dts = pkt->pts = av_rescale_q(av_gettime(), AV_TIME_BASE_Q, st->time_base);
> diff --git a/libavformat/options.c b/libavformat/options.c
> index 0079a06d9a..4cc168939f 100644
> --- a/libavformat/options.c
> +++ b/libavformat/options.c
> @@ -184,6 +184,7 @@ AVFormatContext *avformat_alloc_context(void)
> return NULL;
> }
>
> + s->first_pts_wallclock = AV_NOPTS_VALUE;
> si->shortest_end = AV_NOPTS_VALUE;
>
> return s;
> diff --git a/libavformat/version.h b/libavformat/version.h
> index 966ebb7ed3..0708d619c0 100644
> --- a/libavformat/version.h
> +++ b/libavformat/version.h
> @@ -31,7 +31,7 @@
>
> #include "version_major.h"
>
> -#define LIBAVFORMAT_VERSION_MINOR 25
> +#define LIBAVFORMAT_VERSION_MINOR 26
> #define LIBAVFORMAT_VERSION_MICRO 100
>
> #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avformat: add AVFormatContext.first_pts_wallclock
2022-06-18 4:01 ` Gyan Doshi
@ 2022-06-18 5:00 ` Andreas Rheinhardt
2022-06-18 5:47 ` Gyan Doshi
2022-06-18 12:26 ` "zhilizhao(赵志立)"
2022-06-18 15:02 ` Anton Khirnov
2 siblings, 1 reply; 6+ messages in thread
From: Andreas Rheinhardt @ 2022-06-18 5:00 UTC (permalink / raw)
To: ffmpeg-devel
Gyan Doshi:
>
>
> On 2022-06-16 02:39 pm, Gyan Doshi wrote:
>> Stores wallclock time for the first packet received with a pts.
>
> Comments?
>> ---
>> doc/APIchanges | 3 +++
>> libavformat/avformat.h | 10 ++++++++++
>> libavformat/demux.c | 3 +++
>> libavformat/options.c | 1 +
>> libavformat/version.h | 2 +-
>> 5 files changed, 18 insertions(+), 1 deletion(-)
>>
>> diff --git a/doc/APIchanges b/doc/APIchanges
>> index 5857e67ae6..3d472b8963 100644
>> --- a/doc/APIchanges
>> +++ b/doc/APIchanges
>> @@ -14,6 +14,9 @@ libavutil: 2021-04-27
>> API changes, most recent first:
>> +2022-06-xx - xxxxxxxxxx - lavf 59.26.100 - avformat.h
>> + Add and set AVFormatContext.first_pts_wallclock field.
>> +
>> 2022-06-12 - xxxxxxxxxx - lavf 59.25.100 - avio.h
>> Add avio_vprintf(), similar to avio_printf() but allow to use it
>> from within a function taking a variable argument list as input.
>> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
>> index f12fa7d904..56f9656a68 100644
>> --- a/libavformat/avformat.h
>> +++ b/libavformat/avformat.h
>> @@ -1808,6 +1808,16 @@ typedef struct AVFormatContext {
>> */
>> int max_probe_packets;
>> + /**
>> + * Wallclock start time of the stream in real world time, in
>> microseconds
>> + * since the Unix epoch (00:00 1st January 1970). That is, the
>> first packet
>> + * with a set pts was received at this real world time.
>> + * - demuxing: Set by libavformat. Users may want to use
>> start_time_realtime
>> + * if set.
>> + * - muxing: unused.
>> + */
>> + int64_t first_pts_wallclock;
>> +
>> /**
>> * A callback for closing the streams opened with
>> AVFormatContext.io_open().
>> *
>> diff --git a/libavformat/demux.c b/libavformat/demux.c
>> index 1620716716..9335a6efcd 100644
>> --- a/libavformat/demux.c
>> +++ b/libavformat/demux.c
>> @@ -628,6 +628,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
>> force_codec_ids(s, st);
>> + if (s->first_pts_wallclock == AV_NOPTS_VALUE && pkt->pts !=
>> AV_NOPTS_VALUE)
>> + s->first_pts_wallclock = av_gettime();
>> +
>> /* TODO: audio: time filter; video: frame reordering (pts !=
>> dts) */
>> if (s->use_wallclock_as_timestamps)
>> pkt->dts = pkt->pts = av_rescale_q(av_gettime(),
>> AV_TIME_BASE_Q, st->time_base);
>> diff --git a/libavformat/options.c b/libavformat/options.c
>> index 0079a06d9a..4cc168939f 100644
>> --- a/libavformat/options.c
>> +++ b/libavformat/options.c
>> @@ -184,6 +184,7 @@ AVFormatContext *avformat_alloc_context(void)
>> return NULL;
>> }
>> + s->first_pts_wallclock = AV_NOPTS_VALUE;
>> si->shortest_end = AV_NOPTS_VALUE;
>> return s;
>> diff --git a/libavformat/version.h b/libavformat/version.h
>> index 966ebb7ed3..0708d619c0 100644
>> --- a/libavformat/version.h
>> +++ b/libavformat/version.h
>> @@ -31,7 +31,7 @@
>> #include "version_major.h"
>> -#define LIBAVFORMAT_VERSION_MINOR 25
>> +#define LIBAVFORMAT_VERSION_MINOR 26
>> #define LIBAVFORMAT_VERSION_MICRO 100
>> #define LIBAVFORMAT_VERSION_INT
>> AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
>
Is there anyone who asked for this feature?
- Andreas
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avformat: add AVFormatContext.first_pts_wallclock
2022-06-18 5:00 ` Andreas Rheinhardt
@ 2022-06-18 5:47 ` Gyan Doshi
0 siblings, 0 replies; 6+ messages in thread
From: Gyan Doshi @ 2022-06-18 5:47 UTC (permalink / raw)
To: ffmpeg-devel
On 2022-06-18 10:30 am, Andreas Rheinhardt wrote:
> Gyan Doshi:
>>
>> On 2022-06-16 02:39 pm, Gyan Doshi wrote:
>>> Stores wallclock time for the first packet received with a pts.
>> Comments?
>>> ---
>>> doc/APIchanges | 3 +++
>>> libavformat/avformat.h | 10 ++++++++++
>>> libavformat/demux.c | 3 +++
>>> libavformat/options.c | 1 +
>>> libavformat/version.h | 2 +-
>>> 5 files changed, 18 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/doc/APIchanges b/doc/APIchanges
>>> index 5857e67ae6..3d472b8963 100644
>>> --- a/doc/APIchanges
>>> +++ b/doc/APIchanges
>>> @@ -14,6 +14,9 @@ libavutil: 2021-04-27
>>> API changes, most recent first:
>>> +2022-06-xx - xxxxxxxxxx - lavf 59.26.100 - avformat.h
>>> + Add and set AVFormatContext.first_pts_wallclock field.
>>> +
>>> 2022-06-12 - xxxxxxxxxx - lavf 59.25.100 - avio.h
>>> Add avio_vprintf(), similar to avio_printf() but allow to use it
>>> from within a function taking a variable argument list as input.
>>> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
>>> index f12fa7d904..56f9656a68 100644
>>> --- a/libavformat/avformat.h
>>> +++ b/libavformat/avformat.h
>>> @@ -1808,6 +1808,16 @@ typedef struct AVFormatContext {
>>> */
>>> int max_probe_packets;
>>> + /**
>>> + * Wallclock start time of the stream in real world time, in
>>> microseconds
>>> + * since the Unix epoch (00:00 1st January 1970). That is, the
>>> first packet
>>> + * with a set pts was received at this real world time.
>>> + * - demuxing: Set by libavformat. Users may want to use
>>> start_time_realtime
>>> + * if set.
>>> + * - muxing: unused.
>>> + */
>>> + int64_t first_pts_wallclock;
>>> +
>>> /**
>>> * A callback for closing the streams opened with
>>> AVFormatContext.io_open().
>>> *
>>> diff --git a/libavformat/demux.c b/libavformat/demux.c
>>> index 1620716716..9335a6efcd 100644
>>> --- a/libavformat/demux.c
>>> +++ b/libavformat/demux.c
>>> @@ -628,6 +628,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
>>> force_codec_ids(s, st);
>>> + if (s->first_pts_wallclock == AV_NOPTS_VALUE && pkt->pts !=
>>> AV_NOPTS_VALUE)
>>> + s->first_pts_wallclock = av_gettime();
>>> +
>>> /* TODO: audio: time filter; video: frame reordering (pts !=
>>> dts) */
>>> if (s->use_wallclock_as_timestamps)
>>> pkt->dts = pkt->pts = av_rescale_q(av_gettime(),
>>> AV_TIME_BASE_Q, st->time_base);
>>> diff --git a/libavformat/options.c b/libavformat/options.c
>>> index 0079a06d9a..4cc168939f 100644
>>> --- a/libavformat/options.c
>>> +++ b/libavformat/options.c
>>> @@ -184,6 +184,7 @@ AVFormatContext *avformat_alloc_context(void)
>>> return NULL;
>>> }
>>> + s->first_pts_wallclock = AV_NOPTS_VALUE;
>>> si->shortest_end = AV_NOPTS_VALUE;
>>> return s;
>>> diff --git a/libavformat/version.h b/libavformat/version.h
>>> index 966ebb7ed3..0708d619c0 100644
>>> --- a/libavformat/version.h
>>> +++ b/libavformat/version.h
>>> @@ -31,7 +31,7 @@
>>> #include "version_major.h"
>>> -#define LIBAVFORMAT_VERSION_MINOR 25
>>> +#define LIBAVFORMAT_VERSION_MINOR 26
>>> #define LIBAVFORMAT_VERSION_MICRO 100
>>> #define LIBAVFORMAT_VERSION_INT
>>> AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
> Is there anyone who asked for this feature?
I'm using it for a live inputs sync patch that I'll submit after some
more testing in a few days,
Regards,
Gyan
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avformat: add AVFormatContext.first_pts_wallclock
2022-06-18 4:01 ` Gyan Doshi
2022-06-18 5:00 ` Andreas Rheinhardt
@ 2022-06-18 12:26 ` "zhilizhao(赵志立)"
2022-06-18 15:02 ` Anton Khirnov
2 siblings, 0 replies; 6+ messages in thread
From: "zhilizhao(赵志立)" @ 2022-06-18 12:26 UTC (permalink / raw)
To: FFmpeg development discussions and patches
> On Jun 18, 2022, at 12:01 PM, Gyan Doshi <ffmpeg@gyani.pro> wrote:
>
>
> On 2022-06-16 02:39 pm, Gyan Doshi wrote:
>> Stores wallclock time for the first packet received with a pts.
>
> Comments?
>> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
>> index f12fa7d904..56f9656a68 100644
>> --- a/libavformat/avformat.h
>> +++ b/libavformat/avformat.h
>> @@ -1808,6 +1808,16 @@ typedef struct AVFormatContext {
>> */
>> int max_probe_packets;
>> + /**
>> + * Wallclock start time of the stream in real world time, in microseconds
>> + * since the Unix epoch (00:00 1st January 1970). That is, the first packet
>> + * with a set pts was received at this real world time.
>> + * - demuxing: Set by libavformat. Users may want to use start_time_realtime
>> + * if set.
>> + * - muxing: unused.
>> + */
>> + int64_t first_pts_wallclock;
>> +
>> /**
>> * A callback for closing the streams opened with AVFormatContext.io_open().
>> *
It should be put after io_close2 to keep ABI compatible.
The usecase isn’t clear for this single patch.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avformat: add AVFormatContext.first_pts_wallclock
2022-06-18 4:01 ` Gyan Doshi
2022-06-18 5:00 ` Andreas Rheinhardt
2022-06-18 12:26 ` "zhilizhao(赵志立)"
@ 2022-06-18 15:02 ` Anton Khirnov
2 siblings, 0 replies; 6+ messages in thread
From: Anton Khirnov @ 2022-06-18 15:02 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Quoting Gyan Doshi (2022-06-18 06:01:21)
>
>
> On 2022-06-16 02:39 pm, Gyan Doshi wrote:
> > Stores wallclock time for the first packet received with a pts.
>
> Comments?
This looks very ad-hoc and IMO does not belong in the library unless you
have a very strong reason.
--
Anton Khirnov
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-06-18 15:02 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-16 9:09 [FFmpeg-devel] [PATCH] avformat: add AVFormatContext.first_pts_wallclock Gyan Doshi
2022-06-18 4:01 ` Gyan Doshi
2022-06-18 5:00 ` Andreas Rheinhardt
2022-06-18 5:47 ` Gyan Doshi
2022-06-18 12:26 ` "zhilizhao(赵志立)"
2022-06-18 15:02 ` Anton Khirnov
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git