Updated to version 0.2.27
[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>, YoungHwan An <younghwan_.an@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21
22 #include <gst/gst.h>
23 #include <string.h>
24
25 #include <mm_types.h>
26 #include <mm_message.h>
27
28 #include "mm_player.h"
29 #include "mm_player_priv.h"
30 #include "mm_player_attrs.h"
31 #include "mm_player_utils.h"
32 #include "mm_player_ini.h"
33 #include "mm_debug.h"
34 #include "mm_player_capture.h"
35
36 int mm_player_create(MMHandleType *player)
37 {
38         int result = MM_ERROR_NONE;
39         mm_player_t* new_player = NULL;
40
41         debug_log("\n");
42
43         return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
44
45         if (!g_thread_supported ())
46                 g_thread_init (NULL);
47
48         MMTA_INIT();
49
50         __ta__("mm_player_ini_load",
51         result = mm_player_ini_load();
52         )
53         if(result != MM_ERROR_NONE)
54                 return result;
55
56         __ta__("mm_player_audio_effect_ini_load",
57         result = mm_player_audio_effect_ini_load();
58         )
59         if(result != MM_ERROR_NONE)
60                 return result;
61
62         /* alloc player structure */
63         new_player = g_malloc(sizeof(mm_player_t));
64         if ( ! new_player )
65         {
66                 debug_critical("Cannot allocate memory for player\n");
67                 goto ERROR;
68         }
69         memset(new_player, 0, sizeof(mm_player_t));
70
71         /* create player lock */
72         new_player->cmd_lock = g_mutex_new();
73
74         if ( ! new_player->cmd_lock )
75         {
76                 debug_critical("failed to create player lock\n");
77                 goto ERROR;
78         }
79
80         /* create msg callback lock */
81         new_player->msg_cb_lock = g_mutex_new();
82
83         if ( ! new_player->msg_cb_lock )
84         {
85                 debug_critical("failed to create msg cb lock\n");
86                 goto ERROR;
87         }
88         __ta__("[KPI] create media player service",
89         result = _mmplayer_create_player((MMHandleType)new_player);
90         )
91
92         if(result != MM_ERROR_NONE)
93                 goto ERROR;
94
95         *player = (MMHandleType)new_player;
96
97         return result;
98
99 ERROR:
100
101         if ( new_player )
102         {
103                 if (new_player->cmd_lock)
104                 {
105                         g_mutex_free(new_player->cmd_lock);
106                         new_player->cmd_lock = NULL;
107                 }
108
109                 _mmplayer_destroy( (MMHandleType)new_player );
110                 MMPLAYER_FREEIF( new_player );
111         }
112
113         *player = (MMHandleType)0;
114         return MM_ERROR_PLAYER_NO_FREE_SPACE; // are you sure?
115 }
116
117 int  mm_player_destroy(MMHandleType player)
118 {
119         int result = MM_ERROR_NONE;
120
121         debug_log("\n");
122
123         return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
124
125         MMPLAYER_CMD_LOCK( player );
126
127         __ta__("[KPI] destroy media player service",
128         result = _mmplayer_destroy(player);
129         )
130
131         MMPLAYER_CMD_UNLOCK( player );
132
133         if (((mm_player_t*)player)->cmd_lock)
134         {
135                 g_mutex_free(((mm_player_t*)player)->cmd_lock);
136                 ((mm_player_t*)player)->cmd_lock = NULL;
137         }
138
139         memset( (mm_player_t*)player, 0x00, sizeof(mm_player_t) );
140
141         /* free player */
142         g_free( (void*)player );
143
144         MMTA_ACUM_ITEM_SHOW_RESULT_TO(MMTA_SHOW_FILE);
145
146         MMTA_RELEASE();
147
148         return result;
149 }
150
151 int mm_player_realize(MMHandleType player)
152 {
153         int result = MM_ERROR_NONE;
154
155         debug_log("\n");
156
157         return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
158
159         MMPLAYER_CMD_LOCK( player );
160
161         __ta__("[KPI] initialize media player service",
162         result = _mmplayer_realize(player);
163         )
164
165         MMPLAYER_CMD_UNLOCK( player );
166
167         return result;
168 }
169
170 int mm_player_unrealize(MMHandleType player)
171 {
172         int result = MM_ERROR_NONE;
173
174         debug_log("\n");
175
176         return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
177
178         MMPLAYER_CMD_LOCK( player );
179
180         __ta__("[KPI] cleanup media player service",
181         result = _mmplayer_unrealize(player);
182         )
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         debug_log("\n");
194
195         return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
196
197         MMPLAYER_CMD_LOCK( player );
198
199         result = _mmplayer_set_message_callback(player, callback, user_param);
200
201         MMPLAYER_CMD_UNLOCK( player );
202
203         return result;
204 }
205
206 int mm_player_set_pd_message_callback(MMHandleType player, MMMessageCallback callback, void *user_param)
207 {
208         int result = MM_ERROR_NONE;
209
210         debug_log("\n");
211
212         return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
213
214         result = _mm_player_set_pd_downloader_message_cb(player, callback, user_param);
215
216         return result;
217 }
218
219 int mm_player_set_audio_stream_callback(MMHandleType player, mm_player_audio_stream_callback callback, void *user_param)
220 {
221         int result = MM_ERROR_NONE;
222
223         debug_log("\n");
224
225         return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
226
227         MMPLAYER_CMD_LOCK( player );
228
229         result = _mmplayer_set_audiostream_cb(player, callback, user_param);
230
231         MMPLAYER_CMD_UNLOCK( player );
232
233         return result;
234 }
235
236 int mm_player_set_audio_buffer_callback(MMHandleType player, mm_player_audio_stream_callback callback, void *user_param)
237 {
238         int result = MM_ERROR_NONE;
239
240         debug_log("\n");
241
242         return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
243
244         MMPLAYER_CMD_LOCK( player );
245
246         result = _mmplayer_set_audiobuffer_cb(player, callback, user_param);
247
248         MMPLAYER_CMD_UNLOCK( player );
249
250         return result;
251 }
252
253 int mm_player_set_video_stream_callback(MMHandleType player, mm_player_video_stream_callback callback, void *user_param)
254 {
255         int result = MM_ERROR_NONE;
256
257         debug_log("\n");
258
259         return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
260
261         MMPLAYER_CMD_LOCK( player );
262
263         result = _mmplayer_set_videostream_cb(player, callback, user_param);
264
265         MMPLAYER_CMD_UNLOCK( player );
266
267         return result;
268 }
269
270 int mm_player_set_video_frame_render_error_callback(MMHandleType player, mm_player_video_frame_render_error_callback callback, void *user_param)
271 {
272         int result = MM_ERROR_NONE;
273
274         debug_log("\n");
275
276         return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
277
278         MMPLAYER_CMD_LOCK( player );
279
280         result = _mmplayer_set_videoframe_render_error_cb(player, callback, user_param);
281
282         MMPLAYER_CMD_UNLOCK( player );
283
284         return result;
285 }
286
287 int mm_player_do_video_capture(MMHandleType player)
288 {
289         int result = MM_ERROR_NONE;
290
291         debug_log("\n");
292
293         return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
294
295         MMPLAYER_CMD_LOCK( player );
296
297         result = _mmplayer_do_video_capture(player);
298
299         MMPLAYER_CMD_UNLOCK( player );
300
301         return result;
302 }
303
304 int mm_player_set_buffer_need_data_callback(MMHandleType player, mm_player_buffer_need_data_callback callback, void * user_param)
305 {
306         int result = MM_ERROR_NONE;
307
308         debug_log("\n");
309
310         return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
311
312         MMPLAYER_CMD_LOCK( player );
313
314         result = _mmplayer_set_buffer_need_data_cb(player, callback, user_param);
315
316         MMPLAYER_CMD_UNLOCK( player );
317
318         return result;
319 }
320
321 int mm_player_set_buffer_enough_data_callback(MMHandleType player, mm_player_buffer_enough_data_callback callback, void * user_param)
322 {
323         int result = MM_ERROR_NONE;
324
325         debug_log("\n");
326
327         return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
328
329         MMPLAYER_CMD_LOCK( player );
330
331         result = _mmplayer_set_buffer_enough_data_cb(player, callback, user_param);
332
333         MMPLAYER_CMD_UNLOCK( player );
334
335         return result;
336 }
337
338
339 int mm_player_set_buffer_seek_data_callback(MMHandleType player, mm_player_buffer_seek_data_callback callback, void * user_param)
340 {
341         int result = MM_ERROR_NONE;
342
343         debug_log("\n");
344
345         return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
346
347         MMPLAYER_CMD_LOCK( player );
348
349         result = _mmplayer_set_buffer_seek_data_cb(player, callback, user_param);
350
351         MMPLAYER_CMD_UNLOCK( player );
352
353         return result;
354 }
355
356 int mm_player_set_volume(MMHandleType player, MMPlayerVolumeType *volume)
357 {
358         int result = MM_ERROR_NONE;
359
360         debug_log("\n");
361
362         return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
363         return_val_if_fail(volume, MM_ERROR_INVALID_ARGUMENT);
364
365         MMPLAYER_CMD_LOCK( player );
366
367         result = _mmplayer_set_volume(player, *volume);
368
369         MMPLAYER_CMD_UNLOCK( player );
370
371         return result;
372 }
373
374 int mm_player_get_volume(MMHandleType player, MMPlayerVolumeType *volume)
375 {
376         int result = MM_ERROR_NONE;
377
378         debug_log("\n");
379
380         return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
381         return_val_if_fail(volume, MM_ERROR_INVALID_ARGUMENT);
382
383         MMPLAYER_CMD_LOCK( player );
384
385         result = _mmplayer_get_volume(player, volume);
386
387         MMPLAYER_CMD_UNLOCK( player );
388
389         return result;
390 }
391
392 int mm_player_set_mute(MMHandleType player, int mute)
393 {
394         int result = MM_ERROR_NONE;
395
396         debug_log("\n");
397
398         return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
399
400         MMPLAYER_CMD_LOCK( player );
401
402         result = _mmplayer_set_mute(player, mute);
403
404         MMPLAYER_CMD_UNLOCK( player );
405
406         return result;
407 }
408
409 int mm_player_get_mute(MMHandleType player, int *mute)
410 {
411         int result = MM_ERROR_NONE;
412
413         debug_log("\n");
414
415         return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
416         return_val_if_fail(mute, MM_ERROR_INVALID_ARGUMENT);
417
418         MMPLAYER_CMD_LOCK( player );
419
420         result = _mmplayer_get_mute(player, mute);
421
422         MMPLAYER_CMD_UNLOCK( player );
423
424         return result;
425 }
426
427 int mm_player_get_state(MMHandleType player, MMPlayerStateType *state)
428 {
429         int result = MM_ERROR_NONE;
430
431         debug_log("\n");
432
433         return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
434         return_val_if_fail(state, MM_ERROR_COMMON_INVALID_ARGUMENT);
435
436         *state = MM_PLAYER_STATE_NULL;
437
438         result = _mmplayer_get_state(player, (int*)state);
439
440         return result;
441 }
442
443 /* NOTE : Not supported */
444 int mm_player_change_videosink(MMHandleType player, MMDisplaySurfaceType display_surface_type, void *display_overlay)
445 {
446         debug_log("\n");
447
448         return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
449
450         return MM_ERROR_NOT_SUPPORT_API;
451 }
452
453 int mm_player_push_buffer(MMHandleType player, unsigned char *buf, int size)
454 {
455         int result = MM_ERROR_NONE;
456
457         debug_log("\n");
458
459         return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
460
461         //MMPLAYER_CMD_LOCK( player );
462
463         //MMTA_ACUM_ITEM_BEGIN("[KPI] start media player service", false);
464         result = _mmplayer_push_buffer(player, buf, size);
465
466         //MMPLAYER_CMD_UNLOCK( player );
467
468         return result;
469 }
470
471 int mm_player_start(MMHandleType player)
472 {
473         int result = MM_ERROR_NONE;
474
475         debug_log("\n");
476
477         return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
478
479         MMPLAYER_CMD_LOCK( player );
480
481         MMTA_ACUM_ITEM_BEGIN("[KPI] start media player service", false);
482         result = _mmplayer_start(player);
483
484         MMPLAYER_CMD_UNLOCK( player );
485
486         return result;
487 }
488
489 int  mm_player_stop(MMHandleType player)
490 {
491         int result = MM_ERROR_NONE;
492
493         debug_log("\n");
494
495         return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
496
497         MMPLAYER_CMD_LOCK( player );
498
499         __ta__("[KPI] stop media player service",
500         result = _mmplayer_stop(player);
501         )
502
503         MMPLAYER_CMD_UNLOCK( player );
504
505         return result;
506 }
507
508 int mm_player_pause(MMHandleType player)
509 {
510         int result = MM_ERROR_NONE;
511
512         debug_log("\n");
513
514         return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
515
516         MMPLAYER_CMD_LOCK( player );
517
518         __ta__("[KPI] pause media player service",
519         result = _mmplayer_pause(player);
520         )
521
522         MMPLAYER_CMD_UNLOCK( player );
523
524         return result;
525 }
526
527 int mm_player_resume(MMHandleType player)
528 {
529         int result = MM_ERROR_NONE;
530
531         debug_log("\n");
532
533         return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
534
535         MMPLAYER_CMD_LOCK( player );
536
537         __ta__("[KPI] resume media player service",
538         result = _mmplayer_resume(player);
539         )
540
541         MMPLAYER_CMD_UNLOCK( player );
542
543         return result;
544 }
545
546 int mm_player_activate_section_repeat(MMHandleType player, int start_pos, int end_pos)
547 {
548         int result = MM_ERROR_NONE;
549
550         return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
551
552         MMPLAYER_CMD_LOCK( player );
553
554         result = _mmplayer_activate_section_repeat(player, start_pos, end_pos);
555
556         MMPLAYER_CMD_UNLOCK( player );
557
558         return result;
559 }
560
561 int mm_player_deactivate_section_repeat(MMHandleType player)
562 {
563         int result = MM_ERROR_NONE;
564
565         return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
566
567         MMPLAYER_CMD_LOCK( player );
568
569         result = _mmplayer_deactivate_section_repeat(player);
570
571         MMPLAYER_CMD_UNLOCK( player );
572
573         return result;
574 }
575
576 int mm_player_set_play_speed(MMHandleType player, float rate)
577 {
578         int result = MM_ERROR_NONE;
579
580         return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
581
582         MMPLAYER_CMD_LOCK( player );
583
584         result = _mmplayer_set_playspeed(player, rate);
585
586         MMPLAYER_CMD_UNLOCK( player );
587
588         return result;
589 }
590
591 int mm_player_set_position(MMHandleType player, MMPlayerPosFormatType format, int pos)
592 {
593         int result = MM_ERROR_NONE;
594
595         debug_log("\n");
596
597         return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
598
599         if (format >= MM_PLAYER_POS_FORMAT_NUM)
600         {
601                 debug_error("wrong format\n");
602                 return MM_ERROR_COMMON_INVALID_ARGUMENT;
603         }
604
605         MMPLAYER_CMD_LOCK( player );
606
607         result = _mmplayer_set_position(player, format, pos);
608
609         MMPLAYER_CMD_UNLOCK( player );
610
611         return result;
612 }
613
614 int mm_player_get_position(MMHandleType player, MMPlayerPosFormatType format, int *pos)
615 {
616         int result = MM_ERROR_NONE;
617
618         debug_log("\n");
619
620         return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
621         return_val_if_fail(pos, MM_ERROR_COMMON_INVALID_ARGUMENT);
622
623         if (format >= MM_PLAYER_POS_FORMAT_NUM)
624         {
625                 debug_error("wrong format\n");
626                 return MM_ERROR_COMMON_INVALID_ARGUMENT;
627         }
628
629         MMPLAYER_CMD_LOCK( player );
630
631         result = _mmplayer_get_position(player, (int)format, (unsigned long*)pos);
632
633         MMPLAYER_CMD_UNLOCK( player );
634
635         return result;
636 }
637
638 int mm_player_get_buffer_position(MMHandleType player, MMPlayerPosFormatType format, int  *start_pos, int  *stop_pos)
639 {
640         int result = MM_ERROR_NONE;
641
642         debug_log("\n");
643
644         return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
645         return_val_if_fail(start_pos && stop_pos, MM_ERROR_COMMON_INVALID_ARGUMENT);
646
647         MMPLAYER_CMD_LOCK( player );
648
649         result = _mmplayer_get_buffer_position(player, (int)format, (unsigned long*)start_pos, (unsigned long*)stop_pos );
650
651         MMPLAYER_CMD_UNLOCK( player );
652
653         return result;
654 }
655
656 int mm_player_adjust_subtitle_position(MMHandleType player, MMPlayerPosFormatType format, int pos)
657 {
658         int result = MM_ERROR_NONE;
659
660         debug_log("\n");
661
662         return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
663
664         if (format >= MM_PLAYER_POS_FORMAT_NUM)
665         {
666                 debug_error("wrong format\n");
667                 return MM_ERROR_COMMON_INVALID_ARGUMENT;
668         }
669
670         MMPLAYER_CMD_LOCK( player );
671
672         result = _mmplayer_adjust_subtitle_postion(player, format, pos);
673
674         MMPLAYER_CMD_UNLOCK( player );
675
676         return result;
677 }
678
679 int mm_player_set_subtitle_silent(MMHandleType player, int silent)
680 {
681         int result = MM_ERROR_NONE;
682
683         debug_log("\n");
684
685         return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
686
687         MMPLAYER_CMD_LOCK( player );
688
689         result = _mmplayer_set_subtitle_silent(player, silent);
690
691         MMPLAYER_CMD_UNLOCK( player );
692
693         return result;
694 }
695
696 int mm_player_get_subtitle_silent(MMHandleType player, int* silent)
697 {
698         int result = MM_ERROR_NONE;
699
700         debug_log("\n");
701
702         return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
703
704         MMPLAYER_CMD_LOCK( player );
705
706         result = _mmplayer_get_subtitle_silent(player, silent);
707
708         MMPLAYER_CMD_UNLOCK( player );
709
710         return result;
711 }
712
713 int mm_player_set_attribute(MMHandleType player,  char **err_attr_name, const char *first_attribute_name, ...)
714 {
715         int result = MM_ERROR_NONE;
716         va_list var_args;
717
718         debug_log("\n");
719
720         return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
721         return_val_if_fail(first_attribute_name, MM_ERROR_COMMON_INVALID_ARGUMENT);
722
723         va_start (var_args, first_attribute_name);
724         result = _mmplayer_set_attribute(player, err_attr_name, first_attribute_name, var_args);
725         va_end (var_args);
726
727         return result;
728 }
729
730 int mm_player_get_attribute(MMHandleType player,  char **err_attr_name, const char *first_attribute_name, ...)
731 {
732         int result = MM_ERROR_NONE;
733         va_list var_args;
734
735         debug_log("\n");
736
737         return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
738         return_val_if_fail(first_attribute_name, MM_ERROR_COMMON_INVALID_ARGUMENT);
739
740         va_start (var_args, first_attribute_name);
741         result = _mmplayer_get_attribute(player, err_attr_name, first_attribute_name, var_args);
742         va_end (var_args);
743
744         return result;
745 }
746
747 int mm_player_get_attribute_info(MMHandleType player,  const char *attribute_name, MMPlayerAttrsInfo *info)
748 {
749         int result = MM_ERROR_NONE;
750         debug_log("\n");
751
752         return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
753         return_val_if_fail(attribute_name, MM_ERROR_COMMON_INVALID_ARGUMENT);
754         return_val_if_fail(info, MM_ERROR_COMMON_INVALID_ARGUMENT);
755
756         result = _mmplayer_get_attributes_info((MMHandleType)player, attribute_name, info);
757
758         return result;
759 }
760
761 int mm_player_get_pd_status(MMHandleType player, guint64 *current_pos, guint64 *total_size)
762 {
763         int result = MM_ERROR_NONE;
764
765         debug_log("\n");
766
767         return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
768         return_val_if_fail(current_pos, MM_ERROR_COMMON_INVALID_ARGUMENT);
769         return_val_if_fail(total_size, MM_ERROR_COMMON_INVALID_ARGUMENT);
770
771         result = _mmplayer_get_pd_downloader_status(player, current_pos, total_size);
772
773         return result;
774 }
775
776 int mm_player_get_track_count(MMHandleType player, MMPlayerTrackType track_type, int *count)
777 {
778         int result = MM_ERROR_NONE;
779
780         debug_log("\n");
781
782         return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
783         return_val_if_fail(count, MM_ERROR_COMMON_INVALID_ARGUMENT);
784
785         result = _mmplayer_get_track_count(player, track_type, count);
786
787         return result;
788
789 }
790
791 int mm_player_ignore_session(MMHandleType player)
792 {
793         int result = MM_ERROR_NONE;
794
795         debug_log("\n");
796
797         return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
798
799         result = _mmplayer_asm_ignore_session(player);
800
801         return result;
802 }
803
804 int mm_player_set_display_zoom(MMHandleType player, float level)
805 {
806         int result = MM_ERROR_NONE;
807         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);
812
813         MMPLAYER_CMD_UNLOCK( player );
814
815         return result;
816 }
817
818 int mm_player_get_display_zoom(MMHandleType player, float *level)
819 {
820         int result = MM_ERROR_NONE;
821
822         return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
823         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);
828
829         MMPLAYER_CMD_UNLOCK( player );
830
831         return result;
832 }
833
834 int mm_player_set_display_zoom_start_position(MMHandleType player, int x, int y)
835 {
836         int result = MM_ERROR_NONE;
837
838         return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
839
840         MMPLAYER_CMD_LOCK( player );
841
842         result = _mmplayer_set_display_zoom_start_pos(player, x, y);
843
844         MMPLAYER_CMD_UNLOCK( player );
845
846         return result;
847 }
848
849 int mm_player_get_display_zoom_start_position(MMHandleType player, int *x, int *y)
850 {
851         int result = MM_ERROR_NONE;
852
853         return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
854
855         MMPLAYER_CMD_LOCK( player );
856
857         result = _mmplayer_get_display_zoom_start_pos(player, x, y);
858
859         MMPLAYER_CMD_UNLOCK( player );
860
861         return result;
862 }