[0.6.145] remove dead path - video hub
[platform/core/multimedia/libmm-player.git] / src / mm_player.c
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  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  * http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  *
21  */
22
23 #include <gst/gst.h>
24 #include <string.h>
25
26 #include <dlog.h>
27 #include <mm_types.h>
28 #include <mm_message.h>
29
30 #include "mm_player.h"
31 #include "mm_player_priv.h"
32 #include "mm_player_attrs.h"
33 #include "mm_player_utils.h"
34 #include "mm_player_ini.h"
35 #include "mm_player_capture.h"
36 #include "mm_player_tracks.h"
37 #include "mm_player_es.h"
38 #include "mm_player_360.h"
39
40 int mm_player_create(MMHandleType *player)
41 {
42         int result = MM_ERROR_PLAYER_INTERNAL;
43         mm_player_t* new_player = NULL;
44
45         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
46
47         /* alloc player structure */
48         new_player = g_malloc(sizeof(mm_player_t));
49         if (!new_player) {
50                 LOGE("Cannot allocate memory for player\n");
51                 result = MM_ERROR_PLAYER_RESOURCE_LIMIT;
52                 goto ERROR;
53         }
54         memset(new_player, 0, sizeof(mm_player_t));
55
56         /* create player lock */
57         g_mutex_init(&new_player->cmd_lock);
58
59         /* create player lock */
60         g_mutex_init(&new_player->playback_lock);
61
62         /* load ini files */
63         if (MM_ERROR_NONE != mm_player_ini_load(&new_player->ini)) {
64                 LOGE("can't load ini");
65                 goto ERROR;
66         }
67
68         if (MM_ERROR_NONE != mm_player_audio_effect_ini_load(&new_player->ini)) {
69                 LOGE("can't load audio ini");
70                 goto ERROR;
71         }
72
73         /* create player */
74         result = _mmplayer_create_player((MMHandleType)new_player);
75         if (result != MM_ERROR_NONE) {
76                 LOGE("failed to create player");
77                 if (result != MM_ERROR_PLAYER_RESOURCE_LIMIT)
78                         result = MM_ERROR_PLAYER_INTERNAL;
79                 goto ERROR;
80         }
81
82         *player = (MMHandleType)new_player;
83
84         return MM_ERROR_NONE;
85
86 ERROR:
87
88         if (new_player) {
89                 _mmplayer_destroy((MMHandleType)new_player);
90                 g_mutex_clear(&new_player->cmd_lock);
91                 g_mutex_clear(&new_player->playback_lock);
92
93                 MMPLAYER_FREEIF(new_player);
94         }
95
96         *player = (MMHandleType)0;
97         return result; /* MM_ERROR_PLAYER_INTERNAL or MM_ERROR_PLAYER_RESOURCE_LIMIT */
98 }
99
100 int  mm_player_destroy(MMHandleType player)
101 {
102         int result = MM_ERROR_NONE;
103
104         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
105
106         /* destroy the gst bus msg thread if it is remained.
107            this funct have to be called before getting cmd lock. */
108         __mmplayer_bus_msg_thread_destroy(player);
109
110         MMPLAYER_CMD_LOCK(player);
111
112         result = _mmplayer_destroy(player);
113
114         MMPLAYER_CMD_UNLOCK(player);
115
116         g_mutex_clear(&((mm_player_t*)player)->cmd_lock);
117         g_mutex_clear(&((mm_player_t*)player)->playback_lock);
118
119         memset((mm_player_t*)player, 0x00, sizeof(mm_player_t));
120
121         /* free player */
122         g_free((void*)player);
123
124         return result;
125 }
126
127 int mm_player_realize(MMHandleType player)
128 {
129         int result = MM_ERROR_NONE;
130
131         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
132
133         MMPLAYER_CMD_LOCK(player);
134
135         result = _mmplayer_realize(player);
136
137         MMPLAYER_CMD_UNLOCK(player);
138
139         return result;
140 }
141
142 int mm_player_abort_pause(MMHandleType player)
143 {
144         int result = MM_ERROR_NONE;
145
146         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
147
148         /* destroy the gst bus msg thread not to be blocked in pause(without cmd lock). */
149         __mmplayer_bus_msg_thread_destroy(player);
150
151         /* abort the pause operation for preparing(without cmd lock). */
152         result = _mmplayer_abort_pause(player);
153
154         return result;
155 }
156
157 int mm_player_unrealize(MMHandleType player)
158 {
159         int result = MM_ERROR_NONE;
160
161         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
162
163         MMPLAYER_CMD_LOCK(player);
164
165         result = _mmplayer_unrealize(player);
166
167         MMPLAYER_CMD_UNLOCK(player);
168
169         return result;
170 }
171
172 int mm_player_set_message_callback(MMHandleType player, MMMessageCallback callback, void *user_param)
173 {
174         int result = MM_ERROR_NONE;
175
176         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
177
178         MMPLAYER_CMD_LOCK(player);
179
180         result = _mmplayer_set_message_callback(player, callback, user_param);
181
182         MMPLAYER_CMD_UNLOCK(player);
183
184         return result;
185 }
186
187 int mm_player_set_pd_message_callback(MMHandleType player, MMMessageCallback callback, void *user_param)
188 {
189         int result = MM_ERROR_NONE;
190
191         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
192
193         result = _mm_player_set_pd_downloader_message_cb(player, callback, user_param);
194
195         return result;
196 }
197
198 int mm_player_set_audio_stream_callback(MMHandleType player, bool sync, mm_player_audio_stream_callback callback, void *user_param)
199 {
200         int result = MM_ERROR_NONE;
201
202         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
203
204         MMPLAYER_CMD_LOCK(player);
205
206         result = _mmplayer_set_audiostream_cb(player, sync, callback, user_param);
207
208         MMPLAYER_CMD_UNLOCK(player);
209
210         return result;
211 }
212
213 int mm_player_set_video_stream_callback(MMHandleType player, mm_player_video_stream_callback callback, void *user_param)
214 {
215         int result = MM_ERROR_NONE;
216
217         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
218
219         MMPLAYER_CMD_LOCK(player);
220
221         result = _mmplayer_set_videostream_cb(player, callback, user_param);
222
223         MMPLAYER_CMD_UNLOCK(player);
224
225         return result;
226 }
227
228 int mm_player_do_video_capture(MMHandleType player)
229 {
230         int result = MM_ERROR_NONE;
231
232         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
233
234         MMPLAYER_CMD_LOCK(player);
235
236         result = _mmplayer_do_video_capture(player);
237
238         MMPLAYER_CMD_UNLOCK(player);
239
240         return result;
241 }
242
243 int mm_player_set_volume(MMHandleType player, MMPlayerVolumeType *volume)
244 {
245         int result = MM_ERROR_NONE;
246
247         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
248         MMPLAYER_RETURN_VAL_IF_FAIL(volume, MM_ERROR_INVALID_ARGUMENT);
249
250         MMPLAYER_CMD_LOCK(player);
251
252         result = _mmplayer_set_volume(player, *volume);
253
254         MMPLAYER_CMD_UNLOCK(player);
255
256         return result;
257 }
258
259 int mm_player_get_volume(MMHandleType player, MMPlayerVolumeType *volume)
260 {
261         int result = MM_ERROR_NONE;
262
263         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
264         MMPLAYER_RETURN_VAL_IF_FAIL(volume, MM_ERROR_INVALID_ARGUMENT);
265
266         MMPLAYER_CMD_LOCK(player);
267
268         result = _mmplayer_get_volume(player, volume);
269
270         MMPLAYER_CMD_UNLOCK(player);
271
272         return result;
273 }
274
275 int mm_player_set_mute(MMHandleType player, int mute)
276 {
277         int result = MM_ERROR_NONE;
278
279         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
280
281         MMPLAYER_CMD_LOCK(player);
282
283         result = _mmplayer_set_mute(player, mute);
284
285         MMPLAYER_CMD_UNLOCK(player);
286
287         return result;
288 }
289
290 int mm_player_get_mute(MMHandleType player, int *mute)
291 {
292         int result = MM_ERROR_NONE;
293
294         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
295         MMPLAYER_RETURN_VAL_IF_FAIL(mute, MM_ERROR_INVALID_ARGUMENT);
296
297         MMPLAYER_CMD_LOCK(player);
298
299         result = _mmplayer_get_mute(player, mute);
300
301         MMPLAYER_CMD_UNLOCK(player);
302
303         return result;
304 }
305
306 int mm_player_get_state(MMHandleType player, MMPlayerStateType *state)
307 {
308         int result = MM_ERROR_NONE;
309
310         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
311         MMPLAYER_RETURN_VAL_IF_FAIL(state, MM_ERROR_COMMON_INVALID_ARGUMENT);
312
313         *state = MM_PLAYER_STATE_NULL;
314
315         result = _mmplayer_get_state(player, (int*)state);
316
317         return result;
318 }
319
320 /* NOTE : It does not support some use cases, eg using colorspace converter */
321 int mm_player_change_videosink(MMHandleType player, MMDisplaySurfaceType display_surface_type, void *display_overlay)
322 {
323         int result = MM_ERROR_NONE;
324
325         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
326
327         MMPLAYER_CMD_LOCK(player);
328
329         result = _mmplayer_change_videosink(player, display_surface_type, display_overlay);
330
331         MMPLAYER_CMD_UNLOCK(player);
332
333         return result;
334 }
335
336 int mm_player_start(MMHandleType player)
337 {
338         int result = MM_ERROR_NONE;
339
340         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
341
342         MMPLAYER_CMD_LOCK(player);
343
344         result = _mmplayer_start(player);
345
346         MMPLAYER_CMD_UNLOCK(player);
347
348         return result;
349 }
350
351 int  mm_player_stop(MMHandleType player)
352 {
353         int result = MM_ERROR_NONE;
354
355         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
356
357         MMPLAYER_CMD_LOCK(player);
358
359         result = _mmplayer_stop(player);
360
361         MMPLAYER_CMD_UNLOCK(player);
362
363         return result;
364 }
365
366 int mm_player_pause(MMHandleType player)
367 {
368         int result = MM_ERROR_NONE;
369
370         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
371
372         MMPLAYER_CMD_LOCK(player);
373
374         result = _mmplayer_pause(player);
375
376         MMPLAYER_CMD_UNLOCK(player);
377
378         return result;
379 }
380
381 int mm_player_resume(MMHandleType player)
382 {
383         int result = MM_ERROR_NONE;
384
385         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
386
387         MMPLAYER_CMD_LOCK(player);
388
389         result = _mmplayer_resume(player);
390
391         MMPLAYER_CMD_UNLOCK(player);
392
393         return result;
394 }
395
396 int mm_player_set_play_speed(MMHandleType player, float rate, bool streaming)
397 {
398         int result = MM_ERROR_NONE;
399
400         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
401
402         MMPLAYER_CMD_LOCK(player);
403
404         result = _mmplayer_set_playspeed(player, rate, streaming);
405
406         MMPLAYER_CMD_UNLOCK(player);
407
408         return result;
409 }
410
411 int mm_player_set_position(MMHandleType player, int64_t pos)
412 {
413         int result = MM_ERROR_NONE;
414
415         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
416
417         MMPLAYER_CMD_LOCK(player);
418
419         result = _mmplayer_set_position(player, pos);
420
421         MMPLAYER_CMD_UNLOCK(player);
422
423         return result;
424 }
425
426 int mm_player_get_position(MMHandleType player, int64_t *pos)
427 {
428         int result = MM_ERROR_NONE;
429
430         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
431         MMPLAYER_RETURN_VAL_IF_FAIL(pos, MM_ERROR_COMMON_INVALID_ARGUMENT);
432
433         MMPLAYER_CMD_LOCK(player);
434
435         result = _mmplayer_get_position(player, pos);
436
437         MMPLAYER_CMD_UNLOCK(player);
438
439         return result;
440 }
441
442 int mm_player_get_duration(MMHandleType player, int64_t *dur)
443 {
444         int result = MM_ERROR_NONE;
445
446         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
447         MMPLAYER_RETURN_VAL_IF_FAIL(dur, MM_ERROR_COMMON_INVALID_ARGUMENT);
448
449         MMPLAYER_CMD_LOCK(player);
450
451         result = _mmplayer_get_duration(player, dur);
452
453         MMPLAYER_CMD_UNLOCK(player);
454
455         return result;
456 }
457
458
459 int mm_player_get_buffer_position(MMHandleType player, MMPlayerPosFormatType format, unsigned long *start_pos, unsigned long *stop_pos)
460 {
461         int result = MM_ERROR_NONE;
462
463         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
464         MMPLAYER_RETURN_VAL_IF_FAIL(start_pos && stop_pos, MM_ERROR_COMMON_INVALID_ARGUMENT);
465
466         MMPLAYER_CMD_LOCK(player);
467
468         result = _mmplayer_get_buffer_position(player, (int)format, start_pos, stop_pos);
469
470         MMPLAYER_CMD_UNLOCK(player);
471
472         return result;
473 }
474
475 int mm_player_set_external_subtitle_path(MMHandleType player, const char* path)
476 {
477         int result = MM_ERROR_NONE;
478
479         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
480
481         MMPLAYER_CMD_LOCK(player);
482
483         result = _mmplayer_set_external_subtitle_path(player, path);
484
485         MMPLAYER_CMD_UNLOCK(player);
486         return result;
487 }
488
489 int mm_player_adjust_subtitle_position(MMHandleType player, MMPlayerPosFormatType format, int pos)
490 {
491         int result = MM_ERROR_NONE;
492
493         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
494
495         if (format >= MM_PLAYER_POS_FORMAT_NUM) {
496                 LOGE("wrong format(%d) \n", format);
497                 return MM_ERROR_INVALID_ARGUMENT;
498         }
499
500         MMPLAYER_CMD_LOCK(player);
501
502         result = _mmplayer_adjust_subtitle_postion(player, format, pos);
503
504         MMPLAYER_CMD_UNLOCK(player);
505
506         return result;
507 }
508
509 int mm_player_set_subtitle_silent(MMHandleType player, int silent)
510 {
511         int result = MM_ERROR_NONE;
512
513         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
514
515         MMPLAYER_CMD_LOCK(player);
516
517         result = _mmplayer_set_subtitle_silent(player, silent);
518
519         MMPLAYER_CMD_UNLOCK(player);
520
521         return result;
522 }
523
524 int mm_player_get_subtitle_silent(MMHandleType player, int* silent)
525 {
526         int result = MM_ERROR_NONE;
527
528         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
529
530         MMPLAYER_CMD_LOCK(player);
531
532         result = _mmplayer_get_subtitle_silent(player, silent);
533
534         MMPLAYER_CMD_UNLOCK(player);
535
536         return result;
537 }
538
539 int mm_player_set_attribute(MMHandleType player,  char **err_attr_name, const char *first_attribute_name, ...)
540 {
541         int result = MM_ERROR_NONE;
542         va_list var_args;
543
544         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
545         MMPLAYER_RETURN_VAL_IF_FAIL(first_attribute_name, MM_ERROR_COMMON_INVALID_ARGUMENT);
546
547         va_start(var_args, first_attribute_name);
548         result = _mmplayer_set_attribute(player, err_attr_name, first_attribute_name, var_args);
549         va_end(var_args);
550
551         return result;
552 }
553
554 int mm_player_get_attribute(MMHandleType player,  char **err_attr_name, const char *first_attribute_name, ...)
555 {
556         int result = MM_ERROR_NONE;
557         va_list var_args;
558
559         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
560         MMPLAYER_RETURN_VAL_IF_FAIL(first_attribute_name, MM_ERROR_COMMON_INVALID_ARGUMENT);
561
562         va_start(var_args, first_attribute_name);
563         result = _mmplayer_get_attribute(player, err_attr_name, first_attribute_name, var_args);
564         va_end(var_args);
565
566         return result;
567 }
568
569 int mm_player_get_attribute_info(MMHandleType player,  const char *attribute_name, MMPlayerAttrsInfo *info)
570 {
571         int result = MM_ERROR_NONE;
572
573
574         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
575         MMPLAYER_RETURN_VAL_IF_FAIL(attribute_name, MM_ERROR_COMMON_INVALID_ARGUMENT);
576         MMPLAYER_RETURN_VAL_IF_FAIL(info, MM_ERROR_COMMON_INVALID_ARGUMENT);
577
578         result = _mmplayer_get_attributes_info((MMHandleType)player, attribute_name, info);
579
580         return result;
581 }
582
583 int mm_player_get_pd_status(MMHandleType player, guint64 *current_pos, guint64 *total_size)
584 {
585         int result = MM_ERROR_NONE;
586
587         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
588         MMPLAYER_RETURN_VAL_IF_FAIL(current_pos, MM_ERROR_COMMON_INVALID_ARGUMENT);
589         MMPLAYER_RETURN_VAL_IF_FAIL(total_size, MM_ERROR_COMMON_INVALID_ARGUMENT);
590
591         result = _mmplayer_get_pd_downloader_status(player, current_pos, total_size);
592
593         return result;
594 }
595
596 int mm_player_get_track_count(MMHandleType player, MMPlayerTrackType type, int *count)
597 {
598         int result = MM_ERROR_NONE;
599
600         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
601         MMPLAYER_RETURN_VAL_IF_FAIL(count, MM_ERROR_COMMON_INVALID_ARGUMENT);
602
603         MMPLAYER_CMD_LOCK(player);
604
605         result = _mmplayer_get_track_count(player, type, count);
606
607         MMPLAYER_CMD_UNLOCK(player);
608
609         return result;
610 }
611
612 int mm_player_select_track(MMHandleType player, MMPlayerTrackType type, int index)
613 {
614         int result = MM_ERROR_NONE;
615
616         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
617
618         MMPLAYER_CMD_LOCK(player);
619
620         result = _mmplayer_select_track(player, type, index);
621
622         MMPLAYER_CMD_UNLOCK(player);
623
624         return result;
625 }
626 #ifdef _MULTI_TRACK
627 int mm_player_track_add_subtitle_language(MMHandleType player, int index)
628 {
629         int result = MM_ERROR_NONE;
630
631         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
632
633         MMPLAYER_CMD_LOCK(player);
634
635         result = _mmplayer_track_add_subtitle_language(player, index);
636
637         MMPLAYER_CMD_UNLOCK(player);
638
639         return result;
640 }
641
642 int mm_player_track_remove_subtitle_language(MMHandleType player, int index)
643 {
644         int result = MM_ERROR_NONE;
645
646         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
647
648         MMPLAYER_CMD_LOCK(player);
649
650         result = _mmplayer_track_remove_subtitle_language(player, index);
651
652         MMPLAYER_CMD_UNLOCK(player);
653
654         return result;
655
656 }
657 #endif
658 int mm_player_get_current_track(MMHandleType player, MMPlayerTrackType type, int *index)
659 {
660         int result = MM_ERROR_NONE;
661
662         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
663         MMPLAYER_RETURN_VAL_IF_FAIL(index, MM_ERROR_COMMON_INVALID_ARGUMENT);
664
665         MMPLAYER_CMD_LOCK(player);
666
667         result = _mmplayer_get_current_track(player, type, index);
668
669         MMPLAYER_CMD_UNLOCK(player);
670
671         return result;
672 }
673
674 int mm_player_get_track_language_code(MMHandleType player,  MMPlayerTrackType type, int index, char **code)
675 {
676         int result = MM_ERROR_NONE;
677
678         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
679
680         MMPLAYER_CMD_LOCK(player);
681
682         result = _mmplayer_get_track_language_code(player, type, index, code);
683
684         MMPLAYER_CMD_UNLOCK(player);
685
686         return result;
687 }
688
689 int mm_player_set_uri(MMHandleType player, const char *uri)
690 {
691         int result = MM_ERROR_NONE;
692
693         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
694
695         MMPLAYER_CMD_LOCK(player);
696
697         result = _mmplayer_set_uri(player, uri);
698
699         MMPLAYER_CMD_UNLOCK(player);
700
701         return result;
702
703 }
704
705 int mm_player_set_next_uri(MMHandleType player, const char *uri)
706 {
707         int result = MM_ERROR_NONE;
708
709         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
710
711         MMPLAYER_CMD_LOCK(player);
712
713         result = _mmplayer_set_next_uri(player, uri, FALSE);
714
715         MMPLAYER_CMD_UNLOCK(player);
716
717         return result;
718
719 }
720
721 int mm_player_get_next_uri(MMHandleType player, char **uri)
722 {
723         int result = MM_ERROR_NONE;
724
725         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
726
727         MMPLAYER_CMD_LOCK(player);
728
729         result = _mmplayer_get_next_uri(player, uri);
730
731         MMPLAYER_CMD_UNLOCK(player);
732
733         return result;
734
735 }
736 #ifdef _MULTI_TRACK
737 int mm_player_track_foreach_selected_subtitle_language(MMHandleType player, mm_player_track_selected_subtitle_language_callback callback, void *user_param)
738 {
739         int result = MM_ERROR_NONE;
740
741         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
742
743         MMPLAYER_CMD_LOCK(player);
744
745         result = _mmplayer_track_foreach_selected_subtitle_language(player, callback, user_param);
746
747         MMPLAYER_CMD_UNLOCK(player);
748
749         return result;
750 }
751 #endif
752
753 int mm_player_has_closed_caption(MMHandleType player, bool *exist)
754 {
755         int result = MM_ERROR_NONE;
756
757         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
758         MMPLAYER_RETURN_VAL_IF_FAIL(exist, MM_ERROR_INVALID_ARGUMENT);
759
760         MMPLAYER_CMD_LOCK(player);
761
762         result = _mmplayer_has_closed_caption(player, exist);
763
764         MMPLAYER_CMD_UNLOCK(player);
765
766         return result;
767 }
768
769 void mm_player_video_stream_internal_buffer_unref(void *buffer)
770 {
771         _mm_player_video_stream_internal_buffer_unref(buffer);
772 }
773
774 int mm_player_submit_packet(MMHandleType player, media_packet_h packet)
775 {
776
777         int result = MM_ERROR_NONE;
778
779         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
780
781         /* no lock here, otherwise callback for the "need-data" signal of appsrc will be blocking */
782         //MMPLAYER_CMD_LOCK(player);
783
784         result = _mmplayer_submit_packet(player, packet);
785
786         //MMPLAYER_CMD_UNLOCK(player);
787
788         return result;
789 }
790
791 int mm_player_set_video_info(MMHandleType player, media_format_h format)
792 {
793         int result = MM_ERROR_NONE;
794
795         LOGD("\n");
796
797         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
798
799         MMPLAYER_CMD_LOCK(player);
800
801         result = _mmplayer_set_video_info(player, format);
802
803         MMPLAYER_CMD_UNLOCK(player);
804
805         return result;
806
807 }
808
809 int mm_player_set_audio_info(MMHandleType player, media_format_h format)
810 {
811         int result = MM_ERROR_NONE;
812
813         LOGD("\n");
814
815         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
816
817         MMPLAYER_CMD_LOCK(player);
818
819         result = _mmplayer_set_audio_info(player, format);
820
821         MMPLAYER_CMD_UNLOCK(player);
822
823         return result;
824 }
825
826 int mm_player_set_subtitle_info(MMHandleType player, MMPlayerSubtitleStreamInfo *subtitle_stream_info)
827 {
828         int result = MM_ERROR_NONE;
829
830         LOGD("\n");
831
832         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
833
834         MMPLAYER_CMD_LOCK(player);
835
836         result = _mmplayer_set_subtitle_info(player, subtitle_stream_info);
837
838         MMPLAYER_CMD_UNLOCK(player);
839
840         return result;
841 }
842
843 int mm_player_set_media_stream_buffer_max_size(MMHandleType player, MMPlayerStreamType type, unsigned long long max_size)
844 {
845         int result = MM_ERROR_NONE;
846
847         LOGD("\n");
848
849         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
850
851         MMPLAYER_CMD_LOCK(player);
852
853         result = _mmplayer_set_media_stream_max_size(player, type, max_size);
854
855         MMPLAYER_CMD_UNLOCK(player);
856
857         return result;
858 }
859
860 int mm_player_get_media_stream_buffer_max_size(MMHandleType player, MMPlayerStreamType type, unsigned long long *max_size)
861 {
862         int result = MM_ERROR_NONE;
863         guint64 _max_size = 0;
864
865         LOGD("\n");
866
867         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
868         MMPLAYER_RETURN_VAL_IF_FAIL(max_size, MM_ERROR_INVALID_ARGUMENT);
869
870         MMPLAYER_CMD_LOCK(player);
871
872         result = _mmplayer_get_media_stream_max_size(player, type, &_max_size);
873         *max_size = _max_size;
874
875         MMPLAYER_CMD_UNLOCK(player);
876
877         return result;
878 }
879
880 int mm_player_set_media_stream_buffer_min_percent(MMHandleType player, MMPlayerStreamType type, unsigned min_percent)
881 {
882         int result = MM_ERROR_NONE;
883
884         LOGD("\n");
885
886         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
887
888         MMPLAYER_CMD_LOCK(player);
889
890         result = _mmplayer_set_media_stream_min_percent(player, type, min_percent);
891
892         MMPLAYER_CMD_UNLOCK(player);
893
894         return result;
895 }
896
897 int mm_player_get_media_stream_buffer_min_percent(MMHandleType player, MMPlayerStreamType type, unsigned int *min_percent)
898 {
899         int result = MM_ERROR_NONE;
900
901         LOGD("\n");
902
903         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
904         MMPLAYER_RETURN_VAL_IF_FAIL(min_percent, MM_ERROR_INVALID_ARGUMENT);
905
906         MMPLAYER_CMD_LOCK(player);
907
908         result = _mmplayer_get_media_stream_min_percent(player, type, min_percent);
909
910         MMPLAYER_CMD_UNLOCK(player);
911
912         return result;
913 }
914
915 int mm_player_set_media_stream_buffer_status_callback(MMHandleType player, MMPlayerStreamType type, mm_player_media_stream_buffer_status_callback callback, void * user_param)
916 {
917         int result = MM_ERROR_NONE;
918
919         LOGD("\n");
920
921         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
922
923         MMPLAYER_CMD_LOCK(player);
924
925         result = _mmplayer_set_media_stream_buffer_status_cb(player, type, callback, user_param);
926
927         MMPLAYER_CMD_UNLOCK(player);
928
929         return result;
930 }
931
932 int mm_player_set_media_stream_seek_data_callback(MMHandleType player, MMPlayerStreamType type, mm_player_media_stream_seek_data_callback callback, void * user_param)
933 {
934         int result = MM_ERROR_NONE;
935
936         LOGD("\n");
937
938         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
939
940         MMPLAYER_CMD_LOCK(player);
941
942         result = _mmplayer_set_media_stream_seek_data_cb(player, type, callback, user_param);
943
944         MMPLAYER_CMD_UNLOCK(player);
945
946         return result;
947 }
948
949 int mm_player_set_audio_stream_changed_callback(MMHandleType player, mm_player_stream_changed_callback callback, void *user_param)
950 {
951         int result = MM_ERROR_NONE;
952
953         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
954
955         MMPLAYER_CMD_LOCK(player);
956
957         result = _mmplayer_set_audiostream_changed_cb(player, callback, user_param);
958
959         MMPLAYER_CMD_UNLOCK(player);
960
961         return result;
962 }
963
964 int mm_player_set_video_stream_changed_callback(MMHandleType player, mm_player_stream_changed_callback callback, void *user_param)
965 {
966         int result = MM_ERROR_NONE;
967
968         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
969
970         MMPLAYER_CMD_LOCK(player);
971
972         result = _mmplayer_set_videostream_changed_cb(player, callback, user_param);
973
974         MMPLAYER_CMD_UNLOCK(player);
975
976         return result;
977 }
978
979 int mm_player_get_timeout(MMHandleType player, int *timeout)
980 {
981         int result = MM_ERROR_NONE;
982
983         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
984         MMPLAYER_RETURN_VAL_IF_FAIL(timeout, MM_ERROR_COMMON_INVALID_ARGUMENT);
985
986         MMPLAYER_CMD_LOCK(player);
987
988         result = _mmplayer_get_timeout(player, timeout);
989
990         MMPLAYER_CMD_UNLOCK(player);
991
992         return result;
993 }
994
995 int mm_player_get_num_of_video_out_buffers(MMHandleType player, int *num, int *extra_num)
996 {
997         int result = MM_ERROR_NONE;
998
999         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1000         MMPLAYER_RETURN_VAL_IF_FAIL(num && extra_num, MM_ERROR_COMMON_INVALID_ARGUMENT);
1001
1002         MMPLAYER_CMD_LOCK(player);
1003
1004         result = _mmplayer_get_num_of_video_out_buffers(player, num, extra_num);
1005
1006         MMPLAYER_CMD_UNLOCK(player);
1007
1008         return result;
1009 }
1010
1011 int mm_player_set_media_stream_dynamic_resolution(MMHandleType player, bool drc)
1012 {
1013         int result = MM_ERROR_NONE;
1014
1015         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1016
1017         MMPLAYER_CMD_LOCK(player);
1018
1019         result = _mmplayer_set_media_stream_dynamic_resolution(player, drc);
1020
1021         MMPLAYER_CMD_UNLOCK(player);
1022
1023         return result;
1024 }
1025
1026 int mm_player_release_video_stream_bo(MMHandleType player, void* bo)
1027 {
1028         int result = MM_ERROR_NONE;
1029
1030         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1031         MMPLAYER_RETURN_VAL_IF_FAIL(bo, MM_ERROR_COMMON_INVALID_ARGUMENT);
1032
1033         //MMPLAYER_CMD_LOCK(player);
1034
1035         result = _mmplayer_video_stream_release_bo(player, bo);
1036
1037         //MMPLAYER_CMD_UNLOCK(player);
1038
1039         return result;
1040 }
1041
1042 int mm_player_set_file_buffering_path(MMHandleType player, const char *file_path)
1043 {
1044         int result = MM_ERROR_NONE;
1045
1046         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1047
1048         MMPLAYER_CMD_LOCK(player);
1049
1050         result = _mmplayer_set_file_buffering_path(player, file_path);
1051
1052         MMPLAYER_CMD_UNLOCK(player);
1053
1054         return result;
1055 }
1056
1057 int mm_player_set_sound_stream_info(MMHandleType player, char *stream_type, int stream_index)
1058 {
1059         int result = MM_ERROR_NONE;
1060
1061         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1062         MMPLAYER_RETURN_VAL_IF_FAIL((stream_type && (stream_index >= 0)), MM_ERROR_INVALID_ARGUMENT);
1063
1064         MMPLAYER_CMD_LOCK(player);
1065
1066         result = mm_player_set_attribute(player, NULL, "sound_stream_type", stream_type, strlen(stream_type), "sound_stream_index", stream_index, NULL);
1067
1068         MMPLAYER_CMD_UNLOCK(player);
1069
1070         return result;
1071 }
1072
1073 int mm_player_manage_external_storage_state(MMHandleType player, int id, int state)
1074 {
1075         int result = MM_ERROR_NONE;
1076
1077         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1078
1079         MMPLAYER_CMD_LOCK(player);
1080
1081         result = _mmplayer_manage_external_storage_state(player, id, state);
1082
1083         MMPLAYER_CMD_UNLOCK(player);
1084
1085         return result;
1086 }
1087
1088 int mm_player_get_adaptive_variant_info(MMHandleType player, int *num, char **var_info)
1089 {
1090         int result = MM_ERROR_NONE;
1091
1092         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1093         MMPLAYER_RETURN_VAL_IF_FAIL(num && var_info, MM_ERROR_COMMON_INVALID_ARGUMENT);
1094
1095         MMPLAYER_CMD_LOCK(player);
1096
1097         result = _mmplayer_get_adaptive_variant_info(player, num, var_info);
1098
1099         MMPLAYER_CMD_UNLOCK(player);
1100
1101         return result;
1102 }
1103
1104 int mm_player_set_max_adaptive_variant_limit(MMHandleType player, int bandwidth, int width, int height)
1105 {
1106         int result = MM_ERROR_NONE;
1107
1108         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1109
1110         MMPLAYER_CMD_LOCK(player);
1111
1112         result = _mmplayer_set_max_adaptive_variant_limit(player, bandwidth, width, height);
1113
1114         MMPLAYER_CMD_UNLOCK(player);
1115
1116         return result;
1117 }
1118
1119 int mm_player_get_max_adaptive_variant_limit(MMHandleType player, int *bandwidth, int *width, int *height)
1120 {
1121         int result = MM_ERROR_NONE;
1122
1123         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1124         MMPLAYER_RETURN_VAL_IF_FAIL(bandwidth && width && height, MM_ERROR_COMMON_INVALID_ARGUMENT);
1125
1126         MMPLAYER_CMD_LOCK(player);
1127
1128         result = _mmplayer_get_max_adaptive_variant_limit(player, bandwidth, width, height);
1129
1130         MMPLAYER_CMD_UNLOCK(player);
1131
1132         return result;
1133 }
1134
1135 int mm_player_set_streaming_buffering_time(MMHandleType player, int buffer_ms, int rebuffer_ms)
1136 {
1137         int result = MM_ERROR_NONE;
1138         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1139
1140         MMPLAYER_CMD_LOCK(player);
1141
1142         result = _mmplayer_set_streaming_buffering_time(player, buffer_ms, rebuffer_ms);
1143
1144         MMPLAYER_CMD_UNLOCK(player);
1145
1146         return result;
1147 }
1148
1149 int mm_player_get_streaming_buffering_time(MMHandleType player, int *buffer_ms, int *rebuffer_ms)
1150 {
1151         int result = MM_ERROR_NONE;
1152
1153         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1154         MMPLAYER_RETURN_VAL_IF_FAIL(buffer_ms && rebuffer_ms, MM_ERROR_INVALID_ARGUMENT);
1155
1156         MMPLAYER_CMD_LOCK(player);
1157
1158         result = _mmplayer_get_streaming_buffering_time(player, buffer_ms, rebuffer_ms);
1159
1160         MMPLAYER_CMD_UNLOCK(player);
1161
1162         return result;
1163 }
1164
1165 int mm_player_set_audio_only(MMHandleType player, bool audio_only)
1166 {
1167         int result = MM_ERROR_NONE;
1168         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1169
1170         MMPLAYER_CMD_LOCK(player);
1171
1172         result = _mmplayer_set_audio_only(player, audio_only);
1173
1174         MMPLAYER_CMD_UNLOCK(player);
1175
1176         return result;
1177 }
1178
1179 int mm_player_get_audio_only(MMHandleType player, bool *audio_only)
1180 {
1181         int result = MM_ERROR_NONE;
1182
1183         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1184         MMPLAYER_RETURN_VAL_IF_FAIL(audio_only, MM_ERROR_INVALID_ARGUMENT);
1185
1186         MMPLAYER_CMD_LOCK(player);
1187
1188         result = _mmplayer_get_audio_only(player, audio_only);
1189
1190         MMPLAYER_CMD_UNLOCK(player);
1191
1192         return result;
1193 }
1194
1195 int mm_player_360_is_content_spherical(MMHandleType player, bool *is_spherical)
1196 {
1197         int result = MM_ERROR_NONE;
1198
1199         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1200         MMPLAYER_RETURN_VAL_IF_FAIL(is_spherical, MM_ERROR_INVALID_ARGUMENT);
1201
1202         MMPLAYER_CMD_LOCK(player);
1203
1204         result = _mmplayer_360_is_content_spherical(player, is_spherical);
1205
1206         MMPLAYER_CMD_UNLOCK(player);
1207
1208         return result;
1209 }
1210
1211 int mm_player_360_set_enabled(MMHandleType player, bool enabled)
1212 {
1213         int result = MM_ERROR_NONE;
1214         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1215
1216         MMPLAYER_CMD_LOCK(player);
1217
1218         result = _mmplayer_360_set_enabled(player, enabled);
1219
1220         MMPLAYER_CMD_UNLOCK(player);
1221
1222         return result;
1223 }
1224
1225 int mm_player_360_is_enabled(MMHandleType player, bool *enabled)
1226 {
1227         int result = MM_ERROR_NONE;
1228
1229         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1230         MMPLAYER_RETURN_VAL_IF_FAIL(enabled, MM_ERROR_INVALID_ARGUMENT);
1231
1232         MMPLAYER_CMD_LOCK(player);
1233
1234         result = _mmplayer_360_is_enabled(player, enabled);
1235
1236         MMPLAYER_CMD_UNLOCK(player);
1237
1238         return result;
1239 }
1240
1241 int mm_player_360_set_direction_of_view(MMHandleType player, float yaw, float pitch)
1242 {
1243         int result = MM_ERROR_NONE;
1244         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1245
1246         MMPLAYER_CMD_LOCK(player);
1247
1248         result = _mmplayer_360_set_direction_of_view(player, yaw, pitch);
1249
1250         MMPLAYER_CMD_UNLOCK(player);
1251
1252         return result;
1253 }
1254
1255 int mm_player_360_get_direction_of_view(MMHandleType player, float *yaw, float *pitch)
1256 {
1257         int result = MM_ERROR_NONE;
1258
1259         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1260         MMPLAYER_RETURN_VAL_IF_FAIL(yaw && pitch, MM_ERROR_INVALID_ARGUMENT);
1261
1262         MMPLAYER_CMD_LOCK(player);
1263
1264         result = _mmplayer_360_get_direction_of_view(player, yaw, pitch);
1265
1266         MMPLAYER_CMD_UNLOCK(player);
1267
1268         return result;
1269 }
1270
1271 int mm_player_360_set_zoom(MMHandleType player, float level)
1272 {
1273         int result = MM_ERROR_NONE;
1274         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1275
1276         MMPLAYER_CMD_LOCK(player);
1277
1278         result = _mmplayer_360_set_zoom(player, level);
1279
1280         MMPLAYER_CMD_UNLOCK(player);
1281
1282         return result;
1283 }
1284
1285 int mm_player_360_get_zoom(MMHandleType player, float *level)
1286 {
1287         int result = MM_ERROR_NONE;
1288
1289         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1290         MMPLAYER_RETURN_VAL_IF_FAIL(level, MM_ERROR_INVALID_ARGUMENT);
1291
1292         MMPLAYER_CMD_LOCK(player);
1293
1294         result = _mmplayer_360_get_zoom(player, level);
1295
1296         MMPLAYER_CMD_UNLOCK(player);
1297
1298         return result;
1299 }
1300
1301 int mm_player_360_set_field_of_view(MMHandleType player, int horizontal_degrees, int vertical_degrees)
1302 {
1303         int result = MM_ERROR_NONE;
1304         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1305
1306         MMPLAYER_CMD_LOCK(player);
1307
1308         result = _mmplayer_360_set_field_of_view(player, horizontal_degrees, vertical_degrees);
1309
1310         MMPLAYER_CMD_UNLOCK(player);
1311
1312         return result;
1313 }
1314
1315 int mm_player_360_get_field_of_view(MMHandleType player, int *horizontal_degrees, int *vertical_degrees)
1316 {
1317         int result = MM_ERROR_NONE;
1318
1319         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1320         MMPLAYER_RETURN_VAL_IF_FAIL(horizontal_degrees && vertical_degrees, MM_ERROR_INVALID_ARGUMENT);
1321
1322         MMPLAYER_CMD_LOCK(player);
1323
1324         result = _mmplayer_360_get_field_of_view(player, horizontal_degrees, vertical_degrees);
1325
1326         MMPLAYER_CMD_UNLOCK(player);
1327
1328         return result;
1329 }
1330
1331 int mm_player_set_codec_type(MMHandleType player, MMPlayerStreamType stream_type, MMPlayerVideoCodecType codec_type)
1332 {
1333         int result = MM_ERROR_NONE;
1334
1335         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1336
1337         MMPLAYER_CMD_LOCK(player);
1338
1339         result = _mmplayer_set_codec_type(player, stream_type, codec_type);
1340
1341         MMPLAYER_CMD_UNLOCK(player);
1342
1343         return result;
1344 }
1345
1346 int mm_player_set_replaygain_enabled(MMHandleType player, bool enabled)
1347 {
1348         int result = MM_ERROR_NONE;
1349
1350         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1351
1352         MMPLAYER_CMD_LOCK(player);
1353
1354         result = _mmplayer_set_replaygain_enabled(player, enabled);
1355
1356         MMPLAYER_CMD_UNLOCK(player);
1357
1358         return result;
1359 }
1360
1361 int mm_player_is_replaygain_enabled(MMHandleType player, bool *enabled)
1362 {
1363         int result = MM_ERROR_NONE;
1364
1365         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1366         MMPLAYER_RETURN_VAL_IF_FAIL(enabled, MM_ERROR_INVALID_ARGUMENT);
1367
1368         MMPLAYER_CMD_LOCK(player);
1369
1370         result = _mmplayer_is_replaygain_enabled(player, enabled);
1371
1372         MMPLAYER_CMD_UNLOCK(player);
1373
1374         return result;
1375 }
1376
1377 int mm_player_set_video_roi_area(MMHandleType player, double scale_x, double scale_y, double scale_width, double scale_height)
1378 {
1379         int result = MM_ERROR_NONE;
1380
1381         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1382
1383         MMPLAYER_CMD_LOCK(player);
1384
1385         result = _mmplayer_set_video_roi_area(player, scale_x, scale_y, scale_width, scale_height);
1386
1387         MMPLAYER_CMD_UNLOCK(player);
1388
1389         return result;
1390 }
1391
1392 int mm_player_get_video_roi_area(MMHandleType player, double *scale_x, double *scale_y, double *scale_width, double *scale_height)
1393 {
1394         int result = MM_ERROR_NONE;
1395
1396         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1397
1398         MMPLAYER_CMD_LOCK(player);
1399
1400         result = _mmplayer_get_video_roi_area(player, scale_x, scale_y, scale_width, scale_height);
1401
1402         MMPLAYER_CMD_UNLOCK(player);
1403
1404         return result;
1405 }