Change 'guint' variables to 'gint' and add valid geometry check
[platform/core/multimedia/libmm-evas-renderer.git] / src / include / mm_evas_renderer_private.h
1 /*
2  * Copyright (c) 2000 - 2017 Samsung Electronics Co., Ltd. All rights reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 #ifndef __TIZEN_MEDIA_EVASRENDERER_PRIVATE_H__
19 #define __TIZEN_MEDIA_EVASRENDERER_PRIVATE_H__
20
21 /*===========================================================================================
22 |                                                                                                                                                                                       |
23 |  INCLUDE FILES                                                                                                                                                        |
24 |                                                                                                                                                                                       |
25 ========================================================================================== */
26 #include <glib.h>
27 #include <Evas.h>
28 #include <Ecore.h>
29 #include <tbm_surface.h>
30 #include <media_packet.h>
31
32 #include "mm_evas_renderer.h"
33
34 #define MAX_PACKET_NUM 20
35
36 /*===========================================================================================
37 |                                                                                                                                                                                       |
38 |  GLOBAL DEFINITIONS AND DECLARATIONS FOR MODULE                                                                                       |
39 |                                                                                                                                                                                       |
40 ========================================================================================== */
41
42 /*---------------------------------------------------------------------------
43 |    GLOBAL #defines:                                                                                                           |
44 ---------------------------------------------------------------------------*/
45
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
49
50 typedef enum {
51         UPDATE_VISIBILITY,
52         UPDATE_TBM_SURF,
53         UPDATE_FLUSH_BUFFER,
54         UPDATE_INFO_NUM
55 } update_info;
56
57 enum {
58         COND_RETRIEVE,
59         COND_DESTROY,
60         COND_NUM
61 };
62
63 typedef struct {
64         media_packet_h packet;
65         tbm_surface_h tbm_surf;
66         gint prev_idx; /* keep previous index for destroying remained packets */
67 } packet_info;
68
69 typedef struct {
70         gint x;
71         gint y;
72         gint w;
73         gint h;
74 } rect_info;
75
76 typedef struct {
77         void *bo;
78         tbm_surface_h tbm_surf;
79 } flush_info;
80
81 /* evas info for evas surface type */
82 typedef struct {
83         Evas_Object *eo;
84         Ecore_Pipe *epipe;
85
86         /* video width & height */
87         gint w;
88         gint h;
89
90         gboolean rendering_info_changed;
91         gboolean video_size_changed;
92         gboolean is_set_roi_area;
93         gboolean is_set_resize_cb;
94
95         /* properties */
96         gboolean update_needed; /* to update geometry information on pause state */
97         gboolean visible;
98         rect_info eo_size;
99         rect_info dst_roi;
100         rect_info result;
101         float ratio; /* need to set original ratio, not swap */
102         gint rotate;
103         gint rotate_angle;
104         gint display_geometry_method;
105         gint pre_display_geometry_method;
106         gint flip;
107
108         tbm_surface_h tbm_surf;
109
110         /* media packet */
111         packet_info pkt_info[MAX_PACKET_NUM];
112         gint cur_idx;
113
114         /* count undestroyed media packet */
115         guint sent_buffer_cnt;
116
117         /* lock */
118         GMutex mp_lock; /* media_packet free lock */
119         GMutex idx_lock; /* to keep value of cur_idx */
120         GMutex write_lock; /* ecore pipe write lock */
121         GMutex evas_lock;
122         GCond evas_cond[COND_NUM];
123
124         /* flush buffer */
125         flush_info *flush_buffer;
126         gboolean keep_screen;
127         gboolean flush_all_packets;
128
129         /* rendered callback */
130         mm_evas_renderer_media_packet_rendered_cb packet_rendered_cb;
131         void *packet_rendered_cb_user;
132 } mm_evas_info;
133
134 #ifdef __cplusplus
135 }
136 #endif
137
138 #endif /* __TIZEN_MEDIA_EVASRENDERER_PRIVATE_H__ */