Merge branch 'master' into 2.0_beta
[apps/core/preloaded/video-player.git] / src / mp-video-player-mgr.c
1 /*
2  * To apply the Flora License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
3  *
4  *    Copyright [2012] [JongDong Lee <jongdong.lee@samsung.com>, ChangSun Lee <cs78.lee@samsung.com>]
5  *
6  *    Licensed under the Flora License, Version 1.0 (the "License");
7  *    you may not use this file except in compliance with the License.
8  *    You may obtain a copy of the License at
9  *
10  *        http://www.tizenopensource.org/license
11  *
12  *    Unless required by applicable law or agreed to in writing, software
13  *    distributed under the License is distributed on an "AS IS" BASIS,
14  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  *    See the License for the specific language governing permissions and
16  *    limitations under the License.
17  */
18
19 #include <stdio.h>
20 #include <string.h>
21 #include <stdlib.h>
22 #include <sys/stat.h>
23
24 #include "mp-video-log.h"
25 #include "mp-video-player-mgr.h"
26
27 #define MAX_PATH_LEN 2048
28
29
30 static player_h pPlayerHandle;
31
32
33 bool MpPlayerMgrIsActive(void)
34 {
35         return pPlayerHandle ? true : false;
36 }
37
38 bool MpPlayerMgrRegistePlayerCallback(void *PlayerCompletedCbFunc, void *PlayerInterruptedCbFunc, void *PlayerErrorCbFunc, void *PlayerBufferingCbFunc, void *PlayerSubtitleCbFunc, void *pUserData)
39 {
40         VideoLogInfo("");
41
42         if(!pUserData)
43         {
44                 VideoLogInfo("[ERR]");
45                 return false;
46         }
47
48         if(!MpPlayerMgrIsActive())
49         {
50                 VideoLogInfo("[ERR]");
51                 return false;
52         }
53
54         if(player_set_completed_cb(pPlayerHandle, PlayerCompletedCbFunc, pUserData) != PLAYER_ERROR_NONE)
55         {
56                 VideoLogInfo("[ERR]");
57                 return false;
58         }
59
60         if(player_set_interrupted_cb(pPlayerHandle, PlayerInterruptedCbFunc, pUserData) != PLAYER_ERROR_NONE)
61         {
62                 VideoLogInfo("[ERR]");
63                 return false;
64         }
65
66         if(player_set_error_cb(pPlayerHandle, PlayerErrorCbFunc, pUserData) != PLAYER_ERROR_NONE)
67         {
68                 VideoLogInfo("[ERR]");
69                 return false;
70         }
71
72         if(player_set_buffering_cb(pPlayerHandle, PlayerBufferingCbFunc, pUserData) != PLAYER_ERROR_NONE)
73         {
74                 VideoLogInfo("[ERR]");
75                 return false;
76         }
77
78         if(player_set_subtitle_updated_cb(pPlayerHandle, PlayerSubtitleCbFunc, pUserData) != PLAYER_ERROR_NONE)
79         {
80                 VideoLogInfo("[ERR]");
81                 return false;
82 }
83
84         return true;
85 }
86
87 bool MpPlayerMgrCreate(const char *szPath)
88 {
89         VideoLogInfo("");
90
91         if(!szPath)
92         {
93                 VideoLogInfo("[ERR] Not correct Meida URI.");
94                 return false;
95         }
96
97         int nPathLength = strlen(szPath);
98         int nErr = PLAYER_ERROR_NONE;
99
100         VideoLogInfo(" Media path (%s)", szPath);
101
102         if(nPathLength > 0 && nPathLength < MAX_PATH_LEN)
103         {
104                 nErr = player_create(&pPlayerHandle);
105                 if(nErr != PLAYER_ERROR_NONE)
106                 {
107                         VideoLogInfo("[ERR] Fail to create player handle. (MMF Error code : %x)", nErr);
108                         return false;
109                 }
110
111                 nErr = player_set_uri(pPlayerHandle, szPath);
112                 if(nErr != PLAYER_ERROR_NONE)
113                 {
114                         VideoLogInfo("[ERR] (%x) Fail to set attribute ", nErr);
115                         return false;
116                 }
117         }
118         else
119         {
120                 VideoLogInfo("[ERR] File path is too long.");
121                 return false;
122         }
123
124         nErr = player_set_sound_type(pPlayerHandle, SOUND_TYPE_MEDIA);
125         if(nErr != PLAYER_ERROR_NONE)
126         {
127                 VideoLogInfo("[ERR] (%x):: Fail to set attribute ", nErr);
128                 return false;
129         }
130
131         return true;
132 }
133
134 bool MpPlayerMgrDestroy(void)
135 {
136         VideoLogInfo("");
137
138         if(!MpPlayerMgrIsActive())
139         {
140                 VideoLogInfo("[ERR]");
141                 return false;
142         }
143
144         int nErr = player_destroy(pPlayerHandle);
145         if(nErr != PLAYER_ERROR_NONE)
146         {
147                 VideoLogInfo("[ERR] Error code : 0x%x", nErr);
148                 return false;
149         }
150         pPlayerHandle = NULL;
151
152         return true;
153 }
154
155 bool MpPlayerMgrRealize(void)
156 {
157         VideoLogInfo("");
158
159         if(!MpPlayerMgrIsActive())
160         {
161                 VideoLogInfo("[ERR]");
162                 return false;
163         }
164
165         int nErr = player_prepare(pPlayerHandle);
166         if(nErr != PLAYER_ERROR_NONE)
167         {
168                 VideoLogInfo("[ERR] Error code : 0x%x", nErr);
169                 return false;
170         }
171
172         return true;
173 }
174
175 bool MpPlayerMgrRealizeAsync(void *pPrepareCb, void *pUserData)
176 {
177         VideoLogInfo("");
178
179         if(!MpPlayerMgrIsActive())
180         {
181                 VideoLogInfo("[ERR]");
182                 return false;
183         }
184
185         int nErr = player_prepare_async(pPlayerHandle, pPrepareCb, pUserData);
186         if(nErr != PLAYER_ERROR_NONE)
187         {
188                 VideoLogInfo("[ERR] Error code : 0x%x", nErr);
189                 return false;
190         }
191
192         return true;
193 }
194
195 bool MpPlayerMgrUnrealize(void)
196 {
197         VideoLogInfo("");
198
199         if(!MpPlayerMgrIsActive())
200         {
201                 VideoLogInfo("[ERR]");
202                 return false;
203         }
204
205         int nErr = player_unprepare (pPlayerHandle);
206         if(nErr != PLAYER_ERROR_NONE)
207         {
208                 VideoLogInfo("[ERR] Error code : 0x%x", nErr);
209                 return false;
210         }
211
212         return true;
213 }
214
215 bool MpPlayerMgrPlay(void)
216 {
217         VideoLogInfo("");
218
219         if(!MpPlayerMgrIsActive())
220         {
221                 VideoLogInfo("[ERR]");
222                 return false;
223         }
224
225         int nErr = player_start(pPlayerHandle);
226         if(nErr != PLAYER_ERROR_NONE)
227         {
228                 VideoLogInfo("[ERR] Error code : 0x%x", nErr);
229                 return false;
230         }
231
232         return true;
233 }
234
235 bool MpPlayerMgrStop(void)
236 {
237         VideoLogInfo("");
238
239         if(!MpPlayerMgrIsActive())
240         {
241                 VideoLogInfo("[ERR]");
242                 return false;
243         }
244
245         int nErr = player_stop (pPlayerHandle);
246         if(nErr != PLAYER_ERROR_NONE)
247         {
248                 VideoLogInfo("[ERR] Error code : 0x%x", nErr);
249                 return false;
250         }
251
252         return true;
253 }
254
255 bool MpPlayerMgrResume(void)
256 {
257         VideoLogInfo("");
258
259         if(!MpPlayerMgrIsActive())
260         {
261                 VideoLogInfo("[ERR]");
262                 return false;
263         }
264
265         int nErr = player_start(pPlayerHandle);
266         if(nErr != PLAYER_ERROR_NONE)
267         {
268                 VideoLogInfo("[ERR] Error code : 0x%x", nErr);
269                 return false;
270         }
271
272         return true;
273 }
274
275 bool MpPlayerMgrPause(void)
276 {
277         VideoLogInfo("");
278
279         if(!MpPlayerMgrIsActive())
280         {
281                 VideoLogInfo("[ERR]");
282                 return false;
283         }
284
285         int nErr = player_pause(pPlayerHandle);
286         if(nErr != PLAYER_ERROR_NONE)
287         {
288                 VideoLogInfo("[ERR] Error code : 0x%x", nErr);
289                 return false;
290         }
291
292         return true;
293 }
294
295 int MpPlayerMgrGetPosition(void)
296 {
297         if(!MpPlayerMgrIsActive())
298         {
299                 return 0;
300         }
301
302         int nPos = 0;
303         int nErr = 0;
304
305         nErr = player_get_position(pPlayerHandle, &nPos);
306         if(nErr != PLAYER_ERROR_NONE)
307         {
308                 VideoLogInfo("[ERR] Error code : 0x%x ", nErr);
309                 return 0;
310         }
311
312         return nPos;
313 }
314
315 void MpPlayerMgrSetPosition(unsigned int nPos, void *pSeekCb, void *pUserData)
316 {
317         VideoLogInfo("");
318
319         if(!MpPlayerMgrIsActive())
320         {
321                 VideoLogInfo("[ERR]");
322                 return;
323         }
324
325         VideoLogInfo("Set position - %d", nPos);
326
327         int nErr = player_set_position(pPlayerHandle, (int)nPos, pSeekCb, pUserData);
328         if(nErr != PLAYER_ERROR_NONE)
329         {
330                 VideoLogInfo("[ERR] Error code : 0x%x ", nErr);
331         }
332 }
333
334 void MpPlayerMgrSetSubtitlePosition(unsigned int nPos)
335 {
336         VideoLogInfo("");
337
338         if(!MpPlayerMgrIsActive())
339         {
340                 VideoLogInfo("[ERR]");
341                 return;
342         }
343
344         int nErr = player_set_subtitle_position(pPlayerHandle, nPos);
345
346         if(nErr != PLAYER_ERROR_NONE)
347         {
348                 VideoLogInfo("[ERR] Error code : 0x%x ", nErr);
349         }
350 }
351
352
353 void MpPlayerMgrSetMute(bool bMuteEnable)
354 {
355         VideoLogInfo("");
356
357         if(!MpPlayerMgrIsActive())
358         {
359                 VideoLogInfo("[ERR]");
360                 return;
361         }
362
363         if(player_set_mute(pPlayerHandle, bMuteEnable) != PLAYER_ERROR_NONE)
364         {
365                 VideoLogInfo("[ERR] Fail to set mute.");
366         }
367 }
368
369 bool MpPlayerMgrGetMute(void)
370 {
371         VideoLogInfo("");
372
373         if(!MpPlayerMgrIsActive())
374         {
375                 VideoLogInfo("[ERR]");
376                 return false;
377         }
378
379         bool bIsMute = false;
380
381         if(player_is_muted(pPlayerHandle, &bIsMute) != PLAYER_ERROR_NONE)
382         {
383                 VideoLogInfo("[ERR] Fail to get mute state.");
384                 return false;
385         }
386
387         return bIsMute;
388 }
389
390 bool MpPlayerMgrSetSurroundFilters(int nSurround)
391 {
392         VideoLogInfo("");
393
394         if(!MpPlayerMgrIsActive())
395         {
396                 VideoLogInfo("[ERR]");
397                 return false;
398         }
399
400         audio_effect_preset_e ePresetValue = (audio_effect_preset_e)nSurround;
401
402         bool available = false;
403
404         player_audio_effect_preset_is_available (pPlayerHandle, ePresetValue, &available);
405
406         if(available == false)
407         {
408                 VideoLogInfo("[ERR] unavailable to set audio effect.");
409                 return false;
410         }
411
412         if(player_audio_effect_set_preset(pPlayerHandle,ePresetValue) != PLAYER_ERROR_NONE)
413         {
414                 VideoLogInfo("[ERR] Fail to set audio effect.");
415                 return false;
416         }
417
418         return true;
419 }
420
421 int MpPlayerMgrGetDuration(void)
422 {
423         VideoLogInfo("");
424
425         if(!MpPlayerMgrIsActive())
426         {
427                 VideoLogInfo("[ERR]");
428                 return 0;
429         }
430
431         int nDuration = -1;
432
433         int nErr = player_get_duration(pPlayerHandle, &nDuration);
434         if(nErr != PLAYER_ERROR_NONE)
435         {
436                 VideoLogInfo("[ERR] Error code : %x - Fail to get attribute ", nErr);
437                 return 0;
438         }
439
440         return nDuration;
441 }
442
443 bool MpPlayerMgrSetOverlayXid(void *pOverlayXid)
444 {
445         if(!MpPlayerMgrIsActive())
446         {
447                 VideoLogInfo("[ERR]");
448                 return false;
449         }
450 /*
451         if(!pOverlayXid)
452         {
453                 VideoLogInfo("[ERR]");
454                 return false;
455         }
456 */
457         VideoLogInfo("XID : %x, %d", pOverlayXid, (int)pOverlayXid);
458         int nErr = player_set_display(pPlayerHandle, PLAYER_DISPLAY_TYPE_X11, (void*)pOverlayXid);
459         if(nErr != PLAYER_ERROR_NONE)
460         {
461                 VideoLogInfo("[ERR] Error code : %x - Fail to set attribute ", nErr);
462                 return false;
463         }
464         return true;
465 }
466
467 bool MpPlayerMgrSetEvasSinkID(void *pEvasSinkID)
468 {
469         if(!MpPlayerMgrIsActive())
470         {
471                 VideoLogInfo("[ERR]");
472                 return false;
473         }
474 /*
475         if(!pEvasSinkID)
476         {
477                 VideoLogInfo("[ERR]");
478                 return false;
479         }
480 */
481         VideoLogInfo("Evas Sink ID : %x", pEvasSinkID);
482
483         int nErr = player_set_display(pPlayerHandle, PLAYER_DISPLAY_TYPE_EVAS, (void*)pEvasSinkID);
484         if(nErr != PLAYER_ERROR_NONE)
485         {
486                 VideoLogInfo("[ERR] Error code : %x - Fail to set attribute ", nErr);
487                 return false;
488         }
489
490         return true;
491 }
492
493 bool MpPlayerMgrSetSoundPriority(void)
494 {
495         VideoLogInfo("");
496
497         if(!MpPlayerMgrIsActive())
498         {
499                 VideoLogInfo("[ERR]");
500                 return false;
501         }
502
503         int nErr = player_set_sound_type(pPlayerHandle, SOUND_TYPE_MEDIA);
504         if(nErr != PLAYER_ERROR_NONE)
505         {
506                 VideoLogInfo("[ERR] Error code : %x -  Fail to set attribute ", nErr);
507                 return false;
508         }
509
510         return true;
511 }
512
513 int MpPlayerMgrSetPlaySpeed(float nSpeedValue)
514 {
515         VideoLogInfo("");
516
517         if(!MpPlayerMgrIsActive())
518         {
519                 VideoLogInfo("[ERR]");
520                 return -1;
521         }
522         int nErr = player_set_playback_rate(pPlayerHandle, nSpeedValue);
523         if(nErr != PLAYER_ERROR_NONE)
524         {
525                 VideoLogInfo("[ERR] Error code : %x - Fail to get attribute ", nErr);
526                 return -1;
527         }
528
529         return 0;
530 }
531
532 int MpPlayerMgrGetVideoWidthResolution(void)
533 {
534         VideoLogInfo("");
535
536         if(!MpPlayerMgrIsActive())
537         {
538                 VideoLogInfo("[ERR]");
539                 return 0;
540         }
541
542         int nWidth = 0;
543         int nHeight = 0;
544         int nErr = player_get_video_size(pPlayerHandle, &nWidth, &nHeight);
545         if(nErr != PLAYER_ERROR_NONE)
546         {
547                 VideoLogInfo("[ERR] Error code : %x - Fail to get attribute ", nErr);
548                 return 0;
549         }
550
551         return nWidth;
552 }
553
554 int MpPlayerMgrGetVideoHeightResolution(void)
555 {
556         VideoLogInfo("");
557
558         if(!MpPlayerMgrIsActive())
559         {
560                 VideoLogInfo("[ERR]");
561                 return 0;
562         }
563
564         int nWidth = 0;
565         int nHeight = 0;
566         int nErr = player_get_video_size(pPlayerHandle, &nWidth, &nHeight);
567         if(nErr != PLAYER_ERROR_NONE)
568         {
569                 VideoLogInfo("[ERR] Error code : %x - Fail to get attribute ", nErr);
570                 return 0;
571         }
572
573         return nHeight;
574 }
575
576 bool MpPlayerMgrSetSubtitle(char *szSubtitlePath)
577 {
578         VideoLogInfo("%s", szSubtitlePath);
579
580         if(!MpPlayerMgrIsActive())
581         {
582                 VideoLogInfo("[ERR]");
583                 return false;
584         }
585
586         if(!szSubtitlePath)
587         {
588                 VideoLogInfo("[ERR] subtitle path is null.");
589                 return false;
590         }
591
592         int nErr = player_set_subtitle_path(pPlayerHandle, szSubtitlePath);
593         if(nErr != PLAYER_ERROR_NONE)
594         {
595                 VideoLogInfo("[ERR] Error code : %x - Fail to set attribute ", nErr);
596                 return false;
597         }
598
599         return true;
600 }
601
602 bool MpPlayerMgrSetDisplayMode(MpPlayerMgrDisplayMethod nMethodMode)
603 {
604         VideoLogInfo("");
605
606         if(!MpPlayerMgrIsActive())
607         {
608                 VideoLogInfo("[ERR]");
609                 return false;
610         }
611         int nRet = player_set_display_mode (pPlayerHandle , nMethodMode);
612         if(nRet != PLAYER_ERROR_NONE)
613         {
614                 VideoLogInfo("[ERR] Error code : %x - Fail to set attribute ", nRet);
615                 return false;
616         }
617         return true;
618 }
619
620 bool MpPlayerMgrSetRotate(MpVideoRotation nRotation)
621 {
622         VideoLogInfo("");
623
624         if(!MpPlayerMgrIsActive())
625         {
626                 VideoLogInfo("[ERR]");
627                 return false;
628         }
629
630         int nRotVal = PLAYER_DISPLAY_ROTATION_NONE;
631
632         if(nRotation == VIDEO_SCREEN_PORTRAIT) {
633                 nRotVal = PLAYER_DISPLAY_ROTATION_NONE;
634         }
635         else if(nRotation == VIDEO_SCREEN_PORTRAIT_UPSIDEDOWN) {
636                 nRotVal = PLAYER_DISPLAY_ROTATION_180;
637         }
638         else if(nRotation == VIDEO_SCREEN_LANDSCAPE) {
639                 nRotVal = PLAYER_DISPLAY_ROTATION_270;
640         }
641         else if(nRotation == VIDEO_SCREEN_LANDSCAPE_UPSIDEDOWN) {
642                 nRotVal = PLAYER_DISPLAY_ROTATION_90;
643         }
644
645         int nRet = player_set_x11_display_rotation (pPlayerHandle , nRotVal);
646         if(nRet != PLAYER_ERROR_NONE)
647         {
648                 VideoLogInfo("[ERR] Error code : %x - Fail to set attribute ", nRet);
649                 return false;
650         }
651         return true;
652 }
653
654 bool MpPlayerMgrSetUseragentForStreaming(const char *szUserAgent)
655 {
656         VideoLogInfo("!!!!!! NO EXIST FUNCTION FOR SETTING USER AGENT. !!!!!!");
657
658         return true;
659 }
660
661 bool MpPlayerMgrSetProxyAddressForStreaming(const char *szProxyAddress)
662 {
663         VideoLogInfo("!!!!!! NO EXIST FUNCTION FOR SETTING PROXY ADDRESS. !!!!!!");
664         return true;
665 }
666
667 bool MpPlayerMgrSetCookieForStreaming(const char *szCookie)
668 {
669         if(!MpPlayerMgrIsActive())
670         {
671                 VideoLogInfo("[ERR]");
672                 return false;
673         }
674
675         if(!szCookie)
676         {
677                 VideoLogInfo("No exist cookie.");
678                 return false;
679         }
680
681         VideoLogInfo("");
682
683         int nRet = player_set_streaming_cookie(pPlayerHandle , szCookie, strlen(szCookie));
684         if(nRet == PLAYER_ERROR_INVALID_PARAMETER)
685         {
686                 VideoLogInfo("PLAYER_ERROR_INVALID_PARAMETER");
687                 return false;
688         }
689
690         return true;
691 }
692
693 bool MpPlayerMgrStartCapture()
694 {
695         VideoLogInfo("");
696         return true;
697 }
698
699 bool MpPlayerMgrCaptureVideo(void *pCallbackFunc, void *pUserData)
700 {
701         if(!MpPlayerMgrIsActive())
702         {
703                 VideoLogInfo("");
704                 return false;
705         }
706
707         VideoLogInfo("");
708
709         int nRet = player_capture_video(pPlayerHandle, pCallbackFunc, pUserData);
710         if(nRet == PLAYER_ERROR_INVALID_PARAMETER)
711         {
712                 VideoLogInfo("PLAYER_ERROR_INVALID_PARAMETER");
713                 return false;
714         }
715
716         if(nRet == PLAYER_ERROR_INVALID_OPERATION)
717         {
718                 VideoLogInfo("PLAYER_ERROR_INVALID_OPERATION");
719                 return false;
720         }
721
722         if(nRet == PLAYER_ERROR_INVALID_STATE)
723         {
724                 VideoLogInfo("PLAYER_ERROR_INVALID_STATE");
725                 return false;
726         }
727
728         return true;
729 }
730
731 int MpPlayerMgrGetBufferingPosition(void)
732 {
733         int nStartPos = 0;
734         int nCurrentPos = 0;
735
736         if(player_get_streaming_download_progress(pPlayerHandle,&nStartPos, &nCurrentPos) != PLAYER_ERROR_NONE)
737         {
738                 VideoLogError("");
739         return 0;
740 }
741
742         return nCurrentPos;
743 }
744
745 bool MpPlayerMgrRegisteBufferingCallBack(void *pCallbackFunc, void *pUserData)
746 {
747         if(!MpPlayerMgrIsActive())
748         {
749                 VideoLogInfo("[ERR]");
750                 return false;
751         }
752
753         // !!! CHECK player_buffering_cb !!!
754         if(player_set_buffering_cb(pPlayerHandle, pCallbackFunc, pUserData) != PLAYER_ERROR_NONE)
755         {
756                 VideoLogInfo("");
757                 return false;
758         }
759
760         return true;
761 }
762
763 int MpPlayerMgrGetFileStreamType(void)
764 {
765         VideoLogInfo("");
766
767 // jdlee
768         return FILE_STREAM_TYPE_VIDEO;
769 }
770
771 bool MpPlayerMgrSetScaling(bool bScale)
772 {
773         if(!MpPlayerMgrIsActive())
774         {
775                 VideoLogInfo("[ERR]");
776                 return false;
777         }
778
779         VideoLogInfo("");
780
781         if(player_enable_evas_display_scaling(pPlayerHandle, bScale) != PLAYER_ERROR_NONE) {
782                 VideoLogInfo("[ERR]");
783                 return false;
784         }
785         return true;
786 }
787
788 player_state_e MpPlayerMgrGetPlayerState(void)
789 {
790         int ret = 0;
791         player_state_e player_state = PLAYER_STATE_NONE;
792         ret = player_get_state(pPlayerHandle, &player_state);
793         if (ret != PLAYER_ERROR_NONE) {
794                 player_state = PLAYER_STATE_NONE;
795         }
796         return player_state;
797 }
798
799 void MpPlayerMgrSetVolume(float volume)
800 {
801         VideoLogInfo("volume = %f", volume);
802
803         if(!MpPlayerMgrIsActive())
804         {
805                 VideoLogInfo("[ERR]");
806                 return;
807         }
808
809         if(player_set_volume(pPlayerHandle, volume, volume) != PLAYER_ERROR_NONE)
810         {
811                 VideoLogInfo("[ERR] Fail to set volume.");
812         }
813 }
814
815 float MpPlayerMgrGetVolume(void)
816 {
817         VideoLogInfo("");
818
819         if(!MpPlayerMgrIsActive())
820         {
821                 VideoLogInfo("[ERR]");
822                 return 0.0;
823         }
824
825         float volume_left = 0.0;
826         float volume_right = 0.0;
827
828         if(player_get_volume(pPlayerHandle, &volume_left, &volume_right) != PLAYER_ERROR_NONE)
829         {
830                 VideoLogInfo("[ERR] Fail to get volume.");
831                 return 0.0;
832         }
833
834         return volume_left;
835 }
836
837 int MpPlayerMgrGetClosedCaptionCount(void)
838 {
839         VideoLogInfo("");
840
841         if(!MpPlayerMgrIsActive())
842         {
843                 VideoLogInfo("[ERR]");
844                 return 0;
845         }
846         int nCount = 0;
847
848         if(player_get_track_count(pPlayerHandle, PLAYER_TRACK_TYPE_TEXT, &nCount) != PLAYER_ERROR_NONE)
849         {
850                 VideoLogError("[ERR] player_get_track_count.");
851                 return 0;
852         }
853
854         VideoLogError("== %d ===========================================", nCount);
855
856         return nCount;
857 }
858