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"
37 #include "mm_player_es.h"
39 int mm_player_create(MMHandleType *player)
41 int result = MM_ERROR_NONE;
42 mm_player_t* new_player = NULL;
44 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
47 /* alloc player structure */
48 new_player = g_malloc(sizeof(mm_player_t));
51 debug_error("Cannot allocate memory for player\n");
54 memset(new_player, 0, sizeof(mm_player_t));
56 /* create player lock */
57 g_mutex_init(&new_player->cmd_lock);
59 /* create player lock */
60 g_mutex_init(&new_player->playback_lock);
63 /* create msg callback lock */
64 g_mutex_init(&new_player->msg_cb_lock);
67 result = mm_player_ini_load(&new_player->ini);
68 if(result != MM_ERROR_NONE)
70 debug_error("can't load ini");
74 result = mm_player_audio_effect_ini_load(&new_player->ini);
75 if(result != MM_ERROR_NONE)
77 debug_error("can't load audio ini");
83 result = _mmplayer_create_player((MMHandleType)new_player);
85 if(result != MM_ERROR_NONE)
87 debug_error("failed to create player");
91 *player = (MMHandleType)new_player;
99 _mmplayer_destroy( (MMHandleType)new_player );
100 g_mutex_clear(&new_player->cmd_lock);
101 g_mutex_clear(&new_player->playback_lock);
103 MMPLAYER_FREEIF( new_player );
106 *player = (MMHandleType)0;
107 return MM_ERROR_PLAYER_NO_FREE_SPACE; // are you sure?
110 int mm_player_destroy(MMHandleType player)
112 int result = MM_ERROR_NONE;
114 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
116 MMPLAYER_CMD_LOCK( player );
118 result = _mmplayer_destroy(player);
120 MMPLAYER_CMD_UNLOCK( player );
122 g_mutex_clear(&((mm_player_t*)player)->cmd_lock);
123 g_mutex_clear(&((mm_player_t*)player)->playback_lock);
125 memset( (mm_player_t*)player, 0x00, sizeof(mm_player_t) );
128 g_free( (void*)player );
133 int mm_player_realize(MMHandleType player)
135 int result = MM_ERROR_NONE;
137 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
139 MMPLAYER_CMD_LOCK( player );
141 result = _mmplayer_realize(player);
143 MMPLAYER_CMD_UNLOCK( player );
148 int mm_player_unrealize(MMHandleType player)
150 int result = MM_ERROR_NONE;
152 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
154 MMPLAYER_CMD_LOCK( player );
156 result = _mmplayer_unrealize(player);
158 MMPLAYER_CMD_UNLOCK( player );
163 int mm_player_set_message_callback(MMHandleType player, MMMessageCallback callback, void *user_param)
165 int result = MM_ERROR_NONE;
167 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
169 MMPLAYER_CMD_LOCK( player );
171 result = _mmplayer_set_message_callback(player, callback, user_param);
173 MMPLAYER_CMD_UNLOCK( player );
178 int mm_player_set_pd_message_callback(MMHandleType player, MMMessageCallback callback, void *user_param)
180 int result = MM_ERROR_NONE;
182 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
184 result = _mm_player_set_pd_downloader_message_cb(player, callback, user_param);
189 int mm_player_set_audio_stream_callback(MMHandleType player, mm_player_audio_stream_callback callback, void *user_param)
191 int result = MM_ERROR_NONE;
193 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
195 MMPLAYER_CMD_LOCK( player );
197 result = _mmplayer_set_audiostream_cb(player, callback, user_param);
199 MMPLAYER_CMD_UNLOCK( player );
204 int mm_player_set_audio_stream_callback_ex(MMHandleType player, bool sync, mm_player_audio_stream_callback_ex callback, void *user_param)
206 int result = MM_ERROR_NONE;
208 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
210 MMPLAYER_CMD_LOCK( player );
212 result = _mmplayer_set_audiostream_cb_ex(player, sync, callback, user_param);
214 MMPLAYER_CMD_UNLOCK( player );
219 int mm_player_set_video_stream_callback(MMHandleType player, mm_player_video_stream_callback callback, void *user_param)
221 int result = MM_ERROR_NONE;
223 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
225 MMPLAYER_CMD_LOCK( player );
227 result = _mmplayer_set_videostream_cb(player, callback, user_param);
229 MMPLAYER_CMD_UNLOCK( player );
234 int mm_player_set_video_frame_render_error_callback(MMHandleType player, mm_player_video_frame_render_error_callback callback, void *user_param)
236 int result = MM_ERROR_NONE;
238 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
240 MMPLAYER_CMD_LOCK( player );
242 result = _mmplayer_set_videoframe_render_error_cb(player, callback, user_param);
244 MMPLAYER_CMD_UNLOCK( player );
249 int mm_player_do_video_capture(MMHandleType player)
251 int result = MM_ERROR_NONE;
253 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
255 MMPLAYER_CMD_LOCK( player );
257 result = _mmplayer_do_video_capture(player);
259 MMPLAYER_CMD_UNLOCK( player );
264 int mm_player_set_prepare_buffering_time(MMHandleType player, int second)
266 int result = MM_ERROR_NONE;
268 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
270 MMPLAYER_CMD_LOCK( player );
272 result = _mmplayer_set_prepare_buffering_time(player, second);
274 MMPLAYER_CMD_UNLOCK( player );
279 int mm_player_set_runtime_buffering_mode(MMHandleType player, MMPlayerBufferingMode mode, int second)
281 int result = MM_ERROR_NONE;
283 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
285 MMPLAYER_CMD_LOCK( player );
287 result = _mmplayer_set_runtime_buffering_mode(player, mode, second);
289 MMPLAYER_CMD_UNLOCK( player );
294 int mm_player_set_volume(MMHandleType player, MMPlayerVolumeType *volume)
296 int result = MM_ERROR_NONE;
298 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
299 return_val_if_fail(volume, MM_ERROR_INVALID_ARGUMENT);
301 MMPLAYER_CMD_LOCK( player );
303 result = _mmplayer_set_volume(player, *volume);
305 MMPLAYER_CMD_UNLOCK( player );
310 int mm_player_get_volume(MMHandleType player, MMPlayerVolumeType *volume)
312 int result = MM_ERROR_NONE;
314 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
315 return_val_if_fail(volume, MM_ERROR_INVALID_ARGUMENT);
317 MMPLAYER_CMD_LOCK( player );
319 result = _mmplayer_get_volume(player, volume);
321 MMPLAYER_CMD_UNLOCK( player );
326 int mm_player_set_mute(MMHandleType player, int mute)
328 int result = MM_ERROR_NONE;
330 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
332 MMPLAYER_CMD_LOCK( player );
334 result = _mmplayer_set_mute(player, mute);
336 MMPLAYER_CMD_UNLOCK( player );
341 int mm_player_get_mute(MMHandleType player, int *mute)
343 int result = MM_ERROR_NONE;
345 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
346 return_val_if_fail(mute, MM_ERROR_INVALID_ARGUMENT);
348 MMPLAYER_CMD_LOCK( player );
350 result = _mmplayer_get_mute(player, mute);
352 MMPLAYER_CMD_UNLOCK( player );
357 int mm_player_get_state(MMHandleType player, MMPlayerStateType *state)
359 int result = MM_ERROR_NONE;
361 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
362 return_val_if_fail(state, MM_ERROR_COMMON_INVALID_ARGUMENT);
364 *state = MM_PLAYER_STATE_NULL;
366 result = _mmplayer_get_state(player, (int*)state);
371 /* NOTE : It does not support some use cases, eg using colorspace converter */
372 int mm_player_change_videosink(MMHandleType player, MMDisplaySurfaceType display_surface_type, void *display_overlay)
374 int result = MM_ERROR_NONE;
376 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
378 MMPLAYER_CMD_LOCK( player );
380 result = _mmplayer_change_videosink(player, display_surface_type, display_overlay);
382 MMPLAYER_CMD_UNLOCK( player );
387 int mm_player_push_buffer(MMHandleType player, unsigned char *buf, int size)
389 int result = MM_ERROR_NONE;
391 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
393 //MMPLAYER_CMD_LOCK( player );
395 result = _mmplayer_push_buffer(player, buf, size);
397 //MMPLAYER_CMD_UNLOCK( player );
402 int mm_player_start(MMHandleType player)
404 int result = MM_ERROR_NONE;
406 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
408 MMPLAYER_CMD_LOCK( player );
410 result = _mmplayer_start(player);
412 MMPLAYER_CMD_UNLOCK( player );
417 int mm_player_stop(MMHandleType player)
419 int result = MM_ERROR_NONE;
421 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
423 MMPLAYER_CMD_LOCK( player );
425 result = _mmplayer_stop(player);
427 MMPLAYER_CMD_UNLOCK( player );
432 int mm_player_pause(MMHandleType player)
434 int result = MM_ERROR_NONE;
436 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
438 MMPLAYER_CMD_LOCK( player );
440 result = _mmplayer_pause(player);
442 MMPLAYER_CMD_UNLOCK( player );
447 int mm_player_resume(MMHandleType player)
449 int result = MM_ERROR_NONE;
451 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
453 MMPLAYER_CMD_LOCK( player );
455 result = _mmplayer_resume(player);
457 MMPLAYER_CMD_UNLOCK( player );
462 int mm_player_activate_section_repeat(MMHandleType player, int start_pos, int end_pos)
464 int result = MM_ERROR_NONE;
466 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
468 MMPLAYER_CMD_LOCK( player );
470 result = _mmplayer_activate_section_repeat(player, start_pos, end_pos);
472 MMPLAYER_CMD_UNLOCK( player );
477 int mm_player_deactivate_section_repeat(MMHandleType player)
479 int result = MM_ERROR_NONE;
481 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
483 MMPLAYER_CMD_LOCK( player );
485 result = _mmplayer_deactivate_section_repeat(player);
487 MMPLAYER_CMD_UNLOCK( player );
492 int mm_player_gst_set_audio_channel(MMHandleType player, MMPlayerAudioChannel ch)
494 int result = MM_ERROR_NONE;
496 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
497 MMPLAYER_CMD_LOCK( player );
499 result = _mmplayer_gst_set_audio_channel(player, ch);
501 MMPLAYER_CMD_UNLOCK( player );
505 int mm_player_set_play_speed(MMHandleType player, float rate)
507 int result = MM_ERROR_NONE;
509 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
511 MMPLAYER_CMD_LOCK( player );
513 result = _mmplayer_set_playspeed(player, rate);
515 MMPLAYER_CMD_UNLOCK( player );
520 int mm_player_set_position(MMHandleType player, MMPlayerPosFormatType format, int pos)
522 int result = MM_ERROR_NONE;
524 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
526 if (format >= MM_PLAYER_POS_FORMAT_NUM)
528 debug_error("wrong format\n");
529 return MM_ERROR_COMMON_INVALID_ARGUMENT;
532 MMPLAYER_CMD_LOCK( player );
534 result = _mmplayer_set_position(player, format, pos);
536 MMPLAYER_CMD_UNLOCK( player );
541 int mm_player_get_position(MMHandleType player, MMPlayerPosFormatType format, int *pos)
543 int result = MM_ERROR_NONE;
545 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
546 return_val_if_fail(pos, MM_ERROR_COMMON_INVALID_ARGUMENT);
548 if (format >= MM_PLAYER_POS_FORMAT_NUM)
550 debug_error("wrong format\n");
551 return MM_ERROR_COMMON_INVALID_ARGUMENT;
554 MMPLAYER_CMD_LOCK( player );
556 result = _mmplayer_get_position(player, (int)format, (unsigned long*)pos);
558 MMPLAYER_CMD_UNLOCK( player );
563 int mm_player_get_buffer_position(MMHandleType player, MMPlayerPosFormatType format, int *start_pos, int *stop_pos)
565 int result = MM_ERROR_NONE;
567 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
568 return_val_if_fail(start_pos && stop_pos, MM_ERROR_COMMON_INVALID_ARGUMENT);
570 MMPLAYER_CMD_LOCK( player );
572 result = _mmplayer_get_buffer_position(player, (int)format, (unsigned long*)start_pos, (unsigned long*)stop_pos );
574 MMPLAYER_CMD_UNLOCK( player );
579 int mm_player_set_external_subtitle_path(MMHandleType player, const char* path)
581 int result = MM_ERROR_NONE;
583 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
585 MMPLAYER_CMD_LOCK( player );
587 result = _mmplayer_set_external_subtitle_path(player, path);
589 MMPLAYER_CMD_UNLOCK( player );
593 int mm_player_adjust_subtitle_position(MMHandleType player, MMPlayerPosFormatType format, int pos)
595 int result = MM_ERROR_NONE;
597 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
599 if (format >= MM_PLAYER_POS_FORMAT_NUM)
601 debug_error("wrong format(%d) \n", format);
602 return MM_ERROR_INVALID_ARGUMENT;
605 MMPLAYER_CMD_LOCK( player );
607 result = _mmplayer_adjust_subtitle_postion(player, format, pos);
609 MMPLAYER_CMD_UNLOCK( player );
614 int mm_player_adjust_video_position(MMHandleType player, int offset)
616 int result = MM_ERROR_NONE;
617 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
618 MMPLAYER_CMD_LOCK( player );
620 result = _mmplayer_adjust_video_postion(player, offset);
622 MMPLAYER_CMD_UNLOCK( player );
627 int mm_player_set_subtitle_silent(MMHandleType player, int silent)
629 int result = MM_ERROR_NONE;
631 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
633 MMPLAYER_CMD_LOCK( player );
635 result = _mmplayer_set_subtitle_silent(player, silent);
637 MMPLAYER_CMD_UNLOCK( player );
642 int mm_player_get_subtitle_silent(MMHandleType player, int* silent)
644 int result = MM_ERROR_NONE;
646 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
648 MMPLAYER_CMD_LOCK( player );
650 result = _mmplayer_get_subtitle_silent(player, silent);
652 MMPLAYER_CMD_UNLOCK( player );
657 int mm_player_set_attribute(MMHandleType player, char **err_attr_name, const char *first_attribute_name, ...)
659 int result = MM_ERROR_NONE;
662 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
663 return_val_if_fail(first_attribute_name, MM_ERROR_COMMON_INVALID_ARGUMENT);
665 va_start (var_args, first_attribute_name);
666 result = _mmplayer_set_attribute(player, err_attr_name, first_attribute_name, var_args);
672 int mm_player_get_attribute(MMHandleType player, char **err_attr_name, const char *first_attribute_name, ...)
674 int result = MM_ERROR_NONE;
677 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
678 return_val_if_fail(first_attribute_name, MM_ERROR_COMMON_INVALID_ARGUMENT);
680 va_start (var_args, first_attribute_name);
681 result = _mmplayer_get_attribute(player, err_attr_name, first_attribute_name, var_args);
687 int mm_player_get_attribute_info(MMHandleType player, const char *attribute_name, MMPlayerAttrsInfo *info)
689 int result = MM_ERROR_NONE;
692 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
693 return_val_if_fail(attribute_name, MM_ERROR_COMMON_INVALID_ARGUMENT);
694 return_val_if_fail(info, MM_ERROR_COMMON_INVALID_ARGUMENT);
696 result = _mmplayer_get_attributes_info((MMHandleType)player, attribute_name, info);
701 int mm_player_get_pd_status(MMHandleType player, guint64 *current_pos, guint64 *total_size)
703 int result = MM_ERROR_NONE;
705 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
706 return_val_if_fail(current_pos, MM_ERROR_COMMON_INVALID_ARGUMENT);
707 return_val_if_fail(total_size, MM_ERROR_COMMON_INVALID_ARGUMENT);
709 result = _mmplayer_get_pd_downloader_status(player, current_pos, total_size);
714 int mm_player_get_track_count(MMHandleType player, MMPlayerTrackType type, int *count)
716 int result = MM_ERROR_NONE;
718 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
719 return_val_if_fail(count, MM_ERROR_COMMON_INVALID_ARGUMENT);
721 MMPLAYER_CMD_LOCK( player );
723 result = _mmplayer_get_track_count(player, type, count);
725 MMPLAYER_CMD_UNLOCK( player );
730 int mm_player_select_track(MMHandleType player, MMPlayerTrackType type, int index)
732 int result = MM_ERROR_NONE;
734 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
736 MMPLAYER_CMD_LOCK( player );
738 result = _mmplayer_select_track(player, type, index);
740 MMPLAYER_CMD_UNLOCK( player );
745 int mm_player_track_add_subtitle_language(MMHandleType player, int index)
747 int result = MM_ERROR_NONE;
749 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
751 MMPLAYER_CMD_LOCK( player );
753 result = _mmplayer_track_add_subtitle_language(player, index);
755 MMPLAYER_CMD_UNLOCK( player );
760 int mm_player_track_remove_subtitle_language(MMHandleType player, int index)
762 int result = MM_ERROR_NONE;
764 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
766 MMPLAYER_CMD_LOCK( player );
768 result = _mmplayer_track_remove_subtitle_language(player, index);
770 MMPLAYER_CMD_UNLOCK( player );
776 int mm_player_get_current_track(MMHandleType player, MMPlayerTrackType type, int *index)
778 int result = MM_ERROR_NONE;
780 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
781 return_val_if_fail(index, MM_ERROR_COMMON_INVALID_ARGUMENT);
783 MMPLAYER_CMD_LOCK( player );
785 result = _mmplayer_get_current_track(player, type, index);
787 MMPLAYER_CMD_UNLOCK( player );
792 int mm_player_get_track_language_code(MMHandleType player, MMPlayerTrackType type, int index, char **code)
794 int result = MM_ERROR_NONE;
796 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
798 MMPLAYER_CMD_LOCK( player );
800 result = _mmplayer_get_track_language_code(player, type, index, code);
802 MMPLAYER_CMD_UNLOCK( player );
807 int mm_player_ignore_session(MMHandleType player)
809 int result = MM_ERROR_NONE;
811 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
813 result = _mmplayer_asm_ignore_session(player);
818 int mm_player_set_display_zoom(MMHandleType player, float level, int x, int y)
820 int result = MM_ERROR_NONE;
822 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
824 MMPLAYER_CMD_LOCK( player );
826 result = _mmplayer_set_display_zoom(player, level, x, y);
828 MMPLAYER_CMD_UNLOCK( player );
833 int mm_player_get_display_zoom(MMHandleType player, float *level, int *x, int *y)
835 int result = MM_ERROR_NONE;
837 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
838 return_val_if_fail(level, MM_ERROR_COMMON_INVALID_ARGUMENT);
840 MMPLAYER_CMD_LOCK( player );
842 result = _mmplayer_get_display_zoom(player, level, x, y);
844 MMPLAYER_CMD_UNLOCK( player );
850 int mm_player_use_system_clock(MMHandleType player)
852 int result = MM_ERROR_NONE;
854 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
856 MMPLAYER_CMD_LOCK( player );
858 result = _mmplayer_use_system_clock(player);
860 MMPLAYER_CMD_UNLOCK( player );
865 int mm_player_set_video_share_master_clock(MMHandleType player,
867 long long clock_delta,
868 long long video_time,
869 long long media_clock,
870 long long audio_time)
872 int result = MM_ERROR_NONE;
874 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
876 MMPLAYER_CMD_LOCK( player );
878 result = _mmplayer_set_video_share_master_clock(player, clock, clock_delta, video_time, media_clock, audio_time);
880 MMPLAYER_CMD_UNLOCK( player );
885 int mm_player_get_video_share_master_clock(MMHandleType player,
886 long long *video_time,
887 long long *media_clock,
888 long long *audio_time)
890 int result = MM_ERROR_NONE;
892 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
893 return_val_if_fail(video_time, MM_ERROR_COMMON_INVALID_ARGUMENT);
894 return_val_if_fail(media_clock, MM_ERROR_COMMON_INVALID_ARGUMENT);
895 return_val_if_fail(audio_time, MM_ERROR_COMMON_INVALID_ARGUMENT);
897 MMPLAYER_CMD_LOCK( player );
899 result = _mmplayer_get_video_share_master_clock(player, video_time, media_clock, audio_time);
901 MMPLAYER_CMD_UNLOCK( player );
906 int mm_player_get_video_rotate_angle(MMHandleType player, int *angle)
908 int result = MM_ERROR_NONE;
910 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
911 return_val_if_fail(angle, MM_ERROR_COMMON_INVALID_ARGUMENT);
913 MMPLAYER_CMD_LOCK( player );
915 result = _mmplayer_get_video_rotate_angle(player, angle);
917 MMPLAYER_CMD_UNLOCK( player );
922 int mm_player_set_video_hub_download_mode(MMHandleType player, bool mode)
924 int result = MM_ERROR_NONE;
926 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
928 MMPLAYER_CMD_LOCK( player );
930 result = _mmplayer_set_video_hub_download_mode(player, mode);
932 MMPLAYER_CMD_UNLOCK( player );
937 int mm_player_enable_sync_handler(MMHandleType player, bool enable)
939 int result = MM_ERROR_NONE;
941 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
943 MMPLAYER_CMD_LOCK( player );
945 result = _mmplayer_enable_sync_handler(player, enable);
947 MMPLAYER_CMD_UNLOCK( player );
952 int mm_player_set_uri(MMHandleType player, const char *uri)
954 int result = MM_ERROR_NONE;
956 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
958 MMPLAYER_CMD_LOCK( player );
960 result = _mmplayer_set_uri(player, uri);
962 MMPLAYER_CMD_UNLOCK( player );
968 int mm_player_set_next_uri(MMHandleType player, const char *uri)
970 int result = MM_ERROR_NONE;
972 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
974 MMPLAYER_CMD_LOCK( player );
976 result = _mmplayer_set_next_uri(player, uri, FALSE);
978 MMPLAYER_CMD_UNLOCK( player );
984 int mm_player_get_next_uri(MMHandleType player, char **uri)
986 int result = MM_ERROR_NONE;
988 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
990 MMPLAYER_CMD_LOCK( player );
992 result = _mmplayer_get_next_uri(player, uri);
994 MMPLAYER_CMD_UNLOCK( player );
1000 int mm_player_track_foreach_selected_subtitle_language(MMHandleType player, mm_player_track_selected_subtitle_language_callback callback, void *user_param)
1002 int result = MM_ERROR_NONE;
1004 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1006 MMPLAYER_CMD_LOCK( player );
1008 result = _mmplayer_track_foreach_selected_subtitle_language(player, callback, user_param);
1010 MMPLAYER_CMD_UNLOCK( player );
1016 int mm_player_has_closed_caption(MMHandleType player, bool *exist)
1018 int result = MM_ERROR_NONE;
1020 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1021 return_val_if_fail(exist, MM_ERROR_INVALID_ARGUMENT);
1023 MMPLAYER_CMD_LOCK( player );
1025 result = _mmplayer_has_closed_caption(player, exist);
1027 MMPLAYER_CMD_UNLOCK( player );
1032 int mm_player_enable_media_packet_video_stream(MMHandleType player, bool enable)
1034 int result = MM_ERROR_NONE;
1036 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1037 return_val_if_fail(enable, MM_ERROR_INVALID_ARGUMENT);
1039 MMPLAYER_CMD_LOCK( player );
1041 result = _mmplayer_enable_media_packet_video_stream(player, enable);
1043 MMPLAYER_CMD_UNLOCK( player );
1048 void * mm_player_media_packet_video_stream_internal_buffer_ref(void *buffer)
1051 result = _mm_player_media_packet_video_stream_internal_buffer_ref(buffer);
1056 void mm_player_media_packet_video_stream_internal_buffer_unref(void *buffer)
1058 _mm_player_media_packet_video_stream_internal_buffer_unref(buffer);
1062 int mm_player_submit_packet(MMHandleType player, media_packet_h packet)
1065 int result = MM_ERROR_NONE;
1067 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1069 /* no lock here, otherwise callback for the "need-data" signal of appsrc will be blocking */
1070 //MMPLAYER_CMD_LOCK( player );
1072 result = _mmplayer_submit_packet(player, packet);
1074 //MMPLAYER_CMD_UNLOCK( player );
1079 int mm_player_set_video_info (MMHandleType player, media_format_h format)
1081 int result = MM_ERROR_NONE;
1085 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1087 MMPLAYER_CMD_LOCK( player );
1089 result = _mmplayer_set_video_info(player, format);
1091 MMPLAYER_CMD_UNLOCK( player );
1097 int mm_player_set_audio_info (MMHandleType player, media_format_h format)
1099 int result = MM_ERROR_NONE;
1103 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1105 MMPLAYER_CMD_LOCK( player );
1107 result = _mmplayer_set_audio_info(player, format);
1109 MMPLAYER_CMD_UNLOCK( player );
1114 int mm_player_set_subtitle_info (MMHandleType player, MMPlayerSubtitleStreamInfo *subtitle_stream_info)
1116 int result = MM_ERROR_NONE;
1120 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1122 MMPLAYER_CMD_LOCK( player );
1124 result = _mmplayer_set_subtitle_info(player, subtitle_stream_info);
1126 MMPLAYER_CMD_UNLOCK( player );
1131 int mm_player_set_media_stream_buffer_max_size(MMHandleType player, MMPlayerStreamType type, unsigned long long max_size)
1133 int result = MM_ERROR_NONE;
1137 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1139 MMPLAYER_CMD_LOCK( player );
1141 result = _mmplayer_set_media_stream_max_size(player, type, max_size);
1143 MMPLAYER_CMD_UNLOCK( player );
1148 int mm_player_get_media_stream_buffer_max_size(MMHandleType player, MMPlayerStreamType type, unsigned long long *max_size)
1150 int result = MM_ERROR_NONE;
1154 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1155 return_val_if_fail(max_size, MM_ERROR_INVALID_ARGUMENT);
1157 MMPLAYER_CMD_LOCK( player );
1159 result = _mmplayer_get_media_stream_max_size(player, type, max_size);
1161 MMPLAYER_CMD_UNLOCK( player );
1166 int mm_player_set_media_stream_buffer_min_percent(MMHandleType player, MMPlayerStreamType type, unsigned min_percent)
1168 int result = MM_ERROR_NONE;
1172 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1174 MMPLAYER_CMD_LOCK( player );
1176 result = _mmplayer_set_media_stream_min_percent(player, type, min_percent);
1178 MMPLAYER_CMD_UNLOCK( player );
1183 int mm_player_get_media_stream_buffer_min_percent(MMHandleType player, MMPlayerStreamType type, unsigned int *min_percent)
1185 int result = MM_ERROR_NONE;
1189 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1190 return_val_if_fail(min_percent, MM_ERROR_INVALID_ARGUMENT);
1192 MMPLAYER_CMD_LOCK( player );
1194 result = _mmplayer_get_media_stream_min_percent(player, type, min_percent);
1196 MMPLAYER_CMD_UNLOCK( player );
1201 int mm_player_set_media_stream_buffer_status_callback(MMHandleType player, MMPlayerStreamType type, mm_player_media_stream_buffer_status_callback callback, void * user_param)
1203 int result = MM_ERROR_NONE;
1207 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1209 MMPLAYER_CMD_LOCK( player );
1211 result = _mmplayer_set_media_stream_buffer_status_cb(player, type, callback, user_param);
1213 MMPLAYER_CMD_UNLOCK( player );
1218 int mm_player_set_media_stream_seek_data_callback(MMHandleType player, MMPlayerStreamType type, mm_player_media_stream_seek_data_callback callback, void * user_param)
1220 int result = MM_ERROR_NONE;
1224 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1226 MMPLAYER_CMD_LOCK( player );
1228 result = _mmplayer_set_media_stream_seek_data_cb(player, type, callback, user_param);
1230 MMPLAYER_CMD_UNLOCK( player );
1235 int mm_player_set_audio_stream_changed_callback(MMHandleType player, mm_player_stream_changed_callback callback, void *user_param)
1237 int result = MM_ERROR_NONE;
1239 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1241 MMPLAYER_CMD_LOCK( player );
1243 result = _mmplayer_set_audiostream_changed_cb(player, callback, user_param);
1245 MMPLAYER_CMD_UNLOCK( player );
1250 int mm_player_set_video_stream_changed_callback(MMHandleType player, mm_player_stream_changed_callback callback, void *user_param)
1252 int result = MM_ERROR_NONE;
1254 return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
1256 MMPLAYER_CMD_LOCK( player );
1258 result = _mmplayer_set_videostream_changed_cb(player, callback, user_param);
1260 MMPLAYER_CMD_UNLOCK( player );