2 * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 #include <Elementary.h>
21 #include "view_player.h"
24 #define PARAM_URI "uri"
25 #define PARAM_PLAYLIST_ID "playlist_id"
31 struct viewdata *vdata;
34 static Evas_Object *_add_win(const char *name)
43 win = elm_win_add(NULL, name, ELM_WIN_BASIC);
47 elm_win_title_set(win, "Video player");
49 evas_object_show(win);
51 evas = evas_object_evas_get(win);
52 obj = evas_object_rectangle_add(evas);
53 evas_object_color_set(obj, 0, 0, 0, 0);
54 evas_object_render_op_set(obj, EVAS_RENDER_COPY);
55 elm_win_resize_object_add(win, obj);
56 evas_object_show(obj);
61 static bool _create(void *user_data)
69 ad = (_appdata *)user_data;
71 elm_theme_overlay_add(NULL, THEMEFILE);
72 elm_config_focus_move_policy_set(ELM_FOCUS_MOVE_POLICY_CLICK);
74 win = _add_win(ad->name);
80 elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
81 elm_win_focus_highlight_style_set(win, STYLE_INVISIBLE);
86 static void _terminate(void *user_data)
93 ad = (_appdata *)user_data;
95 view_player_fini(ad->vdata);
98 static void _pause(void *user_data)
103 _ERR("App Data is NULL");
107 ad = (_appdata *)user_data;
111 view_player_pause(ad->vdata);
114 static void _resume(void *user_data)
119 _ERR("App Data is NULL");
123 ad = (_appdata *)user_data;
127 view_player_resume(ad->vdata);
130 static void _service(service_h service, void *user_data)
133 struct viewdata *vdata;
141 ad = (_appdata *)user_data;
143 r = service_get_extra_data(service, PARAM_URI, &uri);
144 if (r != SERVICE_ERROR_NONE)
147 r = service_get_extra_data(service, PARAM_PLAYLIST_ID, &playlist_id);
148 if (r != SERVICE_ERROR_NONE)
151 vdata = view_player_init(ad->win, uri, playlist_id);
159 if (view_player_create(vdata) == -1)
165 int main(int argc, char **argv)
168 app_event_callback_s cbs = {
170 .terminate = _terminate,
176 memset(&ad, 0x00, sizeof(ad));
179 memset(&cbs, 0x00, sizeof(cbs));
180 cbs.create = _create;
181 cbs.terminate = _terminate;
183 cbs.resume = _resume;
184 cbs.service = _service;
188 app_efl_main(&argc, &argv, &cbs, &ad);