/*
- * Copyright 2012 Samsung Electronics Co., Ltd
+ * Copyright (c) [2012] Samsung Electronics Co., Ltd.
*
- * Licensed under the Flora License, Version 1.0 (the "License");
+ * Licensed under the Flora License, Version 1.1 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
- * http://www.tizenopensource.org/license
- *
+ *
+ * http://floralicense.org/license/
+ *
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
+ * distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#include <mm.h>
-#include <mm_error.h>
-#include <mm_sound.h>
-
+#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/stat.h>
#define MAX_PATH_LEN 2048
-static int nAntiShock = 0;
-static MMHandleType playerHandle = 0;
+
+static player_h pPlayerHandle;
+
bool MpPlayerMgrIsActive(void)
{
- return playerHandle ? true : false;
+ return pPlayerHandle ? true : false;
}
-void MpPlayerMgrSetMessageCallback(MMMessageCallback Callback, void *pUserData)
+bool MpPlayerMgrRegistePlayerCallback(void *PlayerCompletedCbFunc, void *PlayerInterruptedCbFunc, void *PlayerErrorCbFunc, void *PlayerBufferingCbFunc, void *PlayerSubtitleCbFunc, void *pUserData)
{
VideoLogInfo("");
- if (!pUserData) {
+ if(!pUserData)
+ {
VideoLogInfo("[ERR]");
- return;
+ return false;
}
- if (!MpPlayerMgrIsActive()) {
+ if(!MpPlayerMgrIsActive())
+ {
VideoLogInfo("[ERR]");
- return;
+ return false;
}
- if (mm_player_set_message_callback(playerHandle, Callback, pUserData) !=
- MM_ERROR_NONE) {
+ if(player_set_completed_cb(pPlayerHandle, PlayerCompletedCbFunc, pUserData) != PLAYER_ERROR_NONE)
+ {
VideoLogInfo("[ERR]");
- return;
+ return false;
}
-}
-
-bool MpPlayerMgrSetAudioCallback(mm_player_audio_stream_callback CallBack,
- void *pUserData)
-{
- VideoLogInfo("");
- if (!pUserData) {
+ if(player_set_interrupted_cb(pPlayerHandle, PlayerInterruptedCbFunc, pUserData) != PLAYER_ERROR_NONE)
+ {
VideoLogInfo("[ERR]");
return false;
}
- if (!MpPlayerMgrIsActive()) {
+ if(player_set_error_cb(pPlayerHandle, PlayerErrorCbFunc, pUserData) != PLAYER_ERROR_NONE)
+ {
VideoLogInfo("[ERR]");
return false;
}
- if (mm_player_set_audio_stream_callback
- (playerHandle, CallBack, pUserData) != MM_ERROR_NONE) {
+ if(player_set_buffering_cb(pPlayerHandle, PlayerBufferingCbFunc, pUserData) != PLAYER_ERROR_NONE)
+ {
VideoLogInfo("[ERR]");
return false;
}
+ if(player_set_subtitle_updated_cb(pPlayerHandle, PlayerSubtitleCbFunc, pUserData) != PLAYER_ERROR_NONE)
+ {
+ VideoLogInfo("[ERR]");
+ return false;
+}
+
return true;
}
{
VideoLogInfo("");
- if (!szPath) {
+ if(!szPath)
+ {
VideoLogInfo("[ERR] Not correct Meida URI.");
return false;
}
int nPathLength = strlen(szPath);
- int nErr = MM_ERROR_NONE;
- char *pErrName = NULL;
+ int nErr = PLAYER_ERROR_NONE;
VideoLogInfo(" Media path (%s)", szPath);
- if (nPathLength > 0 && nPathLength < MAX_PATH_LEN) {
- nErr = mm_player_create(&playerHandle);
- if (nErr != MM_ERROR_NONE) {
- VideoLogInfo
- ("[ERR] Fail to create player handle. (MMF Error code : %x)",
- nErr);
+ if(nPathLength > 0 && nPathLength < MAX_PATH_LEN)
+ {
+ nErr = player_create(&pPlayerHandle);
+ if(nErr != PLAYER_ERROR_NONE)
+ {
+ VideoLogInfo("[ERR] Fail to create player handle. (MMF Error code : %x)", nErr);
return false;
}
- nErr =
- mm_player_set_attribute(playerHandle, &pErrName,
- "profile_uri", szPath,
- strlen(szPath), NULL);
-
- if (nErr != MM_ERROR_NONE) {
- VideoLogInfo("[ERR] (%x):: Fail to set attribute ",
- nErr, pErrName);
- free(pErrName);
+ nErr = player_set_uri(pPlayerHandle, szPath);
+ if(nErr != PLAYER_ERROR_NONE)
+ {
+ VideoLogInfo("[ERR] (%x) Fail to set attribute ", nErr);
return false;
}
-
- } else {
+ }
+ else
+ {
VideoLogInfo("[ERR] File path is too long.");
return false;
}
- if (nAntiShock) {
- nErr = mm_player_set_attribute(playerHandle, &pErrName,
- "sound_fadeup", 1, NULL);
- if (nErr != MM_ERROR_NONE) {
- VideoLogInfo("[ERR] (%x):: Fail to set attribute ",
- nErr, pErrName);
- free(pErrName);
- return false;
- }
- nAntiShock = 0;
- } else {
- nErr = mm_player_set_attribute(playerHandle, &pErrName,
- "sound_fadeup", 0, NULL);
- if (nErr != MM_ERROR_NONE) {
- VideoLogInfo("[ERR] (%x):: Fail to set attribute ",
- nErr, pErrName);
- free(pErrName);
- return false;
- }
- nAntiShock = 1;
- }
-
- nErr = mm_player_set_attribute(playerHandle, &pErrName,
- "sound_volume_type",
- MM_SOUND_VOLUME_TYPE_MEDIA, NULL);
- if (nErr != MM_ERROR_NONE) {
- VideoLogInfo("[ERR] (%x):: Fail to set attribute ", nErr,
- pErrName);
- free(pErrName);
+ nErr = player_set_sound_type(pPlayerHandle, SOUND_TYPE_MEDIA);
+ if(nErr != PLAYER_ERROR_NONE)
+ {
+ VideoLogInfo("[ERR] (%x):: Fail to set attribute ", nErr);
return false;
}
{
VideoLogInfo("");
- if (!MpPlayerMgrIsActive()) {
+ if(!MpPlayerMgrIsActive())
+ {
VideoLogInfo("[ERR]");
return false;
}
- int nErr = mm_player_destroy(playerHandle);
- if (nErr != MM_ERROR_NONE) {
+ int nErr = player_destroy(pPlayerHandle);
+ if(nErr != PLAYER_ERROR_NONE)
+ {
VideoLogInfo("[ERR] Error code : 0x%x", nErr);
return false;
}
-
- playerHandle = 0;
+ pPlayerHandle = NULL;
return true;
}
{
VideoLogInfo("");
- if (!MpPlayerMgrIsActive()) {
+ if(!MpPlayerMgrIsActive())
+ {
VideoLogInfo("[ERR]");
return false;
}
- int nErr = mm_player_realize(playerHandle);
- if (nErr != MM_ERROR_NONE) {
+ int nErr = player_prepare(pPlayerHandle);
+ if(nErr != PLAYER_ERROR_NONE)
+ {
VideoLogInfo("[ERR] Error code : 0x%x", nErr);
return false;
}
return true;
}
-bool MpPlayerMgrUnrealize(void)
+bool MpPlayerMgrRealizeAsync(void *pPrepareCb, void *pUserData)
{
VideoLogInfo("");
- if (!MpPlayerMgrIsActive()) {
+ if(!MpPlayerMgrIsActive())
+ {
VideoLogInfo("[ERR]");
return false;
}
- int nErr = mm_player_unrealize(playerHandle);
- if (nErr != MM_ERROR_NONE) {
+ int nErr = player_prepare_async(pPlayerHandle, pPrepareCb, pUserData);
+ if(nErr != PLAYER_ERROR_NONE)
+ {
VideoLogInfo("[ERR] Error code : 0x%x", nErr);
return false;
}
return true;
}
-bool MpPlayerMgrPlay(void)
+bool MpPlayerMgrUnrealize(void)
{
VideoLogInfo("");
- if (!MpPlayerMgrIsActive()) {
+ if(!MpPlayerMgrIsActive())
+ {
VideoLogInfo("[ERR]");
return false;
}
- int nErr = mm_player_start(playerHandle);
- if (nErr != MM_ERROR_NONE) {
+ int nErr = player_unprepare (pPlayerHandle);
+ if(nErr != PLAYER_ERROR_NONE)
+ {
VideoLogInfo("[ERR] Error code : 0x%x", nErr);
return false;
}
return true;
}
-bool MpPlayerMgrStop(void)
+bool MpPlayerMgrPlay(void)
{
VideoLogInfo("");
- if (!MpPlayerMgrIsActive()) {
+ if(!MpPlayerMgrIsActive())
+ {
VideoLogInfo("[ERR]");
return false;
}
- int nErr = mm_player_stop(playerHandle);
- if (nErr != MM_ERROR_NONE) {
+ int nErr = player_start(pPlayerHandle);
+ if(nErr != PLAYER_ERROR_NONE)
+ {
VideoLogInfo("[ERR] Error code : 0x%x", nErr);
return false;
}
return true;
}
-bool MpPlayerMgrResume(void)
+bool MpPlayerMgrStop(void)
{
VideoLogInfo("");
- if (!MpPlayerMgrIsActive()) {
+ if(!MpPlayerMgrIsActive())
+ {
VideoLogInfo("[ERR]");
return false;
}
- char *pErrName = NULL;
- int nErr = MM_ERROR_NONE;
+ int nErr = player_stop (pPlayerHandle);
+ if(nErr != PLAYER_ERROR_NONE)
+ {
+ VideoLogInfo("[ERR] Error code : 0x%x", nErr);
+ return false;
+ }
- if (nAntiShock) {
- nErr = mm_player_set_attribute(playerHandle, &pErrName,
- "sound_fadeup", 1, NULL);
- if (nErr != MM_ERROR_NONE) {
- VideoLogInfo
- ("[ERR] Error code : 0x%x - Fail to set attribute ",
- nErr, pErrName);
- free(pErrName);
- return false;
- }
+ return true;
+}
- nAntiShock = 0;
- } else {
- nErr = mm_player_set_attribute(playerHandle, &pErrName,
- "sound_fadeup", 0, NULL);
- if (nErr != MM_ERROR_NONE) {
- VideoLogInfo
- ("[ERR] Error code : 0x%x - Fail to set attribute ",
- nErr, pErrName);
- free(pErrName);
- return false;
- }
+bool MpPlayerMgrResume(void)
+{
+ VideoLogInfo("");
- nAntiShock = 0;
+ if(!MpPlayerMgrIsActive())
+ {
+ VideoLogInfo("[ERR]");
+ return false;
}
- nErr = mm_player_resume(playerHandle);
- if (nErr != MM_ERROR_NONE) {
+ int nErr = player_start(pPlayerHandle);
+ if(nErr != PLAYER_ERROR_NONE)
+ {
VideoLogInfo("[ERR] Error code : 0x%x", nErr);
return false;
}
{
VideoLogInfo("");
- if (!MpPlayerMgrIsActive()) {
+ if(!MpPlayerMgrIsActive())
+ {
VideoLogInfo("[ERR]");
return false;
}
- int nErr = mm_player_pause(playerHandle);
- if (nErr != MM_ERROR_NONE) {
+ int nErr = player_pause(pPlayerHandle);
+ if(nErr != PLAYER_ERROR_NONE)
+ {
VideoLogInfo("[ERR] Error code : 0x%x", nErr);
return false;
}
int MpPlayerMgrGetPosition(void)
{
- if (!MpPlayerMgrIsActive()) {
+ if(!MpPlayerMgrIsActive())
+ {
return 0;
}
int nPos = 0;
int nErr = 0;
- nErr = mm_player_get_position(playerHandle, MM_PLAYER_POS_FORMAT_TIME,
- &nPos);
- if (nErr != MM_ERROR_NONE) {
+ nErr = player_get_position(pPlayerHandle, &nPos);
+ if(nErr != PLAYER_ERROR_NONE)
+ {
VideoLogInfo("[ERR] Error code : 0x%x ", nErr);
return 0;
}
return nPos;
}
-void MpPlayerMgrSetPosition(unsigned int nPos)
+void MpPlayerMgrSetPosition(unsigned int nPos, void *pSeekCb, void *pUserData)
{
VideoLogInfo("");
- if (!MpPlayerMgrIsActive()) {
+ if(!MpPlayerMgrIsActive())
+ {
VideoLogInfo("[ERR]");
return;
}
VideoLogInfo("Set position - %d", nPos);
- int nErr = 0;
-
- nErr = mm_player_set_position(playerHandle, MM_PLAYER_POS_FORMAT_TIME,
- (int)nPos);
- if (nErr != MM_ERROR_NONE) {
+ int nErr = player_set_position(pPlayerHandle, (int)nPos, pSeekCb, pUserData);
+ if(nErr != PLAYER_ERROR_NONE)
+ {
VideoLogInfo("[ERR] Error code : 0x%x ", nErr);
}
}
-bool MpPlayerMgrGetVisible(void)
+void MpPlayerMgrSetSubtitlePosition(unsigned int nPos)
{
VideoLogInfo("");
- if (!MpPlayerMgrIsActive()) {
- VideoLogInfo("[ERR]");
- return false;
- }
-
- int nErr = MM_ERROR_NONE;
- int nVisible = 0;
- char *pErrName = NULL;
-
- nErr =
- mm_player_get_attribute(playerHandle, &pErrName, "display_visible",
- &nVisible, NULL);
- if (nErr != MM_ERROR_NONE) {
- VideoLogInfo("[ERR] Error code : 0x%x - Fail to get attribute.",
- nErr, pErrName);
- free(pErrName);
- return false;
- }
-
- return (bool) nVisible;
-}
-
-void MpPlayerMgrSetVisible(bool bEnabled)
-{
- VideoLogInfo("");
-
- if (!MpPlayerMgrIsActive()) {
+ if(!MpPlayerMgrIsActive())
+ {
VideoLogInfo("[ERR]");
return;
}
- if (MpPlayerMgrGetVisible() == bEnabled) {
- VideoLogInfo("[ERR]");
- return;
- }
+ int nErr = player_set_subtitle_position(pPlayerHandle, nPos);
- int nErr = MM_ERROR_NONE;
- char *pErrName = NULL;
-
- nErr =
- mm_player_set_attribute(playerHandle, &pErrName, "display_visible",
- (int)bEnabled, NULL);
- if (nErr != MM_ERROR_NONE) {
- VideoLogInfo("[ERR] Error code : 0x%x - Fail to set attribute ",
- nErr, pErrName);
- free(pErrName);
+ if(nErr != PLAYER_ERROR_NONE)
+ {
+ VideoLogInfo("[ERR] Error code : 0x%x ", nErr);
}
}
+
void MpPlayerMgrSetMute(bool bMuteEnable)
{
VideoLogInfo("");
- if (!MpPlayerMgrIsActive()) {
+ if(!MpPlayerMgrIsActive())
+ {
VideoLogInfo("[ERR]");
return;
}
- if (mm_player_set_mute(playerHandle, (int)bMuteEnable) != MM_ERROR_NONE) {
- VideoLogInfo("[ERR]");
+ if(player_set_mute(pPlayerHandle, bMuteEnable) != PLAYER_ERROR_NONE)
+ {
+ VideoLogInfo("[ERR] Fail to set mute.");
}
}
{
VideoLogInfo("");
- if (!MpPlayerMgrIsActive()) {
+ if(!MpPlayerMgrIsActive())
+ {
VideoLogInfo("[ERR]");
- return FALSE;
+ return false;
}
- bool bIsMute = FALSE;
+ bool bIsMute = false;
- if (mm_player_get_mute(playerHandle, (int *)&bIsMute) != MM_ERROR_NONE) {
- VideoLogInfo("[ERR]");
- return FALSE;
+ if(player_is_muted(pPlayerHandle, &bIsMute) != PLAYER_ERROR_NONE)
+ {
+ VideoLogInfo("[ERR] Fail to get mute state.");
+ return false;
}
return bIsMute;
}
-bool MpPlayerMgrSetBtHeadset(bool bEnable, char *szAddress)
+bool MpPlayerMgrSetSurroundFilters(int nSurround)
{
VideoLogInfo("");
- VideoLogInfo("bt headset enable(%d)", bEnable);
- VideoLogInfo("============================================");
- VideoLogInfo("bluetooth headset enable(%d), addr(%s)", bEnable,
- szAddress);
- VideoLogInfo("============================================");
-
- if (!MpPlayerMgrIsActive()) {
+ if(!MpPlayerMgrIsActive())
+ {
VideoLogInfo("[ERR]");
return false;
}
- MMBluetoothType BluetoothParam;
- memset(&BluetoothParam, 0, sizeof(MMBluetoothType));
+ audio_effect_preset_e ePresetValue = (audio_effect_preset_e)nSurround;
- if (bEnable) {
- BluetoothParam.mode = 1;
+ bool available = false;
- if (szAddress) {
- strncpy(BluetoothParam.addr, szAddress,
- BT_ADDR_LEN - 1);
- } else {
- VideoLogInfo("[ERR]");
- return false;
- }
+ player_audio_effect_preset_is_available (pPlayerHandle, ePresetValue, &available);
+
+ if(available == false)
+ {
+ VideoLogInfo("[ERR] unavailable to set audio effect.");
+ return false;
+ }
- VideoLogInfo("address : %s", szAddress);
+ if(player_audio_effect_set_preset(pPlayerHandle,ePresetValue) != PLAYER_ERROR_NONE)
+ {
+ VideoLogInfo("[ERR] Fail to set audio effect.");
+ return false;
}
return true;
}
-int MpPlayerMgrGetStreamingType(void)
+int MpPlayerMgrGetDuration(void)
{
VideoLogInfo("");
- if (!MpPlayerMgrIsActive()) {
+ if(!MpPlayerMgrIsActive())
+ {
VideoLogInfo("[ERR]");
- return false;
+ return 0;
}
- int nErr = MM_ERROR_NONE;
- char *pErrName = NULL;
- int streaming_type = STREAMING_SERVICE_NONE;
-
- nErr =
- mm_player_get_attribute(playerHandle, &pErrName, "streaming_type",
- &streaming_type, NULL);
+ int nDuration = -1;
- if (nErr != MM_ERROR_NONE) {
- VideoLogInfo("[ERR] Error code : 0x%x - Fail to get attribute ",
- nErr, pErrName);
- free(pErrName);
- return false;
+ int nErr = player_get_duration(pPlayerHandle, &nDuration);
+ if(nErr != PLAYER_ERROR_NONE)
+ {
+ VideoLogInfo("[ERR] Error code : %x - Fail to get attribute ", nErr);
+ return 0;
}
- return (int)streaming_type;
+ return nDuration;
}
-void MpPlayerMgrSetProgressiveDownload(int nFileSize)
+bool MpPlayerMgrSetOverlayXid(void *pOverlayXid)
{
- VideoLogInfo("");
-
- if (!MpPlayerMgrIsActive()) {
+ if(!MpPlayerMgrIsActive())
+ {
VideoLogInfo("[ERR]");
- return;
+ return false;
}
-
- int nErr = MM_ERROR_NONE;
- char *pErrName = NULL;
-
- nErr = mm_player_set_attribute(playerHandle, &pErrName, "pd_enable", 1,
- "pd_full_content_size", nFileSize, NULL);
- if (nErr != MM_ERROR_NONE) {
- VideoLogInfo("[ERR] Error code : 0x%x - Fail to set attribute ",
- nErr, pErrName);
- free(pErrName);
+/*
+ if(!pOverlayXid)
+ {
+ VideoLogInfo("[ERR]");
+ return false;
+ }
+*/
+ VideoLogInfo("XID : %x, %d", pOverlayXid, (int)pOverlayXid);
+ int nErr = player_set_display(pPlayerHandle, PLAYER_DISPLAY_TYPE_X11, (void*)pOverlayXid);
+ if(nErr != PLAYER_ERROR_NONE)
+ {
+ VideoLogInfo("[ERR] Error code : %x - Fail to set attribute ", nErr);
+ return false;
}
+ return true;
}
-void MpPlayerMgrSetDownloadComplete(void)
+bool MpPlayerMgrSetEvasSinkID(void *pEvasSinkID)
{
- VideoLogInfo("");
-
- if (!MpPlayerMgrIsActive()) {
+ if(!MpPlayerMgrIsActive())
+ {
VideoLogInfo("[ERR]");
- return;
+ return false;
}
+/*
+ if(!pEvasSinkID)
+ {
+ VideoLogInfo("[ERR]");
+ return false;
+ }
+*/
+ VideoLogInfo("Evas Sink ID : %x", pEvasSinkID);
- int nErr = MM_ERROR_NONE;
- char *pErrName = NULL;
-
- nErr =
- mm_player_set_attribute(playerHandle, &pErrName, "pd_down_complete",
- 1, NULL);
- if (nErr != MM_ERROR_NONE) {
- VideoLogInfo("[ERR] Error code : 0x%x - Fail to set attribute ",
- nErr, pErrName);
- free(pErrName);
+ int nErr = player_set_display(pPlayerHandle, PLAYER_DISPLAY_TYPE_EVAS, (void*)pEvasSinkID);
+ if(nErr != PLAYER_ERROR_NONE)
+ {
+ VideoLogInfo("[ERR] Error code : %x - Fail to set attribute ", nErr);
+ return false;
}
+
+ return true;
}
-void MpPlayerMgrSetProgressTimerInterval(int nInterval)
+bool MpPlayerMgrSetSoundPriority(void)
{
VideoLogInfo("");
- if (!MpPlayerMgrIsActive()) {
+ if(!MpPlayerMgrIsActive())
+ {
VideoLogInfo("[ERR]");
- return;
+ return false;
}
- char *pErrName = NULL;
- int nErr = MM_ERROR_NONE;
-
- nErr = mm_player_set_attribute(playerHandle, &pErrName,
- "profile_progress_interval", nInterval,
- NULL);
- if (nErr != MM_ERROR_NONE) {
- VideoLogInfo("[ERR] Error code : 0x%x - Fail to set attribute ",
- nErr, pErrName);
- free(pErrName);
+ int nErr = player_set_sound_type(pPlayerHandle, SOUND_TYPE_MEDIA);
+ if(nErr != PLAYER_ERROR_NONE)
+ {
+ VideoLogInfo("[ERR] Error code : %x - Fail to set attribute ", nErr);
+ return false;
}
+
+ return true;
}
-int MpPlayerMgrGetPdduration(void)
+int MpPlayerMgrSetPlaySpeed(float nSpeedValue)
{
VideoLogInfo("");
- if (!MpPlayerMgrIsActive()) {
+ if(!MpPlayerMgrIsActive())
+ {
VideoLogInfo("[ERR]");
- return false;
+ return -1;
}
-
- int nDuration = -1;
- char *pErrName = NULL;
- int nErr = MM_ERROR_NONE;
-
- nErr =
- mm_player_get_attribute(playerHandle, &pErrName, "content_duration",
- &nDuration, NULL);
- if (nErr != MM_ERROR_NONE) {
- VideoLogInfo("[ERR] Error code : 0x%x - Fail to get attribute ",
- nErr, pErrName);
- free(pErrName);
- return false;
+ int nErr = player_set_playback_rate(pPlayerHandle, nSpeedValue);
+ if(nErr != PLAYER_ERROR_NONE)
+ {
+ VideoLogInfo("[ERR] Error code : %x - Fail to get attribute ", nErr);
+ return -1;
}
- return nDuration;
+ return 0;
}
-int MpPlayerMgrGetDuration(char *szFilePath)
+int MpPlayerMgrGetVideoWidthResolution(void)
{
- VideoLogInfo("%s", szFilePath);
+ VideoLogInfo("");
- if (!MpPlayerMgrIsActive()) {
+ if(!MpPlayerMgrIsActive())
+ {
VideoLogInfo("[ERR]");
- return false;
+ return 0;
}
- int nDuration = -1;
- char *pErrName = NULL;
- int nErr = MM_ERROR_NONE;
-
- nErr =
- mm_player_get_attribute(playerHandle, &pErrName, "content_duration",
- &nDuration, NULL);
- if (nErr != MM_ERROR_NONE) {
- VideoLogInfo("[ERR] Error code : 0x%x - Fail to get attribute ",
- nErr, pErrName);
- free(pErrName);
- return false;
+ int nWidth = 0;
+ int nHeight = 0;
+ int nErr = player_get_video_size(pPlayerHandle, &nWidth, &nHeight);
+ if(nErr != PLAYER_ERROR_NONE)
+ {
+ VideoLogInfo("[ERR] Error code : %x - Fail to get attribute ", nErr);
+ return 0;
}
- return nDuration;
+ return nWidth;
}
-bool MpPlayerMgrSetRatioVideoScreenSize(MpPlayerMgrDisplayMethod ScreenSize)
+int MpPlayerMgrGetVideoHeightResolution(void)
{
- VideoLogInfo("Screen size : %d", ScreenSize);
+ VideoLogInfo("");
- if (!MpPlayerMgrIsActive()) {
+ if(!MpPlayerMgrIsActive())
+ {
VideoLogInfo("[ERR]");
- return false;
+ return 0;
}
- char *pErrName = NULL;
- int nErr = MM_ERROR_NONE;
-
- nErr =
- mm_player_set_attribute(playerHandle, &pErrName, "display_method",
- ScreenSize, NULL);
- if (nErr != MM_ERROR_NONE) {
- VideoLogInfo("[ERR] Error code : 0x%x - Fail to set attribute ",
- nErr, pErrName);
- free(pErrName);
- return false;
+ int nWidth = 0;
+ int nHeight = 0;
+ int nErr = player_get_video_size(pPlayerHandle, &nWidth, &nHeight);
+ if(nErr != PLAYER_ERROR_NONE)
+ {
+ VideoLogInfo("[ERR] Error code : %x - Fail to get attribute ", nErr);
+ return 0;
}
- return true;
+ return nHeight;
}
-bool MpPlayerMgrSetOverlayXid(void *pOverlayXid)
+bool MpPlayerMgrSetSubtitle(char *szSubtitlePath)
{
- if (!MpPlayerMgrIsActive()) {
+ VideoLogInfo("%s", szSubtitlePath);
+
+ if(!MpPlayerMgrIsActive())
+ {
VideoLogInfo("[ERR]");
return false;
}
- if (!pOverlayXid) {
- VideoLogInfo("[ERR]");
+ if(!szSubtitlePath)
+ {
+ VideoLogInfo("[ERR] subtitle path is null.");
return false;
}
- int nErr = MM_ERROR_NONE;
- char *pErrName = NULL;
-
- VideoLogInfo("XID : %d", *((int *)pOverlayXid));
-
- nErr =
- mm_player_set_attribute(playerHandle, &pErrName, "display_overlay",
- pOverlayXid, sizeof(int),
- "display_rotation",
- MM_DISPLAY_ROTATION_NONE, NULL);
-
- if (nErr != MM_ERROR_NONE) {
- VideoLogInfo("[ERR] Error code : 0x%x - Fail to set attribute ",
- nErr, pErrName);
- free(pErrName);
+ int nErr = player_set_subtitle_path(pPlayerHandle, szSubtitlePath);
+ if(nErr != PLAYER_ERROR_NONE)
+ {
+ VideoLogInfo("[ERR] Error code : %x - Fail to set attribute ", nErr);
return false;
}
return true;
}
-bool MpPlayerMgrSetSoundPriority(void)
+bool MpPlayerMgrSetDisplayMode(MpPlayerMgrDisplayMethod nMethodMode)
{
VideoLogInfo("");
- if (!MpPlayerMgrIsActive()) {
+ if(!MpPlayerMgrIsActive())
+ {
VideoLogInfo("[ERR]");
return false;
}
-
- char *pErrName = NULL;
- int nErr = MM_ERROR_NONE;
-
- nErr = mm_player_set_attribute(playerHandle, &pErrName,
- "sound_volume_type",
- MM_SOUND_VOLUME_TYPE_MEDIA, NULL);
- if (nErr != MM_ERROR_NONE) {
- VideoLogInfo
- ("[ERR] Error code : 0x%x - Fail to set attribute ", nErr,
- pErrName);
- free(pErrName);
+ int nRet = player_set_display_mode (pPlayerHandle , nMethodMode);
+ if(nRet != PLAYER_ERROR_NONE)
+ {
+ VideoLogInfo("[ERR] Error code : %x - Fail to set attribute ", nRet);
return false;
}
-
return true;
}
-int MpPlayerMgrGetVideoWidthResolution(void)
+bool MpPlayerMgrSetRotate(MpVideoRotation nRotation)
{
VideoLogInfo("");
- if (!MpPlayerMgrIsActive()) {
+ if(!MpPlayerMgrIsActive())
+ {
VideoLogInfo("[ERR]");
return false;
}
- char *pErrName = NULL;
- int nWidth = 0;
- int nErr = MM_ERROR_NONE;
+ int nRotVal = PLAYER_DISPLAY_ROTATION_NONE;
- nErr = mm_player_get_attribute(playerHandle, &pErrName,
- "content_video_width", &nWidth, NULL);
- if (nErr != MM_ERROR_NONE) {
- VideoLogInfo("[ERR] Error code : 0x%x - Fail to get attribute ",
- nErr, pErrName);
- free(pErrName);
- return false;
+ if(nRotation == VIDEO_SCREEN_PORTRAIT) {
+ nRotVal = PLAYER_DISPLAY_ROTATION_NONE;
}
-
- return nWidth;
-}
-
-int MpPlayerMgrGetVideoHeightResolution(void)
-{
- VideoLogInfo("");
-
- if (!MpPlayerMgrIsActive()) {
- VideoLogInfo("[ERR]");
- return false;
+ else if(nRotation == VIDEO_SCREEN_PORTRAIT_UPSIDEDOWN) {
+ nRotVal = PLAYER_DISPLAY_ROTATION_180;
+ }
+ else if(nRotation == VIDEO_SCREEN_LANDSCAPE) {
+ nRotVal = PLAYER_DISPLAY_ROTATION_270;
+ }
+ else if(nRotation == VIDEO_SCREEN_LANDSCAPE_UPSIDEDOWN) {
+ nRotVal = PLAYER_DISPLAY_ROTATION_90;
}
- char *pErrName = NULL;
- int nHeight = 0;
- int nErr = MM_ERROR_NONE;
-
- nErr = mm_player_get_attribute(playerHandle, &pErrName,
- "content_video_height", &nHeight, NULL);
- if (nErr != MM_ERROR_NONE) {
- VideoLogInfo("[ERR] Error code : 0x%x - Fail to get attribute ",
- nErr, pErrName);
- free(pErrName);
+ int nRet = player_set_x11_display_rotation (pPlayerHandle , nRotVal);
+ if(nRet != PLAYER_ERROR_NONE)
+ {
+ VideoLogInfo("[ERR] Error code : %x - Fail to set attribute ", nRet);
return false;
}
-
- return nHeight;
+ return true;
}
-bool MpPlayerMgrSetSubtitleSilent(bool bSilent)
+bool MpPlayerMgrSetUseragentForStreaming(const char *szUserAgent)
{
- VideoLogInfo("");
-
- if (!MpPlayerMgrIsActive()) {
- VideoLogInfo("[ERR]");
- return false;
- }
-
- int nErr = mm_player_set_subtitle_silent(playerHandle, (int)bSilent);
- if (nErr != MM_ERROR_NONE) {
- VideoLogInfo("[ERR] Error code : 0x%x - ", nErr);
- return false;
- }
+ VideoLogInfo("!!!!!! NO EXIST FUNCTION FOR SETTING USER AGENT. !!!!!!");
return true;
}
-bool MpPlayerMgrSetSubtitle(const char *szSubtitlePath)
+bool MpPlayerMgrSetProxyAddressForStreaming(const char *szProxyAddress)
{
- VideoLogInfo("%s", szSubtitlePath);
+ VideoLogInfo("!!!!!! NO EXIST FUNCTION FOR SETTING PROXY ADDRESS. !!!!!!");
+ return true;
+}
- if (!MpPlayerMgrIsActive()) {
+bool MpPlayerMgrSetCookieForStreaming(const char *szCookie)
+{
+ if(!MpPlayerMgrIsActive())
+ {
VideoLogInfo("[ERR]");
return false;
}
- if (!szSubtitlePath) {
- VideoLogInfo("[ERR] subtitle path is null.");
+ if(!szCookie)
+ {
+ VideoLogInfo("No exist cookie.");
return false;
}
- char *pErrName = NULL;
+ VideoLogInfo("");
- int nErr = 0;
- nErr = mm_player_set_attribute(playerHandle, &pErrName, "subtitle_uri",
- (const char *)szSubtitlePath,
- strlen(szSubtitlePath), NULL);
- if (nErr != MM_ERROR_NONE) {
- VideoLogInfo("[ERR] Error code : 0x%x - Fail to set attribute ",
- nErr, pErrName);
- free(pErrName);
+ int nRet = player_set_streaming_cookie(pPlayerHandle , szCookie, strlen(szCookie));
+ if(nRet == PLAYER_ERROR_INVALID_PARAMETER)
+ {
+ VideoLogInfo("PLAYER_ERROR_INVALID_PARAMETER");
return false;
- } else {
- VideoLogInfo("Success to set subtitle.");
}
return true;
}
-int MpPlayerMgrSetBluetoothHeadset(char *szBlutoothAddress, int nMode)
+bool MpPlayerMgrStartCapture()
{
VideoLogInfo("");
-
- return 1;
+ return true;
}
-int MpPlayerMgrSetDisplayArea(int nX, int nY, int nWidth, int nHeight)
+bool MpPlayerMgrCaptureVideo(void *pCallbackFunc, void *pUserData)
{
+ if(!MpPlayerMgrIsActive())
+ {
+ VideoLogInfo("");
+ return false;
+ }
+
VideoLogInfo("");
- if (!MpPlayerMgrIsActive()) {
- VideoLogInfo("[ERR]");
+ int nRet = player_capture_video(pPlayerHandle, pCallbackFunc, pUserData);
+ if(nRet == PLAYER_ERROR_INVALID_PARAMETER)
+ {
+ VideoLogInfo("PLAYER_ERROR_INVALID_PARAMETER");
return false;
}
- char *pErrName = NULL;
+ if(nRet == PLAYER_ERROR_INVALID_OPERATION)
+ {
+ VideoLogInfo("PLAYER_ERROR_INVALID_OPERATION");
+ return false;
+ }
- int nErr = 0;
- nErr = mm_player_set_attribute(playerHandle, &pErrName, "display_roi_x",
- nX, "display_roi_y", nY,
- "display_roi_width", nWidth,
- "display_roi_height", nHeight, NULL);
- if (nErr != MM_ERROR_NONE) {
- VideoLogInfo("[ERR] Error code : 0x%x - Fail to set attribute ",
- nErr, pErrName);
- free(pErrName);
+ if(nRet == PLAYER_ERROR_INVALID_STATE)
+ {
+ VideoLogInfo("PLAYER_ERROR_INVALID_STATE");
return false;
}
return true;
}
-int MpPlayerMgrSetVerticalOverlayPos(int nY)
+int MpPlayerMgrGetBufferingPosition(void)
{
- VideoLogInfo("");
+ int nStartPos = 0;
+ int nCurrentPos = 0;
- if (!MpPlayerMgrIsActive()) {
+ if(player_get_streaming_download_progress(pPlayerHandle,&nStartPos, &nCurrentPos) != PLAYER_ERROR_NONE)
+ {
+ VideoLogError("");
+ return 0;
+}
+
+ return nCurrentPos;
+}
+
+bool MpPlayerMgrRegisteBufferingCallBack(void *pCallbackFunc, void *pUserData)
+{
+ if(!MpPlayerMgrIsActive())
+ {
VideoLogInfo("[ERR]");
return false;
}
- char *pErrName = NULL;
-
- int nErr = 0;
- nErr = mm_player_set_attribute(playerHandle, &pErrName, "display_roi_y",
- nY, NULL);
- if (nErr != MM_ERROR_NONE) {
- VideoLogInfo("[ERR] Error code : 0x%x - Fail to set attribute ",
- nErr, pErrName);
- free(pErrName);
+ // !!! CHECK player_buffering_cb !!!
+ if(player_set_buffering_cb(pPlayerHandle, pCallbackFunc, pUserData) != PLAYER_ERROR_NONE)
+ {
+ VideoLogInfo("");
return false;
}
return true;
}
-bool MpPlayerMgrSetUseragentForStreaming(const char *szUserAgent)
+int MpPlayerMgrGetFileStreamType(void)
{
VideoLogInfo("");
- if (!MpPlayerMgrIsActive()) {
- VideoLogInfo("[ERR]");
- return false;
- }
+// jdlee
+ return FILE_STREAM_TYPE_VIDEO;
+}
- if (!szUserAgent) {
+bool MpPlayerMgrSetScaling(bool bScale)
+{
+ if(!MpPlayerMgrIsActive())
+ {
VideoLogInfo("[ERR]");
return false;
}
- int nErr = MM_ERROR_NONE;
- char *pErrName = NULL;
-
- if (strlen(szUserAgent) > 0) {
- VideoLogInfo("User agent (%s)", szUserAgent);
- nErr = mm_player_set_attribute(playerHandle, &pErrName,
- "streaming_user_agent",
- szUserAgent, strlen(szUserAgent),
- NULL);
+ VideoLogInfo("");
- if (nErr != MM_ERROR_NONE) {
- VideoLogInfo("[ERR] (%x):: Fail to set attribute [%s]",
- nErr, pErrName);
- free(pErrName);
- return false;
- }
- } else {
- VideoLogInfo("No have useragnet value.");
- return true;
+ if(player_enable_evas_display_scaling(pPlayerHandle, bScale) != PLAYER_ERROR_NONE) {
+ VideoLogInfo("[ERR]");
+ return false;
}
-
return true;
}
-bool MpPlayerMgrSetProxAddressForStreaming(const char *szProxyAddress)
+player_state_e MpPlayerMgrGetPlayerState(void)
{
- VideoLogInfo("");
-
- if (!MpPlayerMgrIsActive()) {
- VideoLogInfo("[ERR]");
- return false;
+ int ret = 0;
+ player_state_e player_state = PLAYER_STATE_NONE;
+ ret = player_get_state(pPlayerHandle, &player_state);
+ if (ret != PLAYER_ERROR_NONE) {
+ player_state = PLAYER_STATE_NONE;
}
+ return player_state;
+}
- if (!szProxyAddress) {
+void MpPlayerMgrSetVolume(float volume)
+{
+ VideoLogInfo("volume = %f", volume);
+
+ if(!MpPlayerMgrIsActive())
+ {
VideoLogInfo("[ERR]");
- return false;
+ return;
}
- int nErr = MM_ERROR_NONE;
- char *pErrName = NULL;
-
- if (strlen(szProxyAddress) > 0) {
- VideoLogInfo("Proxy Setting (%s)", szProxyAddress);
- nErr = mm_player_set_attribute(playerHandle, &pErrName,
- "streaming_proxy",
- szProxyAddress,
- strlen(szProxyAddress), NULL);
-
- if (nErr != MM_ERROR_NONE) {
- VideoLogInfo("[ERR] (%x):: Fail to set attribute [%s]",
- nErr, pErrName);
- free(pErrName);
- return false;
- }
+ if(player_set_volume(pPlayerHandle, volume, volume) != PLAYER_ERROR_NONE)
+ {
+ VideoLogInfo("[ERR] Fail to set volume.");
}
- return true;
}
-bool MpPlayerMgrSetCookieForStreaming(const char *szCookie)
+float MpPlayerMgrGetVolume(void)
{
VideoLogInfo("");
- if (!MpPlayerMgrIsActive()) {
- VideoLogInfo("[ERR]");
- return false;
- }
-
- if (!szCookie) {
+ if(!MpPlayerMgrIsActive())
+ {
VideoLogInfo("[ERR]");
- return false;
+ return 0.0;
}
- int nErr = MM_ERROR_NONE;
- char *pErrName = NULL;
-
- if (strlen(szCookie) > 0) {
- VideoLogInfo("Cookie (%s)", szCookie);
- nErr = mm_player_set_attribute(playerHandle, &pErrName,
- "streaming_cookie", szCookie,
- strlen(szCookie), NULL);
-
- if (nErr != MM_ERROR_NONE) {
- VideoLogInfo("[ERR] (%x):: Fail to set attribute [%s]",
- nErr, pErrName);
+ float volume_left = 0.0;
+ float volume_right = 0.0;
- if (pErrName)
- free(pErrName);
-
- return false;
- }
- } else {
- VideoLogInfo("No have useragnet value.");
- return true;
+ if(player_get_volume(pPlayerHandle, &volume_left, &volume_right) != PLAYER_ERROR_NONE)
+ {
+ VideoLogInfo("[ERR] Fail to get volume.");
+ return 0.0;
}
- return true;
+ return volume_left;
}
-
-int MpPlayerMgrGetBufferingPosition(void)
+int MpPlayerMgrGetClosedCaptionCount(void)
{
- if (!MpPlayerMgrIsActive()) {
+ VideoLogInfo("");
+
+ if(!MpPlayerMgrIsActive())
+ {
VideoLogInfo("[ERR]");
- return false;
+ return 0;
}
+ int nCount = 0;
- int nErr = MM_ERROR_NONE;
-
- int startPos = 0, stopPos = 0;
- nErr = mm_player_get_buffer_position(playerHandle,
- MM_PLAYER_POS_FORMAT_PERCENT,
- &startPos, &stopPos);
- if (nErr != MM_ERROR_NONE) {
- VideoLogInfo("[ERR]");
- return -1;
+ if(player_get_track_count(pPlayerHandle, PLAYER_TRACK_TYPE_TEXT, &nCount) != PLAYER_ERROR_NONE)
+ {
+ VideoLogError("[ERR] player_get_track_count.");
+ return 0;
}
- return stopPos;
+ VideoLogError("== %d ===========================================", nCount);
+
+ return nCount;
}
+