[FFmpeg-devel] [PATCH] Extracting NTP timestamp from RTCP
Michael Niedermayer
michaelni at gmx.at
Thu Nov 7 21:55:11 CET 2013
On Thu, Nov 07, 2013 at 11:10:39AM -0700, Fred Rothganger wrote:
> On 10/30/2013 10:19 AM, Michael Niedermayer wrote:
> >
> >rtpctx->st can be NULL
> >
> >also probably should have a note in APIChanges
> >micro or minor version bump
> >and docs in avformat.h
> >
> >
>
> Here is a revised patch. My last submission on 10/30 seems to have
> gotten lost.
> doc/APIchanges | 3 +++
> libavformat/avformat.h | 2 +-
> libavformat/rtsp.c | 11 +++++++++++
> libavformat/version.h | 2 +-
> 4 files changed, 16 insertions(+), 2 deletions(-)
> 38c54234ff1b7c40cb52aafdd73ba81a7876d0cf rtsp.patch
> diff --git a/doc/APIchanges b/doc/APIchanges
> index dfdc159..be3d90a 100644
> --- a/doc/APIchanges
> +++ b/doc/APIchanges
> @@ -15,6 +15,9 @@ libavutil: 2012-10-22
>
> API changes, most recent first:
>
> +2013-11-07 - xxxxxxx - lavf 55.21.101 - avformat.h
> + Set AVFormatContext.start_time_realtime when decoding.
> +
> 2013-11-xx - xxxxxxx - lavc 55.41.100 / 55.25.0 - avcodec.h
> lavu 52.51.100 - frame.h
> Add ITU-R BT.2020 and other not yet included values to color primaries,
> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> index 6bd54ce..1c4929d 100644
> --- a/libavformat/avformat.h
> +++ b/libavformat/avformat.h
> @@ -1127,7 +1127,7 @@ typedef struct AVFormatContext {
> * since the unix epoch (00:00 1st January 1970). That is, pts=0
> * in the stream was captured at this real world time.
> * - encoding: Set by user.
> - * - decoding: Unused.
> + * - decoding: Set by libavformt.
> */
> int64_t start_time_realtime;
>
> diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
> index 3b88fc7..8a1f15c 100644
> --- a/libavformat/rtsp.c
> +++ b/libavformat/rtsp.c
> @@ -2051,6 +2051,17 @@ redo:
> * as this one. */
> int i;
> AVStream *st = NULL;
> + if (s->start_time_realtime == 0) {
> + s->start_time_realtime =
> + (((uint64_t) rtpctx->first_rtcp_ntp_time >> 32 ) - NTP_OFFSET) * 1000000
> + + (( rtpctx->first_rtcp_ntp_time & 0xFFFFFFFF) * 1000000 >> 32);
why doesnt this use av_rescale ?
> + if (rtpctx->st) {
> + s->start_time_realtime -=
> + av_rescale (rtpctx->rtcp_ts_offset,
> + (uint64_t) rtpctx->st->time_base.num * 1000000,
> + rtpctx->st->time_base.den);
> + }
> + }
> if (rtsp_st->stream_index >= 0)
> st = s->streams[rtsp_st->stream_index];
> for (i = 0; i < rt->nb_rtsp_streams; i++) {
> diff --git a/libavformat/version.h b/libavformat/version.h
> index a27dce3..871cef7 100644
> --- a/libavformat/version.h
> +++ b/libavformat/version.h
> @@ -31,7 +31,7 @@
>
> #define LIBAVFORMAT_VERSION_MAJOR 55
> #define LIBAVFORMAT_VERSION_MINOR 21
> -#define LIBAVFORMAT_VERSION_MICRO 100
> +#define LIBAVFORMAT_VERSION_MICRO 101
>
> #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
> LIBAVFORMAT_VERSION_MINOR, \
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Its not that you shouldnt use gotos but rather that you should write
readable code and code with gotos often but not always is less readable
-------------- 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/20131107/cb358096/attachment.asc>
More information about the ffmpeg-devel
mailing list