Add ESPLUSPLAYER_EVENT_REQUESTED_FIRST_RENDER_FRAME event type 00/296300/5 accepted/tizen/unified/20230814.120959
authorGilbok Lee <gilbok.lee@samsung.com>
Tue, 25 Jul 2023 06:02:52 +0000 (15:02 +0900)
committerGilbok Lee <gilbok.lee@samsung.com>
Wed, 9 Aug 2023 03:24:51 +0000 (12:24 +0900)
- add set low latency mode testsuite

[Version] 0.1.13
[Issue Type] Add features

Change-Id: I3e75c87ebbe69610c62d00bda6f098d6b2c208eb

include/esplusplayer_capi/event.h
include/plusplayer/types/event.h
packaging/esplusplayer.spec
test/esplusplayer_test.c

index 779ff7b..8c11b60 100644 (file)
@@ -54,6 +54,14 @@ typedef struct {
 typedef enum {
   ESPLUSPLAYER_EVENT_NONE,
   ESPLUSPLAYER_EVENT_RESOLUTION_CHANGED,
+  /**
+   * @description requested first render video frame to display module.
+   * Actual displaying timing on screen could be delay. It depends on H/W
+   * rendering system.
+   * This event will happen in case of ESPLUSPLAYER_LOW_LATENCY_MODE_DISABLE_SYNC
+   * or ESPLUSPLAYER_LOW_LATENCY_MODE_DISABLE_PREROLL mode.
+   */
+  ESPLUSPLAYER_EVENT_REQUESTED_FIRST_RENDER_FRAME,
 } esplusplayer_event_type;
 
 #ifdef __cplusplus
index fb6305d..1906d03 100755 (executable)
@@ -1,55 +1,56 @@
-/**\r
- * @file\r
- * @brief          The event for playback.\r
- * @interfacetype  Module\r
- * @privlevel      None-privilege\r
- * @privilege      None\r
- * @product        TV, AV, B2B\r
- * @version        1.0\r
- * @SDK_Support    N\r
- * @remark         This is a group of C style event related enum and structure.\r
- * @see            N/A\r
- *\r
- * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved\r
- * PROPRIETARY/CONFIDENTIAL\r
- * This software is the confidential and proprietary\r
- * information of SAMSUNG ELECTRONICS ("Confidential Information"). You shall\r
- * not disclose such Confidential Information and shall use it only in\r
- * accordance with the terms of the license agreement you entered into with\r
- * SAMSUNG ELECTRONICS. SAMSUNG make no representations or warranties about the\r
- * suitability of the software, either express or implied, including but not\r
- * limited to the implied warranties of merchantability, fitness for a\r
- * particular purpose, or non-infringement. SAMSUNG shall not be liable for any\r
- * damages suffered by licensee as a result of using, modifying or distributing\r
- * this software or its derivatives.\r
- */\r
-\r
-#ifndef __PLUSPLAYER_TYPES_EVENT_H__\r
-#define __PLUSPLAYER_TYPES_EVENT_H__\r
-\r
-namespace plusplayer {\r
-/**\r
- * @brief\r
- */\r
-typedef struct {\r
-  /**\r
-   * @description\r
-   */\r
-  std::string data;\r
-  /**\r
-   * @description\r
-   */\r
-  uint64_t len;\r
-} EventMsg;\r
-\r
-/**\r
- * @brief\r
- */\r
-enum class EventType {\r
-  kNone,\r
-  kResolutionChanged,\r
-};\r
-\r
-}  // namespace plusplayer\r
-\r
-#endif  // __PLUSPLAYER_TYPES_EVENT_H__\r
+/**
+ * @file
+ * @brief          The event for playback.
+ * @interfacetype  Module
+ * @privlevel      None-privilege
+ * @privilege      None
+ * @product        TV, AV, B2B
+ * @version        1.0
+ * @SDK_Support    N
+ * @remark         This is a group of C style event related enum and structure.
+ * @see            N/A
+ *
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
+ * PROPRIETARY/CONFIDENTIAL
+ * This software is the confidential and proprietary
+ * information of SAMSUNG ELECTRONICS ("Confidential Information"). You shall
+ * not disclose such Confidential Information and shall use it only in
+ * accordance with the terms of the license agreement you entered into with
+ * SAMSUNG ELECTRONICS. SAMSUNG make no representations or warranties about the
+ * suitability of the software, either express or implied, including but not
+ * limited to the implied warranties of merchantability, fitness for a
+ * particular purpose, or non-infringement. SAMSUNG shall not be liable for any
+ * damages suffered by licensee as a result of using, modifying or distributing
+ * this software or its derivatives.
+ */
+
+#ifndef __PLUSPLAYER_TYPES_EVENT_H__
+#define __PLUSPLAYER_TYPES_EVENT_H__
+
+namespace plusplayer {
+/**
+ * @brief
+ */
+typedef struct {
+  /**
+   * @description
+   */
+  std::string data;
+  /**
+   * @description
+   */
+  uint64_t len;
+} EventMsg;
+
+/**
+ * @brief
+ */
+enum class EventType {
+  kNone,
+  kResolutionChanged,
+  kRequestedFirstRenderFrame,
+};
+
+}  // namespace plusplayer
+
+#endif  // __PLUSPLAYER_TYPES_EVENT_H__
index 1dc58d8..373cfcd 100644 (file)
@@ -2,7 +2,7 @@
 %bcond_without ESPLUSPLAYER_UT
 Name:       esplusplayer
 Summary:    new multimedia streaming player
-Version:    0.0.12
+Version:    0.0.13
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
index 38400a4..edbbb99 100644 (file)
@@ -59,6 +59,7 @@ enum {
        CURRENT_STATUS_SELECT_TRACK,
        CURRENT_STATUS_ENABLE_VIDEO_HOLE,
        CURRENT_STATUS_SET_RENDER_TIME_OFFSET,
+       CURRENT_STATUS_SET_LOW_LATENCY_MODE,
 };
 
 /* for video display */
@@ -317,6 +318,11 @@ static void __espp_ready_to_seek_cb(esplusplayer_stream_type type, uint64_t time
        STREAM_SIGNAL(type);
 }
 
+static void __espp_event_cb(esplusplayer_event_type type, esplusplayer_event_msg msg, void *user_data)
+{
+       g_print("__espp_event_cb(type:%d, msg:%s) \n", type, msg.data);
+}
+
 static int __convert_media_format_mime_to_espp_mime(media_format_mimetype_e type)
 {
        g_print("media_format_mimetype(0x%x)\n", type);
@@ -422,6 +428,12 @@ static void __init_espp()
        else
                g_print("                       => esplusplayer_set_ready_to_seek_cb() success\n");
 
+       ret = esplusplayer_set_event_cb(g_test_h->espp_h, __espp_event_cb, g_test_h);
+       if (ret != ESPLUSPLAYER_ERROR_TYPE_NONE)
+               g_print("                       => failed to esplusplayer_set_event_cb()\n");
+       else
+               g_print("                       => esplusplayer_set_event_cb() success\n");
+
        ret = esplusplayer_open(g_test_h->espp_h);
        if (ret != ESPLUSPLAYER_ERROR_TYPE_NONE)
                g_print("                       => failed to esplusplayer_open()\n");
@@ -1267,6 +1279,34 @@ static void __test_set_render_time_offset(int type, int64_t time_ms)
                g_print("                       => esplusplayer_set_render_time_offset(%d, %" PRId64 ")\n", type, time_ms);
 }
 
+static void __test_set_low_latency_mode(int value)
+{
+       esplusplayer_low_latency_mode mode = ESPLUSPLAYER_LOW_LATENCY_MODE_NONE;
+       if (!g_test_h) {
+               g_print("test handle is NULL\n");
+               return;
+       }
+
+       switch (value)
+       {
+       case 0:
+               mode = ESPLUSPLAYER_LOW_LATENCY_MODE_NONE;
+               break;
+       case 1:
+               mode = ESPLUSPLAYER_LOW_LATENCY_MODE_DISABLE_PREROLL;
+               break;
+       default:
+               g_print("Not support low latency mode (%d)\n", value);
+               return;
+       }
+
+       int ret = esplusplayer_set_low_latency_mode(g_test_h->espp_h, mode);
+       if (ret != ESPLUSPLAYER_ERROR_TYPE_NONE)
+               g_print("                       => failed to esplusplayer_set_low_latency_mode(%d)\n", mode);
+       else
+               g_print("                       => esplusplayer_set_low_latency_mode(%d) success\n", mode);
+}
+
 static void __test_enable_video_hole(bool value)
 {
        if (!g_test_h) {
@@ -1438,6 +1478,8 @@ static void __interpret_main_menu(char *cmd)
                        g_menu_state = CURRENT_STATUS_SET_RENDER_TIME_OFFSET;
                } else if (strncmp(cmd, "qp", 2) == 0) {
                        __test_quick_prepare();
+               } else if (strncmp(cmd, "ll", 2) == 0) {
+                       g_menu_state = CURRENT_STATUS_SET_LOW_LATENCY_MODE;
                } else {
                        g_print("unknown menu \n");
                }
@@ -1483,15 +1525,16 @@ static void __display_sub_basic()
        g_print("d.Resume\t");
        g_print("e.Pause\t\t");
        g_print("dt.Destroy\n");
-       g_print("qp.quick prepare\n");
+       g_print("[quick] qp.quick prepare\n");
        g_print("[seek] j.Seek\t\t");
        g_print("[trick] tr.set playback rate\n");
        g_print("[State] S.Get state\n");
        g_print("[volume] f.Set Volume\t");
        g_print("g.Get Volume\t");
        g_print("h.Set Mute\n");
-       g_print("[etc]\n");
-       g_print("sr.Set render time offset\n\n");
+       g_print("[etc] ");
+       g_print("sr.Set render time offset\t");
+       g_print("ll.Set low latency mode\n\n");
 
        g_print("-- << mediademuxer cmd >> ---------------------------------------------------------------\n");
        g_print("prd.prepare demuxer\n\n");
@@ -1543,6 +1586,8 @@ static void __displaymenu()
                g_print("*** Set videohole (1:enable, 0:disable)\n");
        } else if (g_menu_state == CURRENT_STATUS_SET_RENDER_TIME_OFFSET) {
                g_print("*** Input stream type and time offset\n");
+       } else if (g_menu_state == CURRENT_STATUS_SET_LOW_LATENCY_MODE) {
+               g_print("*** Input low latency mode (0: none, 1: disable preroll)\n");
        } else {
                g_print("*** Unknown status.\n");
                quit_program();
@@ -1815,6 +1860,13 @@ static void interpret(char *cmd)
                }
                break;
        }
+       case CURRENT_STATUS_SET_LOW_LATENCY_MODE:
+       {
+               value = atoi(cmd);
+               __test_set_low_latency_mode(value);
+               reset_menu_state();
+               break;
+       }
        default:
                break;
        }