[0.6.36] unrealize player if the external storage is removed
[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_prepare_buffering_time(MMHandleType player, int second)
276 {
277         int result = MM_ERROR_NONE;
278
279         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
280
281         MMPLAYER_CMD_LOCK( player );
282
283         result = _mmplayer_set_prepare_buffering_time(player, second);
284
285         MMPLAYER_CMD_UNLOCK( player );
286
287         return result;
288 }
289
290 int mm_player_set_runtime_buffering_mode(MMHandleType player, MMPlayerBufferingMode mode, int second)
291 {
292         int result = MM_ERROR_NONE;
293
294         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
295
296         MMPLAYER_CMD_LOCK( player );
297
298         result = _mmplayer_set_runtime_buffering_mode(player, mode, second);
299
300         MMPLAYER_CMD_UNLOCK( player );
301
302         return result;
303 }
304
305 int mm_player_set_volume(MMHandleType player, MMPlayerVolumeType *volume)
306 {
307         int result = MM_ERROR_NONE;
308
309         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
310         MMPLAYER_RETURN_VAL_IF_FAIL(volume, MM_ERROR_INVALID_ARGUMENT);
311
312         MMPLAYER_CMD_LOCK( player );
313
314         result = _mmplayer_set_volume(player, *volume);
315
316         MMPLAYER_CMD_UNLOCK( player );
317
318         return result;
319 }
320
321 int mm_player_get_volume(MMHandleType player, MMPlayerVolumeType *volume)
322 {
323         int result = MM_ERROR_NONE;
324
325         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
326         MMPLAYER_RETURN_VAL_IF_FAIL(volume, MM_ERROR_INVALID_ARGUMENT);
327
328         MMPLAYER_CMD_LOCK( player );
329
330         result = _mmplayer_get_volume(player, volume);
331
332         MMPLAYER_CMD_UNLOCK( player );
333
334         return result;
335 }
336
337 int mm_player_set_mute(MMHandleType player, int mute)
338 {
339         int result = MM_ERROR_NONE;
340
341         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
342
343         MMPLAYER_CMD_LOCK( player );
344
345         result = _mmplayer_set_mute(player, mute);
346
347         MMPLAYER_CMD_UNLOCK( player );
348
349         return result;
350 }
351
352 int mm_player_get_mute(MMHandleType player, int *mute)
353 {
354         int result = MM_ERROR_NONE;
355
356         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
357         MMPLAYER_RETURN_VAL_IF_FAIL(mute, MM_ERROR_INVALID_ARGUMENT);
358
359         MMPLAYER_CMD_LOCK( player );
360
361         result = _mmplayer_get_mute(player, mute);
362
363         MMPLAYER_CMD_UNLOCK( player );
364
365         return result;
366 }
367
368 int mm_player_get_state(MMHandleType player, MMPlayerStateType *state)
369 {
370         int result = MM_ERROR_NONE;
371
372         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
373         MMPLAYER_RETURN_VAL_IF_FAIL(state, MM_ERROR_COMMON_INVALID_ARGUMENT);
374
375         *state = MM_PLAYER_STATE_NULL;
376
377         result = _mmplayer_get_state(player, (int*)state);
378
379         return result;
380 }
381
382 /* NOTE : It does not support some use cases, eg using colorspace converter */
383 int mm_player_change_videosink(MMHandleType player, MMDisplaySurfaceType display_surface_type, void *display_overlay)
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_change_videosink(player, display_surface_type, display_overlay);
392
393         MMPLAYER_CMD_UNLOCK( player );
394
395         return result;
396 }
397
398 int mm_player_start(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_start(player);
407
408         MMPLAYER_CMD_UNLOCK( player );
409
410         return result;
411 }
412
413 int  mm_player_stop(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_stop(player);
422
423         MMPLAYER_CMD_UNLOCK( player );
424
425         return result;
426 }
427
428 int mm_player_pause(MMHandleType player)
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_pause(player);
437
438         MMPLAYER_CMD_UNLOCK( player );
439
440         return result;
441 }
442
443 int mm_player_resume(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_resume(player);
452
453         MMPLAYER_CMD_UNLOCK( player );
454
455         return result;
456 }
457
458 int mm_player_activate_section_repeat(MMHandleType player, int start_pos, int end_pos)
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_activate_section_repeat(player, start_pos, end_pos);
467
468         MMPLAYER_CMD_UNLOCK( player );
469
470         return result;
471 }
472
473 int mm_player_deactivate_section_repeat(MMHandleType player)
474 {
475         int result = MM_ERROR_NONE;
476
477         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
478
479         MMPLAYER_CMD_LOCK( player );
480
481         result = _mmplayer_deactivate_section_repeat(player);
482
483         MMPLAYER_CMD_UNLOCK( player );
484
485         return result;
486 }
487
488 int mm_player_gst_set_audio_channel(MMHandleType player, MMPlayerAudioChannel ch)
489 {
490         int result = MM_ERROR_NONE;
491
492         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
493         MMPLAYER_CMD_LOCK( player );
494
495         result = _mmplayer_gst_set_audio_channel(player, ch);
496
497         MMPLAYER_CMD_UNLOCK( player );
498         return result;
499 }
500
501 int mm_player_set_play_speed(MMHandleType player, float rate, bool streaming)
502 {
503         int result = MM_ERROR_NONE;
504
505         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
506
507         MMPLAYER_CMD_LOCK( player );
508
509         result = _mmplayer_set_playspeed(player, rate, streaming);
510
511         MMPLAYER_CMD_UNLOCK( player );
512
513         return result;
514 }
515
516 int mm_player_set_position(MMHandleType player, MMPlayerPosFormatType format, int pos)
517 {
518         int result = MM_ERROR_NONE;
519
520         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
521
522         if (format >= MM_PLAYER_POS_FORMAT_NUM)
523         {
524                 LOGE("wrong format\n");
525                 return MM_ERROR_COMMON_INVALID_ARGUMENT;
526         }
527
528         MMPLAYER_CMD_LOCK( player );
529
530         result = _mmplayer_set_position(player, format, pos);
531
532         MMPLAYER_CMD_UNLOCK( player );
533
534         return result;
535 }
536
537 int mm_player_get_position(MMHandleType player, MMPlayerPosFormatType format, unsigned long *pos)
538 {
539         int result = MM_ERROR_NONE;
540
541         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
542         MMPLAYER_RETURN_VAL_IF_FAIL(pos, MM_ERROR_COMMON_INVALID_ARGUMENT);
543
544         if (format >= MM_PLAYER_POS_FORMAT_NUM)
545         {
546                 LOGE("wrong format\n");
547                 return MM_ERROR_COMMON_INVALID_ARGUMENT;
548         }
549
550         MMPLAYER_CMD_LOCK( player );
551
552         result = _mmplayer_get_position(player, (int)format, pos);
553
554         MMPLAYER_CMD_UNLOCK( player );
555
556         return result;
557 }
558
559 int mm_player_get_buffer_position(MMHandleType player, MMPlayerPosFormatType format, unsigned long *start_pos, unsigned long *stop_pos)
560 {
561         int result = MM_ERROR_NONE;
562
563         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
564         MMPLAYER_RETURN_VAL_IF_FAIL(start_pos && stop_pos, MM_ERROR_COMMON_INVALID_ARGUMENT);
565
566         MMPLAYER_CMD_LOCK( player );
567
568         result = _mmplayer_get_buffer_position(player, (int)format, start_pos, stop_pos );
569
570         MMPLAYER_CMD_UNLOCK( player );
571
572         return result;
573 }
574
575 int mm_player_set_external_subtitle_path(MMHandleType player, const char* path)
576 {
577         int result = MM_ERROR_NONE;
578
579         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
580
581         MMPLAYER_CMD_LOCK( player );
582
583         result = _mmplayer_set_external_subtitle_path(player, path);
584
585         MMPLAYER_CMD_UNLOCK( player );
586         return result;
587 }
588
589 int mm_player_adjust_subtitle_position(MMHandleType player, MMPlayerPosFormatType format, int pos)
590 {
591         int result = MM_ERROR_NONE;
592
593         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
594
595         if (format >= MM_PLAYER_POS_FORMAT_NUM)
596         {
597                 LOGE("wrong format(%d) \n", format);
598                 return MM_ERROR_INVALID_ARGUMENT;
599         }
600
601         MMPLAYER_CMD_LOCK( player );
602
603         result = _mmplayer_adjust_subtitle_postion(player, format, pos);
604
605         MMPLAYER_CMD_UNLOCK( player );
606
607         return result;
608 }
609
610 int mm_player_adjust_video_position(MMHandleType player, int offset)
611 {
612         int result = MM_ERROR_NONE;
613         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
614         MMPLAYER_CMD_LOCK( player );
615
616         result = _mmplayer_adjust_video_postion(player, offset);
617
618         MMPLAYER_CMD_UNLOCK( player );
619
620         return result;
621 }
622
623 int mm_player_set_subtitle_silent(MMHandleType player, int silent)
624 {
625         int result = MM_ERROR_NONE;
626
627         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
628
629         MMPLAYER_CMD_LOCK( player );
630
631         result = _mmplayer_set_subtitle_silent(player, silent);
632
633         MMPLAYER_CMD_UNLOCK( player );
634
635         return result;
636 }
637
638 int mm_player_get_subtitle_silent(MMHandleType player, int* silent)
639 {
640         int result = MM_ERROR_NONE;
641
642         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
643
644         MMPLAYER_CMD_LOCK( player );
645
646         result = _mmplayer_get_subtitle_silent(player, silent);
647
648         MMPLAYER_CMD_UNLOCK( player );
649
650         return result;
651 }
652
653 int mm_player_set_attribute(MMHandleType player,  char **err_attr_name, const char *first_attribute_name, ...)
654 {
655         int result = MM_ERROR_NONE;
656         va_list var_args;
657
658         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
659         MMPLAYER_RETURN_VAL_IF_FAIL(first_attribute_name, MM_ERROR_COMMON_INVALID_ARGUMENT);
660
661         va_start (var_args, first_attribute_name);
662         result = _mmplayer_set_attribute(player, err_attr_name, first_attribute_name, var_args);
663         va_end (var_args);
664
665         return result;
666 }
667
668 int mm_player_get_attribute(MMHandleType player,  char **err_attr_name, const char *first_attribute_name, ...)
669 {
670         int result = MM_ERROR_NONE;
671         va_list var_args;
672
673         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
674         MMPLAYER_RETURN_VAL_IF_FAIL(first_attribute_name, MM_ERROR_COMMON_INVALID_ARGUMENT);
675
676         va_start (var_args, first_attribute_name);
677         result = _mmplayer_get_attribute(player, err_attr_name, first_attribute_name, var_args);
678         va_end (var_args);
679
680         return result;
681 }
682
683 int mm_player_get_attribute_info(MMHandleType player,  const char *attribute_name, MMPlayerAttrsInfo *info)
684 {
685         int result = MM_ERROR_NONE;
686
687
688         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
689         MMPLAYER_RETURN_VAL_IF_FAIL(attribute_name, MM_ERROR_COMMON_INVALID_ARGUMENT);
690         MMPLAYER_RETURN_VAL_IF_FAIL(info, MM_ERROR_COMMON_INVALID_ARGUMENT);
691
692         result = _mmplayer_get_attributes_info((MMHandleType)player, attribute_name, info);
693
694         return result;
695 }
696
697 int mm_player_get_pd_status(MMHandleType player, guint64 *current_pos, guint64 *total_size)
698 {
699         int result = MM_ERROR_NONE;
700
701         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
702         MMPLAYER_RETURN_VAL_IF_FAIL(current_pos, MM_ERROR_COMMON_INVALID_ARGUMENT);
703         MMPLAYER_RETURN_VAL_IF_FAIL(total_size, MM_ERROR_COMMON_INVALID_ARGUMENT);
704
705         result = _mmplayer_get_pd_downloader_status(player, current_pos, total_size);
706
707         return result;
708 }
709
710 int mm_player_get_track_count(MMHandleType player, MMPlayerTrackType type, int *count)
711 {
712         int result = MM_ERROR_NONE;
713
714         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
715         MMPLAYER_RETURN_VAL_IF_FAIL(count, MM_ERROR_COMMON_INVALID_ARGUMENT);
716
717         MMPLAYER_CMD_LOCK( player );
718
719         result = _mmplayer_get_track_count(player, type, count);
720
721         MMPLAYER_CMD_UNLOCK( player );
722
723         return result;
724 }
725
726 int mm_player_select_track(MMHandleType player, MMPlayerTrackType type, int index)
727 {
728         int result = MM_ERROR_NONE;
729
730         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
731
732         MMPLAYER_CMD_LOCK( player );
733
734         result = _mmplayer_select_track(player, type, index);
735
736         MMPLAYER_CMD_UNLOCK( player );
737
738         return result;
739 }
740 #ifdef _MULTI_TRACK
741 int mm_player_track_add_subtitle_language(MMHandleType player, int index)
742 {
743         int result = MM_ERROR_NONE;
744
745         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
746
747         MMPLAYER_CMD_LOCK( player );
748
749         result = _mmplayer_track_add_subtitle_language(player, index);
750
751         MMPLAYER_CMD_UNLOCK( player );
752
753         return result;
754 }
755
756 int mm_player_track_remove_subtitle_language(MMHandleType player, int index)
757 {
758         int result = MM_ERROR_NONE;
759
760         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
761
762         MMPLAYER_CMD_LOCK( player );
763
764         result = _mmplayer_track_remove_subtitle_language(player, index);
765
766         MMPLAYER_CMD_UNLOCK( player );
767
768         return result;
769
770 }
771 #endif
772 int mm_player_get_current_track(MMHandleType player, MMPlayerTrackType type, int *index)
773 {
774         int result = MM_ERROR_NONE;
775
776         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
777         MMPLAYER_RETURN_VAL_IF_FAIL(index, MM_ERROR_COMMON_INVALID_ARGUMENT);
778
779         MMPLAYER_CMD_LOCK( player );
780
781         result = _mmplayer_get_current_track(player, type, index);
782
783         MMPLAYER_CMD_UNLOCK( player );
784
785         return result;
786 }
787
788 int mm_player_get_track_language_code(MMHandleType player,  MMPlayerTrackType type, int index, char **code)
789 {
790         int result = MM_ERROR_NONE;
791
792         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
793
794         MMPLAYER_CMD_LOCK( player );
795
796         result = _mmplayer_get_track_language_code(player, type, index, code);
797
798         MMPLAYER_CMD_UNLOCK( player );
799
800         return result;
801 }
802
803 int mm_player_set_display_zoom(MMHandleType player, float level, int x, int y)
804 {
805         int result = MM_ERROR_NONE;
806
807         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
808
809         MMPLAYER_CMD_LOCK( player );
810
811         result = _mmplayer_set_display_zoom(player, level, x, y);
812
813         MMPLAYER_CMD_UNLOCK( player );
814
815         return result;
816 }
817
818 int mm_player_get_display_zoom(MMHandleType player, float *level, int *x, int *y)
819 {
820         int result = MM_ERROR_NONE;
821
822         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
823         MMPLAYER_RETURN_VAL_IF_FAIL(level, MM_ERROR_COMMON_INVALID_ARGUMENT);
824
825         MMPLAYER_CMD_LOCK( player );
826
827         result = _mmplayer_get_display_zoom(player, level, x, y);
828
829         MMPLAYER_CMD_UNLOCK( player );
830
831         return result;
832 }
833
834 int mm_player_set_video_share_master_clock(MMHandleType player,
835                                                 long long clock,
836                                                 long long clock_delta,
837                                                 long long video_time,
838                                                 long long media_clock,
839                                                 long long audio_time)
840 {
841         int result = MM_ERROR_NONE;
842
843         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
844
845         MMPLAYER_CMD_LOCK( player );
846
847         result = _mmplayer_set_video_share_master_clock(player, clock, clock_delta, video_time, media_clock, audio_time);
848
849         MMPLAYER_CMD_UNLOCK( player );
850
851         return result;
852 }
853
854 int mm_player_get_video_share_master_clock(MMHandleType player,
855                                                 long long *video_time,
856                                                 long long *media_clock,
857                                                 long long *audio_time)
858 {
859         int result = MM_ERROR_NONE;
860
861         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
862         MMPLAYER_RETURN_VAL_IF_FAIL(video_time, MM_ERROR_COMMON_INVALID_ARGUMENT);
863         MMPLAYER_RETURN_VAL_IF_FAIL(media_clock, MM_ERROR_COMMON_INVALID_ARGUMENT);
864         MMPLAYER_RETURN_VAL_IF_FAIL(audio_time, MM_ERROR_COMMON_INVALID_ARGUMENT);
865
866         MMPLAYER_CMD_LOCK( player );
867
868         result = _mmplayer_get_video_share_master_clock(player, video_time, media_clock, audio_time);
869
870         MMPLAYER_CMD_UNLOCK( player );
871
872         return result;
873 }
874
875 int mm_player_get_video_rotate_angle(MMHandleType player, int *angle)
876 {
877         int result = MM_ERROR_NONE;
878
879         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
880         MMPLAYER_RETURN_VAL_IF_FAIL(angle, MM_ERROR_COMMON_INVALID_ARGUMENT);
881
882         MMPLAYER_CMD_LOCK( player );
883
884         result = _mmplayer_get_video_rotate_angle(player, angle);
885
886         MMPLAYER_CMD_UNLOCK( player );
887
888         return result;
889 }
890
891 int mm_player_set_video_hub_download_mode(MMHandleType player, bool mode)
892 {
893         int result = MM_ERROR_NONE;
894
895         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
896
897         MMPLAYER_CMD_LOCK( player );
898
899         result = _mmplayer_set_video_hub_download_mode(player, mode);
900
901         MMPLAYER_CMD_UNLOCK( player );
902
903         return result;
904 }
905
906 int mm_player_enable_sync_handler(MMHandleType player, bool enable)
907 {
908         int result = MM_ERROR_NONE;
909
910         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
911
912         MMPLAYER_CMD_LOCK( player );
913
914         result = _mmplayer_enable_sync_handler(player, enable);
915
916         MMPLAYER_CMD_UNLOCK( player );
917
918         return result;
919 }
920
921 int mm_player_set_uri(MMHandleType player, const char *uri)
922 {
923         int result = MM_ERROR_NONE;
924
925         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
926
927         MMPLAYER_CMD_LOCK( player );
928
929         result = _mmplayer_set_uri(player, uri);
930
931         MMPLAYER_CMD_UNLOCK( player );
932
933         return result;
934
935 }
936
937 int mm_player_set_next_uri(MMHandleType player, const char *uri)
938 {
939         int result = MM_ERROR_NONE;
940
941         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
942
943         MMPLAYER_CMD_LOCK( player );
944
945         result = _mmplayer_set_next_uri(player, uri, FALSE);
946
947         MMPLAYER_CMD_UNLOCK( player );
948
949         return result;
950
951 }
952
953 int mm_player_get_next_uri(MMHandleType player, char **uri)
954 {
955         int result = MM_ERROR_NONE;
956
957         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
958
959         MMPLAYER_CMD_LOCK( player );
960
961         result = _mmplayer_get_next_uri(player, uri);
962
963         MMPLAYER_CMD_UNLOCK( player );
964
965         return result;
966
967 }
968 #ifdef _MULTI_TRACK
969 int mm_player_track_foreach_selected_subtitle_language(MMHandleType player, mm_player_track_selected_subtitle_language_callback callback, void *user_param)
970 {
971         int result = MM_ERROR_NONE;
972
973         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
974
975         MMPLAYER_CMD_LOCK( player );
976
977         result = _mmplayer_track_foreach_selected_subtitle_language(player, callback, user_param);
978
979         MMPLAYER_CMD_UNLOCK( player );
980
981         return result;
982 }
983 #endif
984
985 int mm_player_has_closed_caption(MMHandleType player, bool *exist)
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(exist, MM_ERROR_INVALID_ARGUMENT);
991
992         MMPLAYER_CMD_LOCK( player );
993
994         result = _mmplayer_has_closed_caption(player, exist);
995
996         MMPLAYER_CMD_UNLOCK( player );
997
998         return result;
999 }
1000
1001 void * mm_player_media_packet_video_stream_internal_buffer_ref(void *buffer)
1002 {
1003         void * result;
1004         result = _mm_player_media_packet_video_stream_internal_buffer_ref(buffer);
1005
1006         return result;
1007 }
1008
1009 void mm_player_media_packet_video_stream_internal_buffer_unref(void *buffer)
1010 {
1011         _mm_player_media_packet_video_stream_internal_buffer_unref(buffer);
1012 }
1013
1014 int mm_player_submit_packet(MMHandleType player, media_packet_h packet)
1015 {
1016
1017         int result = MM_ERROR_NONE;
1018
1019         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1020
1021         /* no lock here, otherwise callback for the "need-data" signal of appsrc will be blocking */
1022         //MMPLAYER_CMD_LOCK( player );
1023
1024         result = _mmplayer_submit_packet(player, packet);
1025
1026         //MMPLAYER_CMD_UNLOCK( player );
1027
1028         return result;
1029 }
1030
1031 int mm_player_set_video_info (MMHandleType player, media_format_h format)
1032 {
1033         int result = MM_ERROR_NONE;
1034
1035         LOGD("\n");
1036
1037         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1038
1039         MMPLAYER_CMD_LOCK( player );
1040
1041         result = _mmplayer_set_video_info(player, format);
1042
1043         MMPLAYER_CMD_UNLOCK( player );
1044
1045         return result;
1046
1047 }
1048
1049 int mm_player_set_audio_info (MMHandleType player, media_format_h format)
1050 {
1051         int result = MM_ERROR_NONE;
1052
1053         LOGD("\n");
1054
1055         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1056
1057         MMPLAYER_CMD_LOCK( player );
1058
1059         result = _mmplayer_set_audio_info(player, format);
1060
1061         MMPLAYER_CMD_UNLOCK( player );
1062
1063         return result;
1064 }
1065
1066 int mm_player_set_subtitle_info (MMHandleType player, MMPlayerSubtitleStreamInfo *subtitle_stream_info)
1067 {
1068         int result = MM_ERROR_NONE;
1069
1070         LOGD("\n");
1071
1072         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1073
1074         MMPLAYER_CMD_LOCK( player );
1075
1076         result = _mmplayer_set_subtitle_info(player, subtitle_stream_info);
1077
1078         MMPLAYER_CMD_UNLOCK( player );
1079
1080         return result;
1081 }
1082
1083 int mm_player_set_media_stream_buffer_max_size(MMHandleType player, MMPlayerStreamType type, unsigned long long max_size)
1084 {
1085         int result = MM_ERROR_NONE;
1086
1087         LOGD("\n");
1088
1089         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1090
1091         MMPLAYER_CMD_LOCK( player );
1092
1093         result = _mmplayer_set_media_stream_max_size(player, type, max_size);
1094
1095         MMPLAYER_CMD_UNLOCK( player );
1096
1097         return result;
1098 }
1099
1100 int mm_player_get_media_stream_buffer_max_size(MMHandleType player, MMPlayerStreamType type, unsigned long long *max_size)
1101 {
1102         int result = MM_ERROR_NONE;
1103         guint64 _max_size = 0;
1104
1105         LOGD("\n");
1106
1107         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1108         MMPLAYER_RETURN_VAL_IF_FAIL(max_size, MM_ERROR_INVALID_ARGUMENT);
1109
1110         MMPLAYER_CMD_LOCK( player );
1111
1112         result = _mmplayer_get_media_stream_max_size(player, type, &_max_size);
1113         *max_size = _max_size;
1114
1115         MMPLAYER_CMD_UNLOCK( player );
1116
1117         return result;
1118 }
1119
1120 int mm_player_set_media_stream_buffer_min_percent(MMHandleType player, MMPlayerStreamType type, unsigned min_percent)
1121 {
1122         int result = MM_ERROR_NONE;
1123
1124         LOGD("\n");
1125
1126         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1127
1128         MMPLAYER_CMD_LOCK( player );
1129
1130         result = _mmplayer_set_media_stream_min_percent(player, type, min_percent);
1131
1132         MMPLAYER_CMD_UNLOCK( player );
1133
1134         return result;
1135 }
1136
1137 int mm_player_get_media_stream_buffer_min_percent(MMHandleType player, MMPlayerStreamType type, unsigned int *min_percent)
1138 {
1139         int result = MM_ERROR_NONE;
1140
1141         LOGD("\n");
1142
1143         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1144         MMPLAYER_RETURN_VAL_IF_FAIL(min_percent, MM_ERROR_INVALID_ARGUMENT);
1145
1146         MMPLAYER_CMD_LOCK( player );
1147
1148         result = _mmplayer_get_media_stream_min_percent(player, type, min_percent);
1149
1150         MMPLAYER_CMD_UNLOCK( player );
1151
1152         return result;
1153 }
1154
1155 int mm_player_set_media_stream_buffer_status_callback(MMHandleType player, MMPlayerStreamType type, mm_player_media_stream_buffer_status_callback callback, void * user_param)
1156 {
1157         int result = MM_ERROR_NONE;
1158
1159         LOGD("\n");
1160
1161         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1162
1163         MMPLAYER_CMD_LOCK( player );
1164
1165         result = _mmplayer_set_media_stream_buffer_status_cb(player, type, callback, user_param);
1166
1167         MMPLAYER_CMD_UNLOCK( player );
1168
1169         return result;
1170 }
1171
1172 int mm_player_set_media_stream_seek_data_callback(MMHandleType player, MMPlayerStreamType type, mm_player_media_stream_seek_data_callback callback, void * user_param)
1173 {
1174         int result = MM_ERROR_NONE;
1175
1176         LOGD("\n");
1177
1178         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1179
1180         MMPLAYER_CMD_LOCK( player );
1181
1182         result = _mmplayer_set_media_stream_seek_data_cb(player, type, callback, user_param);
1183
1184         MMPLAYER_CMD_UNLOCK( player );
1185
1186         return result;
1187 }
1188
1189 int mm_player_set_audio_stream_changed_callback(MMHandleType player, mm_player_stream_changed_callback callback, void *user_param)
1190 {
1191         int result = MM_ERROR_NONE;
1192
1193         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1194
1195         MMPLAYER_CMD_LOCK( player );
1196
1197         result = _mmplayer_set_audiostream_changed_cb(player, callback, user_param);
1198
1199         MMPLAYER_CMD_UNLOCK( player );
1200
1201         return result;
1202 }
1203
1204 int mm_player_set_video_stream_changed_callback(MMHandleType player, mm_player_stream_changed_callback callback, void *user_param)
1205 {
1206         int result = MM_ERROR_NONE;
1207
1208         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1209
1210         MMPLAYER_CMD_LOCK( player );
1211
1212         result = _mmplayer_set_videostream_changed_cb(player, callback, user_param);
1213
1214         MMPLAYER_CMD_UNLOCK( player );
1215
1216         return result;
1217 }
1218
1219 int mm_player_set_pcm_spec(MMHandleType player, int samplerate, int channel)
1220 {
1221         int result = MM_ERROR_NONE;
1222
1223         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1224
1225         MMPLAYER_CMD_LOCK( player );
1226
1227         result = _mmplayer_set_pcm_spec(player, samplerate, channel);
1228
1229         MMPLAYER_CMD_UNLOCK( player );
1230
1231         return result;
1232 }
1233
1234 int mm_player_get_timeout(MMHandleType player, int *timeout)
1235 {
1236         int result = MM_ERROR_NONE;
1237
1238         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1239         MMPLAYER_RETURN_VAL_IF_FAIL(timeout, MM_ERROR_COMMON_INVALID_ARGUMENT);
1240
1241         MMPLAYER_CMD_LOCK( player );
1242
1243         result = _mmplayer_get_timeout(player, timeout);
1244
1245         MMPLAYER_CMD_UNLOCK( player );
1246
1247         return result;
1248 }
1249
1250 int mm_player_get_num_of_video_out_buffers(MMHandleType player, int *num, int *extra_num)
1251 {
1252         int result = MM_ERROR_NONE;
1253
1254         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1255         MMPLAYER_RETURN_VAL_IF_FAIL(num && extra_num, MM_ERROR_COMMON_INVALID_ARGUMENT);
1256
1257         MMPLAYER_CMD_LOCK( player );
1258
1259         result = _mmplayer_get_num_of_video_out_buffers(player, num, extra_num);
1260
1261         MMPLAYER_CMD_UNLOCK( player );
1262
1263         return result;
1264 }
1265
1266 int mm_player_set_media_stream_dynamic_resolution(MMHandleType player, bool drc)
1267 {
1268         int result = MM_ERROR_NONE;
1269
1270         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1271
1272         MMPLAYER_CMD_LOCK( player );
1273
1274         result = _mmplayer_set_media_stream_dynamic_resolution(player, drc);
1275
1276         MMPLAYER_CMD_UNLOCK( player );
1277
1278         return result;
1279 }
1280
1281 int mm_player_release_video_stream_bo(MMHandleType player, void* bo)
1282 {
1283         int result = MM_ERROR_NONE;
1284
1285         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1286         MMPLAYER_RETURN_VAL_IF_FAIL(bo, MM_ERROR_COMMON_INVALID_ARGUMENT);
1287 //      MMPLAYER_CMD_LOCK( player );
1288
1289         result = _mmplayer_video_stream_release_bo(player, bo);
1290
1291 //      MMPLAYER_CMD_UNLOCK( player );
1292         return result;
1293 }
1294
1295 int mm_player_set_file_buffering_path(MMHandleType player, const char *file_path)
1296 {
1297         int result = MM_ERROR_NONE;
1298
1299         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1300
1301         MMPLAYER_CMD_LOCK( player );
1302
1303         result = _mmplayer_set_file_buffering_path(player, file_path);
1304
1305         MMPLAYER_CMD_UNLOCK( player );
1306
1307         return result;
1308 }
1309
1310 int mm_player_set_sound_stream_info(MMHandleType player, char *stream_type, int stream_index)
1311 {
1312         int result = MM_ERROR_NONE;
1313
1314         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1315         MMPLAYER_RETURN_VAL_IF_FAIL((stream_type && (stream_index >= 0)), MM_ERROR_INVALID_ARGUMENT);
1316
1317         MMPLAYER_CMD_LOCK( player );
1318
1319         _mmplayer_sound_unregister(&((mm_player_t*)player)->sound_focus);
1320         result = mm_player_set_attribute(player, NULL, "sound_stream_type", stream_type, strlen(stream_type), "sound_stream_index", stream_index, NULL);
1321
1322         MMPLAYER_CMD_UNLOCK( player );
1323
1324         return result;
1325 }
1326
1327 int mm_player_manage_external_storage_state(MMHandleType player, int state)
1328 {
1329         int result = MM_ERROR_NONE;
1330
1331         MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1332
1333         MMPLAYER_CMD_LOCK( player );
1334
1335         result = _mmplayer_manage_external_storage_state(player, state);
1336
1337         MMPLAYER_CMD_UNLOCK( player );
1338
1339         return result;
1340 }