EasyPlayerPro是一款全功能的流媒体播放器,支持RTSP、RTMP、HTTP、HLS、UDP、RTP、File等多种流媒体协议播放、支持本地文件播放,支持本地抓拍、本地录像、播放旋转、多屏播放等多种功能特性,核心基于ffmpeg,稳定、高效、可靠,支持Windows、Android、iOS三个平台,EasyPlayerPro播放器可广泛应用于流媒体客户端、互联网直播、在线教育、IPTV、赛事直播、本地视频文件播放等项目中。
我们今天介绍一下EasyPlayerPro-win版的D3D画面旋转实现方法,可以从 https://github.com/tsingsee/EasyPlayerPro-Win 下载到工程代码。
其中定义的tagEASY_PARAM_ID枚举和EasyPlayerPro_Setparam(Easy_PlayerPro_Handle player, EASY_PARAM_ID param_id, EASY_HANDLE param)函数可以完成很多功能。
typedef enum tagEASY_PARAM_ID
{
//++ public
// duration & position
EASY_PARAM_MEDIA_DURATION = 0x1000,
EASY_PARAM_MEDIA_POSITION,
// media detail info
EASY_PARAM_MEDIA_INFO,
EASY_PARAM_VIDEO_WIDTH,
EASY_PARAM_VIDEO_HEIGHT,
// video display mode
EASY_PARAM_VIDEO_MODE,
// audio volume control
EASY_PARAM_AUDIO_VOLUME,
// playback speed control
EASY_PARAM_PLAY_SPEED,
EASY_PARAM_PLAY_SPEED_TYPE,
// video decode thread count
EASY_PARAM_DECODE_THREAD_COUNT,
// visual effect mode
EASY_PARAM_VISUAL_EFFECT,
// audio/video sync diff
EASY_PARAM_AVSYNC_TIME_DIFF,
// player event/audio/video callback
EASY_PARAM_PLAYER_CALLBACK,
// player event/audio/video callback userdata
EASY_PARAM_PLAYER_USERDATA,
// audio/video stream
EASY_PARAM_AUDIO_STREAM_TOTAL,
EASY_PARAM_VIDEO_STREAM_TOTAL,
EASY_PARAM_SUBTITLE_STREAM_TOTAL,
EASY_PARAM_AUDIO_STREAM_CUR,
EASY_PARAM_VIDEO_STREAM_CUR,
EASY_PARAM_SUBTITLE_STREAM_CUR,
//++ for media record
EASY_PARAM_RECORD_TIME,
EASY_PARAM_RECORD_PIECE_ID,
//-- for media record
//-- public
//++ for audio render type
EASY_PARAM_ADEV_RENDER_TYPE = 0x2000,
EASY_PARAM_ADEV_GET_CONTEXT,
EASY_PARAM_ADEV_MUTE,
//-- for audio render type
//++ for vdev
EASY_PARAM_VDEV_RENDER_TYPE = 0x3000,
EASY_PARAM_VDEV_FRAME_RATE,
EASY_PARAM_VDEV_GET_CONTEXT,
EASY_PARAM_VDEV_POST_SURFACE,
EASY_PARAM_VDEV_GET_D3DDEV,
EASY_PARAM_VDEV_D3D_ROTATE,
EASY_PARAM_VDEV_RENDER_SHOW,
//-- for vdev
//++ for render
EASY_PARAM_RENDER_UPDATE = 0x4000,
EASY_PARAM_RENDER_START_PTS,
//-- for render
}EASY_PARAM_ID;
枚举类型中 EASY_PARAM_VDEV_D3D_ROTATE 为D3D画面旋转需要用到的类型,在HandleCommand函数中,如下方法实现旋转(每次旋转90度):
case POP_MENU_STREAM_D3D_ROTATE: //d3d视频旋转
{
int angle = 0;
EasyPlayerPro_Getparam(m_pMainDlg->m_hPlayer, EASY_PARAM_VDEV_D3D_ROTATE, &angle);
angle += 90; angle %= 360;
EasyPlayerPro_Setparam(m_pMainDlg->m_hPlayer, EASY_PARAM_VDEV_D3D_ROTATE, &angle);
}
break;
下面我们看下实际效果: