increase version up
[framework/multimedia/libmm-player.git] / src / include / mm_player_ahs.h
1 /*
2  * libmm-player
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: JongHyuk Choi <jhchoi.choi@samsung.com>, YeJin Cho <cho.yejin@samsung.com>,
7  * Seungbae Shin <seungbae.shin@samsung.com>, YoungHwan An <younghwan_.an@samsung.com>,
8  * naveen cherukuri <naveen.ch@samsung.com>
9  *
10  * Licensed under the Apache License, Version 2.0 (the "License");
11  * you may not use this file except in compliance with the License.
12  * You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS,
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  *
22  */
23
24 #ifndef __MM_PLAYER_AHS_H__
25 #define __MM_PLAYER_AHS_H__
26
27 #include <glib.h>
28 #include "mm_player_ahs_hls.h"
29 #include <gst/gst.h>
30 #include <gst/app/gstappsrc.h>
31 #include <gst/app/gstappsink.h>
32 #include <string.h>
33 #include "mm_debug.h"
34
35 #define HLS_POSIX_PATH_MAX                              256
36 #define HLS_MANIFEST_DEFAULT_PATH               "/opt/media/"
37 #define HLS_MANIFEST_DEFAULT_FILE_NAME  HLS_MANIFEST_DEFAULT_PATH"XXXXXX"
38
39 typedef struct
40 {
41         void *ahs_client;
42         GstElement *appsrc; /* appsrc to push data */
43
44         int uri_type;
45         gboolean need_bw_switch;
46         
47         /* manifest file (mf) uris */
48         gchar *main_mf_uri;
49         
50         /* user agent */
51         gchar *user_agent;
52
53         gchar *cur_mf_uri;
54         gchar *cur_media_uri;
55         gchar *cur_key_uri;
56         gchar cur_key_data[16];
57         char cur_iv[16];
58         
59         char ahs_manifest_dmp_location[HLS_POSIX_PATH_MAX];  /* manifest file dumped location */
60         char ahs_key_dmp_location [HLS_POSIX_PATH_MAX];
61         
62         int ahs_state;
63         GMutex* state_lock;
64
65         /* manifest/playlist download */
66         GThread *manifest_thread;
67         gboolean manifest_thread_exit;
68         GstElement *manifest_download_pipeline;
69         GstElement *manifest_download_src;
70         GstElement *manifest_download_sink;
71         GCond* manifest_start_cond;
72         GCond* manifest_update_cond;
73         GCond* manifest_eos_cond;
74         GCond* manifest_exit_cond;
75         GMutex* manifest_mutex;
76
77         /* media download */
78         GThread *media_thread;
79         GMutex *media_mutex;
80         gboolean media_thread_exit;
81         GstElement *media_download_pipeline;
82         GstElement *media_download_src;
83         GstElement *media_download_sink;
84         GCond *media_eos_cond;
85         GCond *media_start_cond;
86
87         /* key download */
88         GstElement *key_download_pipeline;
89         GstElement *key_download_src;
90         GstElement *key_download_sink;
91         GCond *key_eos_cond;
92
93         guint64 seg_start_time;     /* segment start time in usec*/
94         guint64 seg_end_time;     /* segment end time usec*/
95         guint download_rate;
96         guint64 seg_size;
97         gint cache_frag_count;
98
99         gboolean hls_is_wait_for_reload;
100
101         GCond* tmp_cond;
102
103         gboolean is_initialized;
104 }mm_player_ahs_t;
105
106
107
108 mm_player_ahs_t * __mm_player_ahs_create ();
109 gboolean __mm_player_ahs_initialize (mm_player_ahs_t *ahs_player, int uri_type, char *uri, GstElement *appsrc);
110 gboolean __mm_player_ahs_start (mm_player_ahs_t *ahs_player);
111 gboolean  __mm_player_ahs_deinitialize (mm_player_ahs_t *ahs_player);
112 gboolean __mm_player_ahs_stop (mm_player_ahs_t *ahs_player);
113 gboolean __mm_player_ahs_destroy (mm_player_ahs_t *ahs_player);
114 gboolean
115 ahs_store_media_presentation (mm_player_ahs_t *ahs_player, unsigned char *buffer, unsigned int buffer_len);
116 gboolean ahs_check_allow_cache (mm_player_ahs_t *ahs_player);
117 #endif
118