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