[0.6.156] remove progressive download path
[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_audio_stream_callback(MMHandleType player, bool sync, mm_player_audio_stream_callback 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         MMPLAYER_CMD_LOCK(player);
194
195         result = _mmplayer_set_audiostream_cb(player, sync, callback, user_param);
196
197         MMPLAYER_CMD_UNLOCK(player);
198
199         return result;
200 }
201
202 int mm_player_set_video_stream_callback(MMHandleType player, mm_player_video_stream_callback callback, void *user_param)
203 {
204         int result = MM_ERROR_NONE;
205
206         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
207
208         MMPLAYER_CMD_LOCK(player);
209
210         result = _mmplayer_set_videostream_cb(player, callback, user_param);
211
212         MMPLAYER_CMD_UNLOCK(player);
213
214         return result;
215 }
216
217 int mm_player_do_video_capture(MMHandleType player)
218 {
219         int result = MM_ERROR_NONE;
220
221         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
222
223         MMPLAYER_CMD_LOCK(player);
224
225         result = _mmplayer_do_video_capture(player);
226
227         MMPLAYER_CMD_UNLOCK(player);
228
229         return result;
230 }
231
232 int mm_player_set_volume(MMHandleType player, MMPlayerVolumeType *volume)
233 {
234         int result = MM_ERROR_NONE;
235
236         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
237         MMPLAYER_RETURN_VAL_IF_FAIL(volume, MM_ERROR_INVALID_ARGUMENT);
238
239         MMPLAYER_CMD_LOCK(player);
240
241         result = _mmplayer_set_volume(player, *volume);
242
243         MMPLAYER_CMD_UNLOCK(player);
244
245         return result;
246 }
247
248 int mm_player_get_volume(MMHandleType player, MMPlayerVolumeType *volume)
249 {
250         int result = MM_ERROR_NONE;
251
252         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
253         MMPLAYER_RETURN_VAL_IF_FAIL(volume, MM_ERROR_INVALID_ARGUMENT);
254
255         MMPLAYER_CMD_LOCK(player);
256
257         result = _mmplayer_get_volume(player, volume);
258
259         MMPLAYER_CMD_UNLOCK(player);
260
261         return result;
262 }
263
264 int mm_player_set_mute(MMHandleType player, int mute)
265 {
266         int result = MM_ERROR_NONE;
267
268         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
269
270         MMPLAYER_CMD_LOCK(player);
271
272         result = _mmplayer_set_mute(player, mute);
273
274         MMPLAYER_CMD_UNLOCK(player);
275
276         return result;
277 }
278
279 int mm_player_get_mute(MMHandleType player, int *mute)
280 {
281         int result = MM_ERROR_NONE;
282
283         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
284         MMPLAYER_RETURN_VAL_IF_FAIL(mute, MM_ERROR_INVALID_ARGUMENT);
285
286         MMPLAYER_CMD_LOCK(player);
287
288         result = _mmplayer_get_mute(player, mute);
289
290         MMPLAYER_CMD_UNLOCK(player);
291
292         return result;
293 }
294
295 int mm_player_get_state(MMHandleType player, MMPlayerStateType *state)
296 {
297         int result = MM_ERROR_NONE;
298
299         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
300         MMPLAYER_RETURN_VAL_IF_FAIL(state, MM_ERROR_COMMON_INVALID_ARGUMENT);
301
302         *state = MM_PLAYER_STATE_NULL;
303
304         result = _mmplayer_get_state(player, (int*)state);
305
306         return result;
307 }
308
309 /* NOTE : It does not support some use cases, eg using colorspace converter */
310 int mm_player_change_videosink(MMHandleType player, MMDisplaySurfaceType display_surface_type, void *display_overlay)
311 {
312         int result = MM_ERROR_NONE;
313
314         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
315
316         MMPLAYER_CMD_LOCK(player);
317
318         result = _mmplayer_change_videosink(player, display_surface_type, display_overlay);
319
320         MMPLAYER_CMD_UNLOCK(player);
321
322         return result;
323 }
324
325 int mm_player_start(MMHandleType player)
326 {
327         int result = MM_ERROR_NONE;
328
329         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
330
331         MMPLAYER_CMD_LOCK(player);
332
333         result = _mmplayer_start(player);
334
335         MMPLAYER_CMD_UNLOCK(player);
336
337         return result;
338 }
339
340 int  mm_player_stop(MMHandleType player)
341 {
342         int result = MM_ERROR_NONE;
343
344         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
345
346         MMPLAYER_CMD_LOCK(player);
347
348         result = _mmplayer_stop(player);
349
350         MMPLAYER_CMD_UNLOCK(player);
351
352         return result;
353 }
354
355 int mm_player_pause(MMHandleType player)
356 {
357         int result = MM_ERROR_NONE;
358
359         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
360
361         MMPLAYER_CMD_LOCK(player);
362
363         result = _mmplayer_pause(player);
364
365         MMPLAYER_CMD_UNLOCK(player);
366
367         return result;
368 }
369
370 int mm_player_resume(MMHandleType player)
371 {
372         int result = MM_ERROR_NONE;
373
374         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
375
376         MMPLAYER_CMD_LOCK(player);
377
378         result = _mmplayer_resume(player);
379
380         MMPLAYER_CMD_UNLOCK(player);
381
382         return result;
383 }
384
385 int mm_player_set_play_speed(MMHandleType player, float rate, bool streaming)
386 {
387         int result = MM_ERROR_NONE;
388
389         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
390
391         MMPLAYER_CMD_LOCK(player);
392
393         result = _mmplayer_set_playspeed(player, rate, streaming);
394
395         MMPLAYER_CMD_UNLOCK(player);
396
397         return result;
398 }
399
400 int mm_player_set_position(MMHandleType player, int64_t pos)
401 {
402         int result = MM_ERROR_NONE;
403
404         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
405
406         MMPLAYER_CMD_LOCK(player);
407
408         result = _mmplayer_set_position(player, pos);
409
410         MMPLAYER_CMD_UNLOCK(player);
411
412         return result;
413 }
414
415 int mm_player_get_position(MMHandleType player, int64_t *pos)
416 {
417         int result = MM_ERROR_NONE;
418
419         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
420         MMPLAYER_RETURN_VAL_IF_FAIL(pos, MM_ERROR_COMMON_INVALID_ARGUMENT);
421
422         MMPLAYER_CMD_LOCK(player);
423
424         result = _mmplayer_get_position(player, pos);
425
426         MMPLAYER_CMD_UNLOCK(player);
427
428         return result;
429 }
430
431 int mm_player_get_duration(MMHandleType player, int64_t *dur)
432 {
433         int result = MM_ERROR_NONE;
434
435         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
436         MMPLAYER_RETURN_VAL_IF_FAIL(dur, MM_ERROR_COMMON_INVALID_ARGUMENT);
437
438         MMPLAYER_CMD_LOCK(player);
439
440         result = _mmplayer_get_duration(player, dur);
441
442         MMPLAYER_CMD_UNLOCK(player);
443
444         return result;
445 }
446
447
448 int mm_player_get_buffer_position(MMHandleType player, MMPlayerPosFormatType format, unsigned long *start_pos, unsigned long *stop_pos)
449 {
450         int result = MM_ERROR_NONE;
451
452         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
453         MMPLAYER_RETURN_VAL_IF_FAIL(start_pos && stop_pos, MM_ERROR_COMMON_INVALID_ARGUMENT);
454
455         MMPLAYER_CMD_LOCK(player);
456
457         result = _mmplayer_get_buffer_position(player, (int)format, start_pos, stop_pos);
458
459         MMPLAYER_CMD_UNLOCK(player);
460
461         return result;
462 }
463
464 int mm_player_set_external_subtitle_path(MMHandleType player, const char* path)
465 {
466         int result = MM_ERROR_NONE;
467
468         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
469
470         MMPLAYER_CMD_LOCK(player);
471
472         result = _mmplayer_set_external_subtitle_path(player, path);
473
474         MMPLAYER_CMD_UNLOCK(player);
475         return result;
476 }
477
478 int mm_player_adjust_subtitle_position(MMHandleType player, MMPlayerPosFormatType format, int pos)
479 {
480         int result = MM_ERROR_NONE;
481
482         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
483
484         if (format >= MM_PLAYER_POS_FORMAT_NUM) {
485                 LOGE("wrong format(%d) \n", format);
486                 return MM_ERROR_INVALID_ARGUMENT;
487         }
488
489         MMPLAYER_CMD_LOCK(player);
490
491         result = _mmplayer_adjust_subtitle_postion(player, format, pos);
492
493         MMPLAYER_CMD_UNLOCK(player);
494
495         return result;
496 }
497
498 int mm_player_set_subtitle_silent(MMHandleType player, int silent)
499 {
500         int result = MM_ERROR_NONE;
501
502         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
503
504         MMPLAYER_CMD_LOCK(player);
505
506         result = _mmplayer_set_subtitle_silent(player, silent);
507
508         MMPLAYER_CMD_UNLOCK(player);
509
510         return result;
511 }
512
513 int mm_player_get_subtitle_silent(MMHandleType player, int* silent)
514 {
515         int result = MM_ERROR_NONE;
516
517         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
518
519         MMPLAYER_CMD_LOCK(player);
520
521         result = _mmplayer_get_subtitle_silent(player, silent);
522
523         MMPLAYER_CMD_UNLOCK(player);
524
525         return result;
526 }
527
528 int mm_player_set_attribute(MMHandleType player,  char **err_attr_name, const char *first_attribute_name, ...)
529 {
530         int result = MM_ERROR_NONE;
531         va_list var_args;
532
533         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
534         MMPLAYER_RETURN_VAL_IF_FAIL(first_attribute_name, MM_ERROR_COMMON_INVALID_ARGUMENT);
535
536         va_start(var_args, first_attribute_name);
537         result = _mmplayer_set_attribute(player, err_attr_name, first_attribute_name, var_args);
538         va_end(var_args);
539
540         return result;
541 }
542
543 int mm_player_get_attribute(MMHandleType player,  char **err_attr_name, const char *first_attribute_name, ...)
544 {
545         int result = MM_ERROR_NONE;
546         va_list var_args;
547
548         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
549         MMPLAYER_RETURN_VAL_IF_FAIL(first_attribute_name, MM_ERROR_COMMON_INVALID_ARGUMENT);
550
551         va_start(var_args, first_attribute_name);
552         result = _mmplayer_get_attribute(player, err_attr_name, first_attribute_name, var_args);
553         va_end(var_args);
554
555         return result;
556 }
557
558 int mm_player_get_attribute_info(MMHandleType player,  const char *attribute_name, MMPlayerAttrsInfo *info)
559 {
560         int result = MM_ERROR_NONE;
561
562
563         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
564         MMPLAYER_RETURN_VAL_IF_FAIL(attribute_name, MM_ERROR_COMMON_INVALID_ARGUMENT);
565         MMPLAYER_RETURN_VAL_IF_FAIL(info, MM_ERROR_COMMON_INVALID_ARGUMENT);
566
567         result = _mmplayer_get_attributes_info((MMHandleType)player, attribute_name, info);
568
569         return result;
570 }
571
572 int mm_player_get_track_count(MMHandleType player, MMPlayerTrackType type, int *count)
573 {
574         int result = MM_ERROR_NONE;
575
576         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
577         MMPLAYER_RETURN_VAL_IF_FAIL(count, MM_ERROR_COMMON_INVALID_ARGUMENT);
578
579         MMPLAYER_CMD_LOCK(player);
580
581         result = _mmplayer_get_track_count(player, type, count);
582
583         MMPLAYER_CMD_UNLOCK(player);
584
585         return result;
586 }
587
588 int mm_player_select_track(MMHandleType player, MMPlayerTrackType type, int index)
589 {
590         int result = MM_ERROR_NONE;
591
592         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
593
594         MMPLAYER_CMD_LOCK(player);
595
596         result = _mmplayer_select_track(player, type, index);
597
598         MMPLAYER_CMD_UNLOCK(player);
599
600         return result;
601 }
602
603 int mm_player_get_current_track(MMHandleType player, MMPlayerTrackType type, int *index)
604 {
605         int result = MM_ERROR_NONE;
606
607         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
608         MMPLAYER_RETURN_VAL_IF_FAIL(index, MM_ERROR_COMMON_INVALID_ARGUMENT);
609
610         MMPLAYER_CMD_LOCK(player);
611
612         result = _mmplayer_get_current_track(player, type, index);
613
614         MMPLAYER_CMD_UNLOCK(player);
615
616         return result;
617 }
618
619 int mm_player_get_track_language_code(MMHandleType player,  MMPlayerTrackType type, int index, char **code)
620 {
621         int result = MM_ERROR_NONE;
622
623         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
624
625         MMPLAYER_CMD_LOCK(player);
626
627         result = _mmplayer_get_track_language_code(player, type, index, code);
628
629         MMPLAYER_CMD_UNLOCK(player);
630
631         return result;
632 }
633
634 int mm_player_set_uri(MMHandleType player, const char *uri)
635 {
636         int result = MM_ERROR_NONE;
637
638         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
639
640         MMPLAYER_CMD_LOCK(player);
641
642         result = _mmplayer_set_uri(player, uri);
643
644         MMPLAYER_CMD_UNLOCK(player);
645
646         return result;
647
648 }
649
650 int mm_player_set_next_uri(MMHandleType player, const char *uri)
651 {
652         int result = MM_ERROR_NONE;
653
654         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
655
656         MMPLAYER_CMD_LOCK(player);
657
658         result = _mmplayer_set_next_uri(player, uri, FALSE);
659
660         MMPLAYER_CMD_UNLOCK(player);
661
662         return result;
663
664 }
665
666 int mm_player_get_next_uri(MMHandleType player, char **uri)
667 {
668         int result = MM_ERROR_NONE;
669
670         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
671
672         MMPLAYER_CMD_LOCK(player);
673
674         result = _mmplayer_get_next_uri(player, uri);
675
676         MMPLAYER_CMD_UNLOCK(player);
677
678         return result;
679
680 }
681
682 int mm_player_has_closed_caption(MMHandleType player, bool *exist)
683 {
684         int result = MM_ERROR_NONE;
685
686         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
687         MMPLAYER_RETURN_VAL_IF_FAIL(exist, MM_ERROR_INVALID_ARGUMENT);
688
689         MMPLAYER_CMD_LOCK(player);
690
691         result = _mmplayer_has_closed_caption(player, exist);
692
693         MMPLAYER_CMD_UNLOCK(player);
694
695         return result;
696 }
697
698 void mm_player_video_stream_internal_buffer_unref(void *buffer)
699 {
700         _mm_player_video_stream_internal_buffer_unref(buffer);
701 }
702
703 int mm_player_submit_packet(MMHandleType player, media_packet_h packet)
704 {
705
706         int result = MM_ERROR_NONE;
707
708         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
709
710         /* no lock here, otherwise callback for the "need-data" signal of appsrc will be blocking */
711         //MMPLAYER_CMD_LOCK(player);
712
713         result = _mmplayer_submit_packet(player, packet);
714
715         //MMPLAYER_CMD_UNLOCK(player);
716
717         return result;
718 }
719
720 int mm_player_set_video_info(MMHandleType player, media_format_h format)
721 {
722         int result = MM_ERROR_NONE;
723
724         LOGD("\n");
725
726         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
727
728         MMPLAYER_CMD_LOCK(player);
729
730         result = _mmplayer_set_video_info(player, format);
731
732         MMPLAYER_CMD_UNLOCK(player);
733
734         return result;
735
736 }
737
738 int mm_player_set_audio_info(MMHandleType player, media_format_h format)
739 {
740         int result = MM_ERROR_NONE;
741
742         LOGD("\n");
743
744         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
745
746         MMPLAYER_CMD_LOCK(player);
747
748         result = _mmplayer_set_audio_info(player, format);
749
750         MMPLAYER_CMD_UNLOCK(player);
751
752         return result;
753 }
754
755 int mm_player_set_subtitle_info(MMHandleType player, MMPlayerSubtitleStreamInfo *subtitle_stream_info)
756 {
757         int result = MM_ERROR_NONE;
758
759         LOGD("\n");
760
761         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
762
763         MMPLAYER_CMD_LOCK(player);
764
765         result = _mmplayer_set_subtitle_info(player, subtitle_stream_info);
766
767         MMPLAYER_CMD_UNLOCK(player);
768
769         return result;
770 }
771
772 int mm_player_set_media_stream_buffer_max_size(MMHandleType player, MMPlayerStreamType type, unsigned long long max_size)
773 {
774         int result = MM_ERROR_NONE;
775
776         LOGD("\n");
777
778         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
779
780         MMPLAYER_CMD_LOCK(player);
781
782         result = _mmplayer_set_media_stream_max_size(player, type, max_size);
783
784         MMPLAYER_CMD_UNLOCK(player);
785
786         return result;
787 }
788
789 int mm_player_get_media_stream_buffer_max_size(MMHandleType player, MMPlayerStreamType type, unsigned long long *max_size)
790 {
791         int result = MM_ERROR_NONE;
792         guint64 _max_size = 0;
793
794         LOGD("\n");
795
796         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
797         MMPLAYER_RETURN_VAL_IF_FAIL(max_size, MM_ERROR_INVALID_ARGUMENT);
798
799         MMPLAYER_CMD_LOCK(player);
800
801         result = _mmplayer_get_media_stream_max_size(player, type, &_max_size);
802         *max_size = _max_size;
803
804         MMPLAYER_CMD_UNLOCK(player);
805
806         return result;
807 }
808
809 int mm_player_set_media_stream_buffer_min_percent(MMHandleType player, MMPlayerStreamType type, unsigned min_percent)
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_media_stream_min_percent(player, type, min_percent);
820
821         MMPLAYER_CMD_UNLOCK(player);
822
823         return result;
824 }
825
826 int mm_player_get_media_stream_buffer_min_percent(MMHandleType player, MMPlayerStreamType type, unsigned int *min_percent)
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         MMPLAYER_RETURN_VAL_IF_FAIL(min_percent, MM_ERROR_INVALID_ARGUMENT);
834
835         MMPLAYER_CMD_LOCK(player);
836
837         result = _mmplayer_get_media_stream_min_percent(player, type, min_percent);
838
839         MMPLAYER_CMD_UNLOCK(player);
840
841         return result;
842 }
843
844 int mm_player_set_media_stream_buffer_status_callback(MMHandleType player, MMPlayerStreamType type, mm_player_media_stream_buffer_status_callback callback, void * user_param)
845 {
846         int result = MM_ERROR_NONE;
847
848         LOGD("\n");
849
850         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
851
852         MMPLAYER_CMD_LOCK(player);
853
854         result = _mmplayer_set_media_stream_buffer_status_cb(player, type, callback, user_param);
855
856         MMPLAYER_CMD_UNLOCK(player);
857
858         return result;
859 }
860
861 int mm_player_set_media_stream_seek_data_callback(MMHandleType player, MMPlayerStreamType type, mm_player_media_stream_seek_data_callback callback, void * user_param)
862 {
863         int result = MM_ERROR_NONE;
864
865         LOGD("\n");
866
867         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
868
869         MMPLAYER_CMD_LOCK(player);
870
871         result = _mmplayer_set_media_stream_seek_data_cb(player, type, callback, user_param);
872
873         MMPLAYER_CMD_UNLOCK(player);
874
875         return result;
876 }
877
878 int mm_player_set_audio_stream_changed_callback(MMHandleType player, mm_player_stream_changed_callback callback, void *user_param)
879 {
880         int result = MM_ERROR_NONE;
881
882         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
883
884         MMPLAYER_CMD_LOCK(player);
885
886         result = _mmplayer_set_audiostream_changed_cb(player, callback, user_param);
887
888         MMPLAYER_CMD_UNLOCK(player);
889
890         return result;
891 }
892
893 int mm_player_set_video_stream_changed_callback(MMHandleType player, mm_player_stream_changed_callback callback, void *user_param)
894 {
895         int result = MM_ERROR_NONE;
896
897         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
898
899         MMPLAYER_CMD_LOCK(player);
900
901         result = _mmplayer_set_videostream_changed_cb(player, callback, user_param);
902
903         MMPLAYER_CMD_UNLOCK(player);
904
905         return result;
906 }
907
908 int mm_player_get_timeout(MMHandleType player, int *timeout)
909 {
910         int result = MM_ERROR_NONE;
911
912         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
913         MMPLAYER_RETURN_VAL_IF_FAIL(timeout, MM_ERROR_COMMON_INVALID_ARGUMENT);
914
915         MMPLAYER_CMD_LOCK(player);
916
917         result = _mmplayer_get_timeout(player, timeout);
918
919         MMPLAYER_CMD_UNLOCK(player);
920
921         return result;
922 }
923
924 int mm_player_get_num_of_video_out_buffers(MMHandleType player, int *num, int *extra_num)
925 {
926         int result = MM_ERROR_NONE;
927
928         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
929         MMPLAYER_RETURN_VAL_IF_FAIL(num && extra_num, MM_ERROR_COMMON_INVALID_ARGUMENT);
930
931         MMPLAYER_CMD_LOCK(player);
932
933         result = _mmplayer_get_num_of_video_out_buffers(player, num, extra_num);
934
935         MMPLAYER_CMD_UNLOCK(player);
936
937         return result;
938 }
939
940 int mm_player_set_media_stream_dynamic_resolution(MMHandleType player, bool drc)
941 {
942         int result = MM_ERROR_NONE;
943
944         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
945
946         MMPLAYER_CMD_LOCK(player);
947
948         result = _mmplayer_set_media_stream_dynamic_resolution(player, drc);
949
950         MMPLAYER_CMD_UNLOCK(player);
951
952         return result;
953 }
954
955 int mm_player_release_video_stream_bo(MMHandleType player, void* bo)
956 {
957         int result = MM_ERROR_NONE;
958
959         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
960         MMPLAYER_RETURN_VAL_IF_FAIL(bo, MM_ERROR_COMMON_INVALID_ARGUMENT);
961
962         //MMPLAYER_CMD_LOCK(player);
963
964         result = _mmplayer_video_stream_release_bo(player, bo);
965
966         //MMPLAYER_CMD_UNLOCK(player);
967
968         return result;
969 }
970
971 int mm_player_set_file_buffering_path(MMHandleType player, const char *file_path)
972 {
973         int result = MM_ERROR_NONE;
974
975         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
976
977         MMPLAYER_CMD_LOCK(player);
978
979         result = _mmplayer_set_file_buffering_path(player, file_path);
980
981         MMPLAYER_CMD_UNLOCK(player);
982
983         return result;
984 }
985
986 int mm_player_set_sound_stream_info(MMHandleType player, char *stream_type, int stream_index)
987 {
988         int result = MM_ERROR_NONE;
989
990         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
991         MMPLAYER_RETURN_VAL_IF_FAIL((stream_type && (stream_index >= 0)), MM_ERROR_INVALID_ARGUMENT);
992
993         MMPLAYER_CMD_LOCK(player);
994
995         result = mm_player_set_attribute(player, NULL, "sound_stream_type", stream_type, strlen(stream_type), "sound_stream_index", stream_index, NULL);
996
997         MMPLAYER_CMD_UNLOCK(player);
998
999         return result;
1000 }
1001
1002 int mm_player_manage_external_storage_state(MMHandleType player, int id, int state)
1003 {
1004         int result = MM_ERROR_NONE;
1005
1006         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1007
1008         MMPLAYER_CMD_LOCK(player);
1009
1010         result = _mmplayer_manage_external_storage_state(player, id, state);
1011
1012         MMPLAYER_CMD_UNLOCK(player);
1013
1014         return result;
1015 }
1016
1017 int mm_player_get_adaptive_variant_info(MMHandleType player, int *num, char **var_info)
1018 {
1019         int result = MM_ERROR_NONE;
1020
1021         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1022         MMPLAYER_RETURN_VAL_IF_FAIL(num && var_info, MM_ERROR_COMMON_INVALID_ARGUMENT);
1023
1024         MMPLAYER_CMD_LOCK(player);
1025
1026         result = _mmplayer_get_adaptive_variant_info(player, num, var_info);
1027
1028         MMPLAYER_CMD_UNLOCK(player);
1029
1030         return result;
1031 }
1032
1033 int mm_player_set_max_adaptive_variant_limit(MMHandleType player, int bandwidth, int width, int height)
1034 {
1035         int result = MM_ERROR_NONE;
1036
1037         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1038
1039         MMPLAYER_CMD_LOCK(player);
1040
1041         result = _mmplayer_set_max_adaptive_variant_limit(player, bandwidth, width, height);
1042
1043         MMPLAYER_CMD_UNLOCK(player);
1044
1045         return result;
1046 }
1047
1048 int mm_player_get_max_adaptive_variant_limit(MMHandleType player, int *bandwidth, int *width, int *height)
1049 {
1050         int result = MM_ERROR_NONE;
1051
1052         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1053         MMPLAYER_RETURN_VAL_IF_FAIL(bandwidth && width && height, MM_ERROR_COMMON_INVALID_ARGUMENT);
1054
1055         MMPLAYER_CMD_LOCK(player);
1056
1057         result = _mmplayer_get_max_adaptive_variant_limit(player, bandwidth, width, height);
1058
1059         MMPLAYER_CMD_UNLOCK(player);
1060
1061         return result;
1062 }
1063
1064 int mm_player_set_streaming_buffering_time(MMHandleType player, int buffer_ms, int rebuffer_ms)
1065 {
1066         int result = MM_ERROR_NONE;
1067         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1068
1069         MMPLAYER_CMD_LOCK(player);
1070
1071         result = _mmplayer_set_streaming_buffering_time(player, buffer_ms, rebuffer_ms);
1072
1073         MMPLAYER_CMD_UNLOCK(player);
1074
1075         return result;
1076 }
1077
1078 int mm_player_get_streaming_buffering_time(MMHandleType player, int *buffer_ms, int *rebuffer_ms)
1079 {
1080         int result = MM_ERROR_NONE;
1081
1082         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1083         MMPLAYER_RETURN_VAL_IF_FAIL(buffer_ms && rebuffer_ms, MM_ERROR_INVALID_ARGUMENT);
1084
1085         MMPLAYER_CMD_LOCK(player);
1086
1087         result = _mmplayer_get_streaming_buffering_time(player, buffer_ms, rebuffer_ms);
1088
1089         MMPLAYER_CMD_UNLOCK(player);
1090
1091         return result;
1092 }
1093
1094 int mm_player_set_audio_only(MMHandleType player, bool audio_only)
1095 {
1096         int result = MM_ERROR_NONE;
1097         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1098
1099         MMPLAYER_CMD_LOCK(player);
1100
1101         result = _mmplayer_set_audio_only(player, audio_only);
1102
1103         MMPLAYER_CMD_UNLOCK(player);
1104
1105         return result;
1106 }
1107
1108 int mm_player_get_audio_only(MMHandleType player, bool *audio_only)
1109 {
1110         int result = MM_ERROR_NONE;
1111
1112         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1113         MMPLAYER_RETURN_VAL_IF_FAIL(audio_only, MM_ERROR_INVALID_ARGUMENT);
1114
1115         MMPLAYER_CMD_LOCK(player);
1116
1117         result = _mmplayer_get_audio_only(player, audio_only);
1118
1119         MMPLAYER_CMD_UNLOCK(player);
1120
1121         return result;
1122 }
1123
1124 int mm_player_360_is_content_spherical(MMHandleType player, bool *is_spherical)
1125 {
1126         int result = MM_ERROR_NONE;
1127
1128         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1129         MMPLAYER_RETURN_VAL_IF_FAIL(is_spherical, MM_ERROR_INVALID_ARGUMENT);
1130
1131         MMPLAYER_CMD_LOCK(player);
1132
1133         result = _mmplayer_360_is_content_spherical(player, is_spherical);
1134
1135         MMPLAYER_CMD_UNLOCK(player);
1136
1137         return result;
1138 }
1139
1140 int mm_player_360_set_enabled(MMHandleType player, bool enabled)
1141 {
1142         int result = MM_ERROR_NONE;
1143         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1144
1145         MMPLAYER_CMD_LOCK(player);
1146
1147         result = _mmplayer_360_set_enabled(player, enabled);
1148
1149         MMPLAYER_CMD_UNLOCK(player);
1150
1151         return result;
1152 }
1153
1154 int mm_player_360_is_enabled(MMHandleType player, bool *enabled)
1155 {
1156         int result = MM_ERROR_NONE;
1157
1158         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1159         MMPLAYER_RETURN_VAL_IF_FAIL(enabled, MM_ERROR_INVALID_ARGUMENT);
1160
1161         MMPLAYER_CMD_LOCK(player);
1162
1163         result = _mmplayer_360_is_enabled(player, enabled);
1164
1165         MMPLAYER_CMD_UNLOCK(player);
1166
1167         return result;
1168 }
1169
1170 int mm_player_360_set_direction_of_view(MMHandleType player, float yaw, float pitch)
1171 {
1172         int result = MM_ERROR_NONE;
1173         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1174
1175         MMPLAYER_CMD_LOCK(player);
1176
1177         result = _mmplayer_360_set_direction_of_view(player, yaw, pitch);
1178
1179         MMPLAYER_CMD_UNLOCK(player);
1180
1181         return result;
1182 }
1183
1184 int mm_player_360_get_direction_of_view(MMHandleType player, float *yaw, float *pitch)
1185 {
1186         int result = MM_ERROR_NONE;
1187
1188         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1189         MMPLAYER_RETURN_VAL_IF_FAIL(yaw && pitch, MM_ERROR_INVALID_ARGUMENT);
1190
1191         MMPLAYER_CMD_LOCK(player);
1192
1193         result = _mmplayer_360_get_direction_of_view(player, yaw, pitch);
1194
1195         MMPLAYER_CMD_UNLOCK(player);
1196
1197         return result;
1198 }
1199
1200 int mm_player_360_set_zoom(MMHandleType player, float level)
1201 {
1202         int result = MM_ERROR_NONE;
1203         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1204
1205         MMPLAYER_CMD_LOCK(player);
1206
1207         result = _mmplayer_360_set_zoom(player, level);
1208
1209         MMPLAYER_CMD_UNLOCK(player);
1210
1211         return result;
1212 }
1213
1214 int mm_player_360_get_zoom(MMHandleType player, float *level)
1215 {
1216         int result = MM_ERROR_NONE;
1217
1218         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1219         MMPLAYER_RETURN_VAL_IF_FAIL(level, MM_ERROR_INVALID_ARGUMENT);
1220
1221         MMPLAYER_CMD_LOCK(player);
1222
1223         result = _mmplayer_360_get_zoom(player, level);
1224
1225         MMPLAYER_CMD_UNLOCK(player);
1226
1227         return result;
1228 }
1229
1230 int mm_player_360_set_field_of_view(MMHandleType player, int horizontal_degrees, int vertical_degrees)
1231 {
1232         int result = MM_ERROR_NONE;
1233         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1234
1235         MMPLAYER_CMD_LOCK(player);
1236
1237         result = _mmplayer_360_set_field_of_view(player, horizontal_degrees, vertical_degrees);
1238
1239         MMPLAYER_CMD_UNLOCK(player);
1240
1241         return result;
1242 }
1243
1244 int mm_player_360_get_field_of_view(MMHandleType player, int *horizontal_degrees, int *vertical_degrees)
1245 {
1246         int result = MM_ERROR_NONE;
1247
1248         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1249         MMPLAYER_RETURN_VAL_IF_FAIL(horizontal_degrees && vertical_degrees, MM_ERROR_INVALID_ARGUMENT);
1250
1251         MMPLAYER_CMD_LOCK(player);
1252
1253         result = _mmplayer_360_get_field_of_view(player, horizontal_degrees, vertical_degrees);
1254
1255         MMPLAYER_CMD_UNLOCK(player);
1256
1257         return result;
1258 }
1259
1260 int mm_player_set_codec_type(MMHandleType player, MMPlayerStreamType stream_type, MMPlayerVideoCodecType codec_type)
1261 {
1262         int result = MM_ERROR_NONE;
1263
1264         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1265
1266         MMPLAYER_CMD_LOCK(player);
1267
1268         result = _mmplayer_set_codec_type(player, stream_type, codec_type);
1269
1270         MMPLAYER_CMD_UNLOCK(player);
1271
1272         return result;
1273 }
1274
1275 int mm_player_set_replaygain_enabled(MMHandleType player, bool enabled)
1276 {
1277         int result = MM_ERROR_NONE;
1278
1279         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1280
1281         MMPLAYER_CMD_LOCK(player);
1282
1283         result = _mmplayer_set_replaygain_enabled(player, enabled);
1284
1285         MMPLAYER_CMD_UNLOCK(player);
1286
1287         return result;
1288 }
1289
1290 int mm_player_is_replaygain_enabled(MMHandleType player, bool *enabled)
1291 {
1292         int result = MM_ERROR_NONE;
1293
1294         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1295         MMPLAYER_RETURN_VAL_IF_FAIL(enabled, MM_ERROR_INVALID_ARGUMENT);
1296
1297         MMPLAYER_CMD_LOCK(player);
1298
1299         result = _mmplayer_is_replaygain_enabled(player, enabled);
1300
1301         MMPLAYER_CMD_UNLOCK(player);
1302
1303         return result;
1304 }
1305
1306 int mm_player_set_video_roi_area(MMHandleType player, double scale_x, double scale_y, double scale_width, double scale_height)
1307 {
1308         int result = MM_ERROR_NONE;
1309
1310         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1311
1312         MMPLAYER_CMD_LOCK(player);
1313
1314         result = _mmplayer_set_video_roi_area(player, scale_x, scale_y, scale_width, scale_height);
1315
1316         MMPLAYER_CMD_UNLOCK(player);
1317
1318         return result;
1319 }
1320
1321 int mm_player_get_video_roi_area(MMHandleType player, double *scale_x, double *scale_y, double *scale_width, double *scale_height)
1322 {
1323         int result = MM_ERROR_NONE;
1324
1325         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1326
1327         MMPLAYER_CMD_LOCK(player);
1328
1329         result = _mmplayer_get_video_roi_area(player, scale_x, scale_y, scale_width, scale_height);
1330
1331         MMPLAYER_CMD_UNLOCK(player);
1332
1333         return result;
1334 }