tdm: add pepper_tdm_get_output function 76/263876/1
authorSooChan Lim <sc1.lim@samsung.com>
Mon, 13 Sep 2021 05:08:58 +0000 (14:08 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Mon, 13 Sep 2021 05:08:58 +0000 (14:08 +0900)
The pepper_tdm_get_output returns pepper_tdm_output
with a given index on a pepper_tdm.

Change-Id: I2d2211bd1072aa2fcdf69f06689785b221ef3e01

src/lib/tdm/pepper-tdm.h
src/lib/tdm/tdm-common.c
src/lib/tdm/tdm-internal.h

index 32fc55e..dc6e8d1 100644 (file)
@@ -35,7 +35,8 @@
 extern "C" {
 #endif
 
-typedef struct pepper_tdm pepper_tdm_t;
+typedef struct pepper_tdm                  pepper_tdm_t;
+typedef struct pepper_tdm_output           pepper_tdm_output_t;
 
 PEPPER_API pepper_tdm_t *
 pepper_tdm_create(pepper_compositor_t *compositor);
@@ -46,6 +47,9 @@ pepper_tdm_destroy(pepper_tdm_t *tdm);
 PEPPER_API uint32_t
 pepper_tdm_count_outputs(pepper_tdm_t *tdm);
 
+PEPPER_API pepper_tdm_output_t *
+pepper_tdm_get_output(pepper_tdm_t *tdm, int index);
+
 #ifdef __cplusplus
 }
 #endif
index 53f916a..4d04480 100644 (file)
@@ -131,3 +131,17 @@ pepper_tdm_count_outputs(pepper_tdm_t *tdm)
        return tdm->num_outputs;
 }
 
+PEPPER_API pepper_tdm_output_t *
+pepper_tdm_get_output(pepper_tdm_t *tdm, int index)
+{
+       pepper_tdm_output_t *output;
+       int i = 0;
+
+       pepper_list_for_each(output, &tdm->output_list, link) {
+               if (i == index)
+                       return output;
+               i++;
+       }
+
+       return NULL;
+}
index b42aae6..d238233 100644 (file)
@@ -45,7 +45,6 @@
 
 #include "pepper-tdm.h"
 
-typedef struct pepper_tdm_output                  pepper_tdm_output_t;
 typedef struct pepper_tdm_plane                   pepper_tdm_plane_t;
 typedef struct pepper_tdm_hwc                     pepper_tdm_hwc_t;
 typedef struct pepper_tdm_hwc_window              pepper_tdm_hwc_window_t;