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