2 * Copyright (c) 2011 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.
17 #ifndef __TIZEN_MEDIA_PLAYER_PRIVATE_H__
18 #define __TIZEN_MEDIA_PLAYER_PRIVATE_H__
19 #include <tbm_bufmgr.h>
21 #include <media_format.h>
22 #include <muse_player.h>
24 #include "player_display.h"
33 #define LOG_TAG "TIZEN_N_PLAYER"
35 #define PLAYER_CHECK_CONDITION(condition, error, msg) \
36 if (condition) {} else \
37 { LOGE("[%s] %s(0x%08x)", __FUNCTION__, msg, error); return error; }; \
39 #define PLAYER_INSTANCE_CHECK(player) \
40 PLAYER_CHECK_CONDITION(player != NULL, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER")
42 #define PLAYER_STATE_CHECK(player, expected_state) \
43 PLAYER_CHECK_CONDITION(player->state == expected_state, PLAYER_ERROR_INVALID_STATE, "PLAYER_ERROR_INVALID_STATE")
45 #define PLAYER_NULL_ARG_CHECK(arg) \
46 PLAYER_CHECK_CONDITION(arg != NULL, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER")
48 #define CONNECTION_RETRY 51
49 #define CONNECTION_TIME_OUT 50 /* ms */
50 #define CREATE_CB_TIME_OUT 400 /* ms */
51 #define CALLBACK_TIME_OUT 5000 /* ms */
52 #define MAX_SERVER_TIME_OUT 35000 /* ms */
53 #define MAX_URL_LEN 2048 /**< Maximum length of the maximum URL */
55 typedef struct _ret_msg_s {
58 struct _ret_msg_s *next;
65 ret_msg_s *retMsgHead;
66 gchar *part_of_msg; /* keep msg till we receive the hole msg */
69 typedef struct _player_data {
71 struct _player_data *next;
86 } player_tsurf_info_t;
88 typedef struct _callback_cb_info {
93 gpointer user_cb[MUSE_PLAYER_EVENT_TYPE_NUM];
94 gpointer user_data[MUSE_PLAYER_EVENT_TYPE_NUM];
96 GCond player_cond[MUSE_PLAYER_API_MAX];
97 GCond server_ack_cond;
99 gboolean block_seek_cb;
100 GMutex seek_cb_mutex;
102 player_event_queue event_queue;
103 media_format_h pkt_fmt;
107 GList *tsurf_list; /* player_tsurf_info_t */
108 int video_frame_pool_size;
110 } callback_cb_info_s;
114 gint timeout; /* ms */
117 typedef struct _player_cli_s {
118 callback_cb_info_s *cb_info;
120 server_info_s server;
123 gboolean have_evas_callback;
124 gboolean push_media_stream;
127 /* player callback information */
128 #define CALLBACK_INFO(h) ((h)->cb_info)
129 /* MSG Channel socket fd */
130 #define MSG_FD(h) (CALLBACK_INFO(h)->fd)
131 /* Data Channel socket fd */
132 #define DATA_FD(h) (CALLBACK_INFO(h)->data_fd)
133 /* TBM buffer manager */
134 #define TBM_BUFMGR(h) (CALLBACK_INFO(h)->bufmgr)
135 /* evas display handle */
136 #define EVAS_HANDLE(h) ((h)->cb_info->evas_info)
139 #define SERVER_TBM_BO(h) ((h)->server.bo)
140 /* server state change timeout (sec) */
141 #define SERVER_TIMEOUT(h) ((h)->server.timeout)
143 int client_get_api_timeout(player_cli_s * pc, muse_player_api_e api);
144 int client_wait_for_cb_return(muse_player_api_e api, callback_cb_info_s * cb_info, char **ret_buf, int time_out);
145 void _player_replace_old_path(const char *in_path, char *out_path);
150 #endif /*__TIZEN_MEDIA_PLAYER_PRIVATE_H__*/