4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
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>
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
13 * http://www.apache.org/licenses/LICENSE-2.0
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.
27 #include <mm_message.h>
29 #include "mm_player.h"
30 #include "mm_player_priv.h"
31 #include "mm_player_attrs.h"
32 #include "mm_player_utils.h"
33 #include "mm_player_ini.h"
35 #include "mm_player_capture.h"
36 #include "mm_player_tracks.h"
38 int mm_player_create(MMHandleType *player)
40 int result = MM_ERROR_NONE;
41 mm_player_t* new_player = NULL;
43 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
45 // if (!g_thread_supported ())
46 // g_thread_init (NULL); g_thread_init has been deprecated since version 2.32 and should not be used in newly-written code. This function is no longer necessary. The GLib threading system is automatically initialized at the start of your program.
48 /* alloc player structure */
49 new_player = g_malloc(sizeof(mm_player_t));
52 debug_error("Cannot allocate memory for player\n");
55 memset(new_player, 0, sizeof(mm_player_t));
57 /* create player lock */
58 g_mutex_init(&new_player->cmd_lock);
60 if (!(&new_player->cmd_lock))
62 debug_error("failed to create player lock\n");
66 /* create player lock */
67 g_mutex_init(&new_player->playback_lock);
69 if (!(&new_player->playback_lock) )
71 debug_error("failed to create playback_lock\n");
75 /* create msg callback lock */
76 g_mutex_init(&new_player->msg_cb_lock);
78 if (!(&new_player->msg_cb_lock))
80 debug_error("failed to create msg cb lock\n");
85 result = mm_player_ini_load(&new_player->ini);
86 if(result != MM_ERROR_NONE)
88 debug_error("can't load ini");
92 result = mm_player_audio_effect_ini_load(&new_player->ini);
93 if(result != MM_ERROR_NONE)
95 debug_error("can't load audio ini");
101 result = _mmplayer_create_player((MMHandleType)new_player);
103 if(result != MM_ERROR_NONE)
105 debug_error("failed to create player");
109 *player = (MMHandleType)new_player;
117 if (&new_player->cmd_lock)
119 g_mutex_clear(&new_player->cmd_lock);
122 if (&new_player->playback_lock)
124 g_mutex_clear(&new_player->playback_lock);
127 _mmplayer_destroy( (MMHandleType)new_player );
129 MMPLAYER_FREEIF( new_player );
132 *player = (MMHandleType)0;
133 return MM_ERROR_PLAYER_NO_FREE_SPACE; // are you sure?
136 int mm_player_destroy(MMHandleType player)
138 int result = MM_ERROR_NONE;
140 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
142 MMPLAYER_CMD_LOCK( player );
144 result = _mmplayer_destroy(player);
146 MMPLAYER_CMD_UNLOCK( player );
148 if (&((mm_player_t*)player)->cmd_lock)
150 g_mutex_clear(&((mm_player_t*)player)->cmd_lock);
153 if (&((mm_player_t*)player)->playback_lock)
155 g_mutex_clear(&((mm_player_t*)player)->playback_lock);
158 memset( (mm_player_t*)player, 0x00, sizeof(mm_player_t) );
161 g_free( (void*)player );
166 int mm_player_realize(MMHandleType player)
168 int result = MM_ERROR_NONE;
170 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
172 MMPLAYER_CMD_LOCK( player );
174 result = _mmplayer_realize(player);
176 MMPLAYER_CMD_UNLOCK( player );
181 int mm_player_unrealize(MMHandleType player)
183 int result = MM_ERROR_NONE;
185 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
187 MMPLAYER_CMD_LOCK( player );
189 result = _mmplayer_unrealize(player);
191 MMPLAYER_CMD_UNLOCK( player );
196 int mm_player_set_message_callback(MMHandleType player, MMMessageCallback callback, void *user_param)
198 int result = MM_ERROR_NONE;
200 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
202 MMPLAYER_CMD_LOCK( player );
204 result = _mmplayer_set_message_callback(player, callback, user_param);
206 MMPLAYER_CMD_UNLOCK( player );
211 int mm_player_set_pd_message_callback(MMHandleType player, MMMessageCallback callback, void *user_param)
213 int result = MM_ERROR_NONE;
215 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
217 result = _mm_player_set_pd_downloader_message_cb(player, callback, user_param);
222 int mm_player_set_audio_stream_callback(MMHandleType player, mm_player_audio_stream_callback callback, void *user_param)
224 int result = MM_ERROR_NONE;
226 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
228 MMPLAYER_CMD_LOCK( player );
230 result = _mmplayer_set_audiostream_cb(player, callback, user_param);
232 MMPLAYER_CMD_UNLOCK( player );
237 int mm_player_set_video_stream_callback(MMHandleType player, mm_player_video_stream_callback callback, void *user_param)
239 int result = MM_ERROR_NONE;
241 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
243 MMPLAYER_CMD_LOCK( player );
245 result = _mmplayer_set_videostream_cb(player, callback, user_param);
247 MMPLAYER_CMD_UNLOCK( player );
252 int mm_player_set_video_frame_render_error_callback(MMHandleType player, mm_player_video_frame_render_error_callback callback, void *user_param)
254 int result = MM_ERROR_NONE;
256 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
258 MMPLAYER_CMD_LOCK( player );
260 result = _mmplayer_set_videoframe_render_error_cb(player, callback, user_param);
262 MMPLAYER_CMD_UNLOCK( player );
267 int mm_player_do_video_capture(MMHandleType player)
269 int result = MM_ERROR_NONE;
271 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
273 MMPLAYER_CMD_LOCK( player );
275 result = _mmplayer_do_video_capture(player);
277 MMPLAYER_CMD_UNLOCK( player );
282 int mm_player_set_prepare_buffering_time(MMHandleType player, int second)
284 int result = MM_ERROR_NONE;
286 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
288 MMPLAYER_CMD_LOCK( player );
290 result = _mmplayer_set_prepare_buffering_time(player, second);
292 MMPLAYER_CMD_UNLOCK( player );
297 int mm_player_set_runtime_buffering_mode(MMHandleType player, MMPlayerBufferingMode mode, int second)
299 int result = MM_ERROR_NONE;
301 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
303 MMPLAYER_CMD_LOCK( player );
305 result = _mmplayer_set_runtime_buffering_mode(player, mode, second);
307 MMPLAYER_CMD_UNLOCK( player );
312 int mm_player_set_buffer_need_data_callback(MMHandleType player, mm_player_buffer_need_data_callback callback, void * user_param)
314 int result = MM_ERROR_NONE;
316 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
318 MMPLAYER_CMD_LOCK( player );
320 result = _mmplayer_set_buffer_need_data_cb(player, callback, user_param);
322 MMPLAYER_CMD_UNLOCK( player );
327 int mm_player_set_buffer_enough_data_callback(MMHandleType player, mm_player_buffer_enough_data_callback callback, void * user_param)
329 int result = MM_ERROR_NONE;
331 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
333 MMPLAYER_CMD_LOCK( player );
335 result = _mmplayer_set_buffer_enough_data_cb(player, callback, user_param);
337 MMPLAYER_CMD_UNLOCK( player );
343 int mm_player_set_buffer_seek_data_callback(MMHandleType player, mm_player_buffer_seek_data_callback callback, void * user_param)
345 int result = MM_ERROR_NONE;
347 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
349 MMPLAYER_CMD_LOCK( player );
351 result = _mmplayer_set_buffer_seek_data_cb(player, callback, user_param);
353 MMPLAYER_CMD_UNLOCK( player );
358 int mm_player_set_volume(MMHandleType player, MMPlayerVolumeType *volume)
360 int result = MM_ERROR_NONE;
362 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
363 return_val_if_fail(volume, MM_ERROR_INVALID_ARGUMENT);
365 MMPLAYER_CMD_LOCK( player );
367 result = _mmplayer_set_volume(player, *volume);
369 MMPLAYER_CMD_UNLOCK( player );
374 int mm_player_get_volume(MMHandleType player, MMPlayerVolumeType *volume)
376 int result = MM_ERROR_NONE;
378 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
379 return_val_if_fail(volume, MM_ERROR_INVALID_ARGUMENT);
381 MMPLAYER_CMD_LOCK( player );
383 result = _mmplayer_get_volume(player, volume);
385 MMPLAYER_CMD_UNLOCK( player );
390 int mm_player_set_mute(MMHandleType player, int mute)
392 int result = MM_ERROR_NONE;
394 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
396 MMPLAYER_CMD_LOCK( player );
398 result = _mmplayer_set_mute(player, mute);
400 MMPLAYER_CMD_UNLOCK( player );
405 int mm_player_get_mute(MMHandleType player, int *mute)
407 int result = MM_ERROR_NONE;
409 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
410 return_val_if_fail(mute, MM_ERROR_INVALID_ARGUMENT);
412 MMPLAYER_CMD_LOCK( player );
414 result = _mmplayer_get_mute(player, mute);
416 MMPLAYER_CMD_UNLOCK( player );
421 int mm_player_get_state(MMHandleType player, MMPlayerStateType *state)
423 int result = MM_ERROR_NONE;
425 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
426 return_val_if_fail(state, MM_ERROR_COMMON_INVALID_ARGUMENT);
428 *state = MM_PLAYER_STATE_NULL;
430 result = _mmplayer_get_state(player, (int*)state);
435 /* NOTE : It does not support some use cases, eg using colorspace converter */
436 int mm_player_change_videosink(MMHandleType player, MMDisplaySurfaceType display_surface_type, void *display_overlay)
438 int result = MM_ERROR_NONE;
440 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
442 MMPLAYER_CMD_LOCK( player );
444 result = _mmplayer_change_videosink(player, display_surface_type, display_overlay);
446 MMPLAYER_CMD_UNLOCK( player );
451 int mm_player_push_buffer(MMHandleType player, unsigned char *buf, int size)
453 int result = MM_ERROR_NONE;
455 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
457 //MMPLAYER_CMD_LOCK( player );
459 result = _mmplayer_push_buffer(player, buf, size);
461 //MMPLAYER_CMD_UNLOCK( player );
466 int mm_player_start(MMHandleType player)
468 int result = MM_ERROR_NONE;
470 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
472 MMPLAYER_CMD_LOCK( player );
474 result = _mmplayer_start(player);
476 MMPLAYER_CMD_UNLOCK( player );
481 int mm_player_stop(MMHandleType player)
483 int result = MM_ERROR_NONE;
485 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
487 MMPLAYER_CMD_LOCK( player );
489 result = _mmplayer_stop(player);
491 MMPLAYER_CMD_UNLOCK( player );
496 int mm_player_pause(MMHandleType player)
498 int result = MM_ERROR_NONE;
500 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
502 MMPLAYER_CMD_LOCK( player );
504 result = _mmplayer_pause(player);
506 MMPLAYER_CMD_UNLOCK( player );
511 int mm_player_resume(MMHandleType player)
513 int result = MM_ERROR_NONE;
515 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
517 MMPLAYER_CMD_LOCK( player );
519 result = _mmplayer_resume(player);
521 MMPLAYER_CMD_UNLOCK( player );
526 int mm_player_activate_section_repeat(MMHandleType player, int start_pos, int end_pos)
528 int result = MM_ERROR_NONE;
530 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
532 MMPLAYER_CMD_LOCK( player );
534 result = _mmplayer_activate_section_repeat(player, start_pos, end_pos);
536 MMPLAYER_CMD_UNLOCK( player );
541 int mm_player_deactivate_section_repeat(MMHandleType player)
543 int result = MM_ERROR_NONE;
545 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
547 MMPLAYER_CMD_LOCK( player );
549 result = _mmplayer_deactivate_section_repeat(player);
551 MMPLAYER_CMD_UNLOCK( player );
556 int mm_player_gst_set_audio_channel(MMHandleType player, MMPlayerAudioChannel ch)
558 int result = MM_ERROR_NONE;
560 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
561 MMPLAYER_CMD_LOCK( player );
563 result = _mmplayer_gst_set_audio_channel(player, ch);
565 MMPLAYER_CMD_UNLOCK( player );
569 int mm_player_set_play_speed(MMHandleType player, float rate)
571 int result = MM_ERROR_NONE;
573 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
575 MMPLAYER_CMD_LOCK( player );
577 result = _mmplayer_set_playspeed(player, rate);
579 MMPLAYER_CMD_UNLOCK( player );
584 int mm_player_set_position(MMHandleType player, MMPlayerPosFormatType format, int pos)
586 int result = MM_ERROR_NONE;
588 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
590 if (format >= MM_PLAYER_POS_FORMAT_NUM)
592 debug_error("wrong format\n");
593 return MM_ERROR_COMMON_INVALID_ARGUMENT;
596 MMPLAYER_CMD_LOCK( player );
598 result = _mmplayer_set_position(player, format, pos);
600 MMPLAYER_CMD_UNLOCK( player );
605 int mm_player_get_position(MMHandleType player, MMPlayerPosFormatType format, int *pos)
607 int result = MM_ERROR_NONE;
609 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
610 return_val_if_fail(pos, MM_ERROR_COMMON_INVALID_ARGUMENT);
612 if (format >= MM_PLAYER_POS_FORMAT_NUM)
614 debug_error("wrong format\n");
615 return MM_ERROR_COMMON_INVALID_ARGUMENT;
618 MMPLAYER_CMD_LOCK( player );
620 result = _mmplayer_get_position(player, (int)format, (unsigned long*)pos);
622 MMPLAYER_CMD_UNLOCK( player );
627 int mm_player_get_buffer_position(MMHandleType player, MMPlayerPosFormatType format, int *start_pos, int *stop_pos)
629 int result = MM_ERROR_NONE;
631 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
632 return_val_if_fail(start_pos && stop_pos, MM_ERROR_COMMON_INVALID_ARGUMENT);
634 MMPLAYER_CMD_LOCK( player );
636 result = _mmplayer_get_buffer_position(player, (int)format, (unsigned long*)start_pos, (unsigned long*)stop_pos );
638 MMPLAYER_CMD_UNLOCK( player );
643 int mm_player_set_external_subtitle_path(MMHandleType player, const char* path)
645 int result = MM_ERROR_NONE;
647 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
649 MMPLAYER_CMD_LOCK( player );
651 result = _mmplayer_set_external_subtitle_path(player, path);
653 MMPLAYER_CMD_UNLOCK( player );
657 int mm_player_adjust_subtitle_position(MMHandleType player, MMPlayerPosFormatType format, int pos)
659 int result = MM_ERROR_NONE;
661 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
663 if (format >= MM_PLAYER_POS_FORMAT_NUM)
665 debug_error("wrong format(%d) \n", format);
666 return MM_ERROR_INVALID_ARGUMENT;
669 MMPLAYER_CMD_LOCK( player );
671 result = _mmplayer_adjust_subtitle_postion(player, format, pos);
673 MMPLAYER_CMD_UNLOCK( player );
678 int mm_player_adjust_video_position(MMHandleType player, int offset)
680 int result = MM_ERROR_NONE;
681 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
682 MMPLAYER_CMD_LOCK( player );
684 result = _mmplayer_adjust_video_postion(player, offset);
686 MMPLAYER_CMD_UNLOCK( player );
691 int mm_player_set_subtitle_silent(MMHandleType player, int silent)
693 int result = MM_ERROR_NONE;
695 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
697 MMPLAYER_CMD_LOCK( player );
699 result = _mmplayer_set_subtitle_silent(player, silent);
701 MMPLAYER_CMD_UNLOCK( player );
706 int mm_player_get_subtitle_silent(MMHandleType player, int* silent)
708 int result = MM_ERROR_NONE;
710 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
712 MMPLAYER_CMD_LOCK( player );
714 result = _mmplayer_get_subtitle_silent(player, silent);
716 MMPLAYER_CMD_UNLOCK( player );
721 int mm_player_set_attribute(MMHandleType player, char **err_attr_name, const char *first_attribute_name, ...)
723 int result = MM_ERROR_NONE;
726 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
727 return_val_if_fail(first_attribute_name, MM_ERROR_COMMON_INVALID_ARGUMENT);
729 va_start (var_args, first_attribute_name);
730 result = _mmplayer_set_attribute(player, err_attr_name, first_attribute_name, var_args);
736 int mm_player_get_attribute(MMHandleType player, char **err_attr_name, const char *first_attribute_name, ...)
738 int result = MM_ERROR_NONE;
741 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
742 return_val_if_fail(first_attribute_name, MM_ERROR_COMMON_INVALID_ARGUMENT);
744 va_start (var_args, first_attribute_name);
745 result = _mmplayer_get_attribute(player, err_attr_name, first_attribute_name, var_args);
751 int mm_player_get_attribute_info(MMHandleType player, const char *attribute_name, MMPlayerAttrsInfo *info)
753 int result = MM_ERROR_NONE;
756 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
757 return_val_if_fail(attribute_name, MM_ERROR_COMMON_INVALID_ARGUMENT);
758 return_val_if_fail(info, MM_ERROR_COMMON_INVALID_ARGUMENT);
760 result = _mmplayer_get_attributes_info((MMHandleType)player, attribute_name, info);
765 int mm_player_get_pd_status(MMHandleType player, guint64 *current_pos, guint64 *total_size)
767 int result = MM_ERROR_NONE;
769 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
770 return_val_if_fail(current_pos, MM_ERROR_COMMON_INVALID_ARGUMENT);
771 return_val_if_fail(total_size, MM_ERROR_COMMON_INVALID_ARGUMENT);
773 result = _mmplayer_get_pd_downloader_status(player, current_pos, total_size);
778 int mm_player_get_track_count(MMHandleType player, MMPlayerTrackType type, int *count)
780 int result = MM_ERROR_NONE;
782 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
783 return_val_if_fail(count, MM_ERROR_COMMON_INVALID_ARGUMENT);
785 MMPLAYER_CMD_LOCK( player );
787 result = _mmplayer_get_track_count(player, type, count);
789 MMPLAYER_CMD_UNLOCK( player );
794 int mm_player_select_track(MMHandleType player, MMPlayerTrackType type, int index)
796 int result = MM_ERROR_NONE;
798 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
800 MMPLAYER_CMD_LOCK( player );
802 result = _mmplayer_select_track(player, type, index);
804 MMPLAYER_CMD_UNLOCK( player );
809 int mm_player_track_add_subtitle_language(MMHandleType player, int index)
811 int result = MM_ERROR_NONE;
813 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
815 MMPLAYER_CMD_LOCK( player );
817 result = _mmplayer_track_add_subtitle_language(player, index);
819 MMPLAYER_CMD_UNLOCK( player );
824 int mm_player_track_remove_subtitle_language(MMHandleType player, int index)
826 int result = MM_ERROR_NONE;
828 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
830 MMPLAYER_CMD_LOCK( player );
832 result = _mmplayer_track_remove_subtitle_language(player, index);
834 MMPLAYER_CMD_UNLOCK( player );
840 int mm_player_get_current_track(MMHandleType player, MMPlayerTrackType type, int *index)
842 int result = MM_ERROR_NONE;
844 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
845 return_val_if_fail(index, MM_ERROR_COMMON_INVALID_ARGUMENT);
847 MMPLAYER_CMD_LOCK( player );
849 result = _mmplayer_get_current_track(player, type, index);
851 MMPLAYER_CMD_UNLOCK( player );
856 int mm_player_get_track_language_code(MMHandleType player, MMPlayerTrackType type, int index, char **code)
858 int result = MM_ERROR_NONE;
860 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
862 MMPLAYER_CMD_LOCK( player );
864 result = _mmplayer_get_track_language_code(player, type, index, code);
866 MMPLAYER_CMD_UNLOCK( player );
871 int mm_player_ignore_session(MMHandleType player)
873 int result = MM_ERROR_NONE;
875 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
877 // result = _mmplayer_asm_ignore_session(player);
882 int mm_player_set_display_zoom(MMHandleType player, float level, int x, int y)
884 int result = MM_ERROR_NONE;
886 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
888 MMPLAYER_CMD_LOCK( player );
890 result = _mmplayer_set_display_zoom(player, level, x, y);
892 MMPLAYER_CMD_UNLOCK( player );
897 int mm_player_get_display_zoom(MMHandleType player, float *level, int *x, int *y)
899 int result = MM_ERROR_NONE;
901 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
902 return_val_if_fail(level, MM_ERROR_COMMON_INVALID_ARGUMENT);
904 MMPLAYER_CMD_LOCK( player );
906 result = _mmplayer_get_display_zoom(player, level, x, y);
908 MMPLAYER_CMD_UNLOCK( player );
914 int mm_player_use_system_clock(MMHandleType player)
916 int result = MM_ERROR_NONE;
918 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
920 MMPLAYER_CMD_LOCK( player );
922 result = _mmplayer_use_system_clock(player);
924 MMPLAYER_CMD_UNLOCK( player );
929 int mm_player_set_video_share_master_clock(MMHandleType player,
931 long long clock_delta,
932 long long video_time,
933 long long media_clock,
934 long long audio_time)
936 int result = MM_ERROR_NONE;
938 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
940 MMPLAYER_CMD_LOCK( player );
942 result = _mmplayer_set_video_share_master_clock(player, clock, clock_delta, video_time, media_clock, audio_time);
944 MMPLAYER_CMD_UNLOCK( player );
949 int mm_player_get_video_share_master_clock(MMHandleType player,
950 long long *video_time,
951 long long *media_clock,
952 long long *audio_time)
954 int result = MM_ERROR_NONE;
956 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
957 return_val_if_fail(video_time, MM_ERROR_COMMON_INVALID_ARGUMENT);
958 return_val_if_fail(media_clock, MM_ERROR_COMMON_INVALID_ARGUMENT);
959 return_val_if_fail(audio_time, MM_ERROR_COMMON_INVALID_ARGUMENT);
961 MMPLAYER_CMD_LOCK( player );
963 result = _mmplayer_get_video_share_master_clock(player, video_time, media_clock, audio_time);
965 MMPLAYER_CMD_UNLOCK( player );
970 int mm_player_get_video_rotate_angle(MMHandleType player, int *angle)
972 int result = MM_ERROR_NONE;
974 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
975 return_val_if_fail(angle, MM_ERROR_COMMON_INVALID_ARGUMENT);
977 MMPLAYER_CMD_LOCK( player );
979 result = _mmplayer_get_video_rotate_angle(player, angle);
981 MMPLAYER_CMD_UNLOCK( player );
986 int mm_player_set_video_hub_download_mode(MMHandleType player, bool mode)
988 int result = MM_ERROR_NONE;
990 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
992 MMPLAYER_CMD_LOCK( player );
994 result = _mmplayer_set_video_hub_download_mode(player, mode);
996 MMPLAYER_CMD_UNLOCK( player );
1001 int mm_player_enable_sync_handler(MMHandleType player, bool enable)
1003 int result = MM_ERROR_NONE;
1005 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1007 MMPLAYER_CMD_LOCK( player );
1009 result = _mmplayer_enable_sync_handler(player, enable);
1011 MMPLAYER_CMD_UNLOCK( player );
1016 int mm_player_set_uri(MMHandleType player, const char *uri)
1018 int result = MM_ERROR_NONE;
1020 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1022 MMPLAYER_CMD_LOCK( player );
1024 result = _mmplayer_set_uri(player, uri);
1026 MMPLAYER_CMD_UNLOCK( player );
1032 int mm_player_set_next_uri(MMHandleType player, const char *uri)
1034 int result = MM_ERROR_NONE;
1036 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1038 MMPLAYER_CMD_LOCK( player );
1040 result = _mmplayer_set_next_uri(player, uri, FALSE);
1042 MMPLAYER_CMD_UNLOCK( player );
1048 int mm_player_get_next_uri(MMHandleType player, char **uri)
1050 int result = MM_ERROR_NONE;
1052 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1054 MMPLAYER_CMD_LOCK( player );
1056 result = _mmplayer_get_next_uri(player, uri);
1058 MMPLAYER_CMD_UNLOCK( player );
1064 int mm_player_track_foreach_selected_subtitle_language(MMHandleType player, mm_player_track_selected_subtitle_language_callback callback, void *user_param)
1066 int result = MM_ERROR_NONE;
1068 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1070 MMPLAYER_CMD_LOCK( player );
1072 result = _mmplayer_track_foreach_selected_subtitle_language(player, callback, user_param);
1074 MMPLAYER_CMD_UNLOCK( player );
1080 int mm_player_has_closed_caption(MMHandleType player, bool *exist)
1082 int result = MM_ERROR_NONE;
1084 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1085 return_val_if_fail(exist, MM_ERROR_INVALID_ARGUMENT);
1087 MMPLAYER_CMD_LOCK( player );
1089 result = _mmplayer_has_closed_caption(player, exist);
1091 MMPLAYER_CMD_UNLOCK( player );
1096 int mm_player_enable_media_packet_video_stream(MMHandleType player, bool enable)
1098 int result = MM_ERROR_NONE;
1100 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1101 return_val_if_fail(enable, MM_ERROR_INVALID_ARGUMENT);
1103 MMPLAYER_CMD_LOCK( player );
1105 result = _mmplayer_enable_media_packet_video_stream(player, enable);
1107 MMPLAYER_CMD_UNLOCK( player );