avsync-lib: add API to retrieve current mode
For attached client.
Change-Id: Ic6064ed18218c4f869c32ea6dfdf8cd9f4bf79d9
diff --git a/src/aml_avsync.h b/src/aml_avsync.h
index 733b0cd..a19a218 100644
--- a/src/aml_avsync.h
+++ b/src/aml_avsync.h
@@ -274,6 +274,15 @@
*/
int av_sync_change_mode(void *sync, enum sync_mode mode);
+/* get avsync mode
+ * Params:
+ * @sync: AV sync module handle
+ * @mode: pointer to return current mode
+ * Return:
+ * 0 for OK, or error code
+ */
+int av_sync_get_mode(void *sync, enum sync_mode *mode);
+
/* set pause PTS
* av sync will pause after reaching the assigned PTS or do step.
* Need to call @av_sync_pause(false) to resume a the playback.
diff --git a/src/avsync.c b/src/avsync.c
index 07b2479..668074d 100644
--- a/src/avsync.c
+++ b/src/avsync.c
@@ -817,6 +817,17 @@
return 0;
}
+int av_sync_get_mode(void *sync, enum sync_mode *mode)
+{
+ struct av_sync_session *avsync = (struct av_sync_session *)sync;
+
+ if (!avsync || !mode)
+ return -1;
+
+ *mode = avsync->mode;
+ return 0;
+}
+
int av_sync_set_pause_pts(void *sync, pts90K pts)
{
struct av_sync_session *avsync = (struct av_sync_session *)sync;