[FFmpeg-cvslog] ffplay: add get_master_sync_type function
Marton Balint
git at videolan.org
Sun Oct 21 19:02:12 CEST 2012
ffmpeg | branch: master | Marton Balint <cus at passwd.hu> | Sat Oct 13 21:33:32 2012 +0200| [fca16a15712b789179dfc2131506fa4762795775] | committer: Marton Balint
ffplay: add get_master_sync_type function
The real av_sync_type may be different to VideoState->av_sync_type, because the
required audio or video stream for audio or video clock may not be available.
We will use a function to query the real av_sync_type which is used for
determining the master clock.
Signed-off-by: Marton Balint <cus at passwd.hu>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fca16a15712b789179dfc2131506fa4762795775
---
ffplay.c | 34 ++++++++++++++++++++++++----------
1 file changed, 24 insertions(+), 10 deletions(-)
diff --git a/ffplay.c b/ffplay.c
index c65c33a..717051e 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -1066,23 +1066,37 @@ static double get_external_clock(VideoState *is)
}
}
-/* get the current master clock value */
-static double get_master_clock(VideoState *is)
-{
- double val;
-
+static int get_master_sync_type(VideoState *is) {
if (is->av_sync_type == AV_SYNC_VIDEO_MASTER) {
if (is->video_st)
- val = get_video_clock(is);
+ return AV_SYNC_VIDEO_MASTER;
else
- val = get_audio_clock(is);
+ return AV_SYNC_AUDIO_MASTER;
} else if (is->av_sync_type == AV_SYNC_AUDIO_MASTER) {
if (is->audio_st)
- val = get_audio_clock(is);
+ return AV_SYNC_AUDIO_MASTER;
else
- val = get_video_clock(is);
+ return AV_SYNC_VIDEO_MASTER;
} else {
- val = get_external_clock(is);
+ return AV_SYNC_EXTERNAL_CLOCK;
+ }
+}
+
+/* get the current master clock value */
+static double get_master_clock(VideoState *is)
+{
+ double val;
+
+ switch (get_master_sync_type(is)) {
+ case AV_SYNC_VIDEO_MASTER:
+ val = get_video_clock(is);
+ break;
+ case AV_SYNC_AUDIO_MASTER:
+ val = get_audio_clock(is);
+ break;
+ default:
+ val = get_external_clock(is);
+ break;
}
return val;
}
More information about the ffmpeg-cvslog
mailing list