本文整理汇总了C++中MediaPlayer类的典型用法代码示例。如果您正苦于以下问题:C++ MediaPlayer类的具体用法?C++ MediaPlayer怎么用?C++ MediaPlayer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MediaPlayer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: com_media_ffmpeg_FFMpegPlayer_setDataSourceAndHeaders
static void
com_media_ffmpeg_FFMpegPlayer_setDataSourceAndHeaders(
JNIEnv *env, jobject thiz, jstring path, jobject headers) {
MediaPlayer* mp = getMediaPlayer(env, thiz);
if (mp == NULL ) {
jniThrowException(env, "java/lang/IllegalStateException", NULL);
return;
}
if (path == NULL) {
jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
return;
}
const char *pathStr = env->GetStringUTFChars(path, NULL);
if (pathStr == NULL) { // Out of memory
jniThrowException(env, "java/lang/RuntimeException", "Out of memory");
return;
}
__android_log_print(ANDROID_LOG_INFO, TAG, "setDataSource: path %s", pathStr);
status_t opStatus = mp->setDataSource(pathStr);
__android_log_print(ANDROID_LOG_INFO, TAG, "opStatus---->0x%X", opStatus);
// Make sure that local ref is released before a potential exception
env->ReleaseStringUTFChars(path, pathStr);
process_media_player_call(
env, thiz, opStatus, "java/io/IOException",
"setDataSource failed." );
}
示例2: videoElement
LayoutSize RenderVideo::calculateIntrinsicSize()
{
HTMLVideoElement* video = videoElement();
// Spec text from 4.8.6
//
// The intrinsic width of a video element's playback area is the intrinsic width
// of the video resource, if that is available; otherwise it is the intrinsic
// width of the poster frame, if that is available; otherwise it is 300 CSS pixels.
//
// The intrinsic height of a video element's playback area is the intrinsic height
// of the video resource, if that is available; otherwise it is the intrinsic
// height of the poster frame, if that is available; otherwise it is 150 CSS pixels.
MediaPlayer* player = mediaElement()->player();
if (player && video->readyState() >= HTMLVideoElement::HAVE_METADATA) {
LayoutSize size = player->naturalSize();
if (!size.isEmpty())
return size;
}
if (video->shouldDisplayPosterImage() && !m_cachedImageSize.isEmpty() && !imageResource()->errorOccurred())
return m_cachedImageSize;
// <video> in standalone media documents should not use the default 300x150
// size since they also have audio-only files. By setting the intrinsic
// size to 300x1 the video will resize itself in these cases, and audio will
// have the correct height (it needs to be > 0 for controls to render properly).
if (video->ownerDocument() && video->ownerDocument()->isMediaDocument())
return LayoutSize(defaultSize().width(), 1);
return defaultSize();
}
示例3: vlcCallback
static void vlcCallback(const libvlc_event_t *p_event, void *p_user_data) {
if (p_event->type == libvlc_MediaPlayerEndReached) {
assert(p_user_data);
MediaPlayer *mp = (MediaPlayer *)p_user_data;
mp->onStopped();
}
}
示例4: mediaElement
void RenderVideo::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
MediaPlayer* mediaPlayer = mediaElement()->player();
bool displayingPoster = videoElement()->shouldDisplayPosterImage();
Page* page = 0;
if (Frame* frame = this->frame())
page = frame->page();
if (!displayingPoster && !mediaPlayer) {
if (page && paintInfo.phase == PaintPhaseForeground)
page->addRelevantUnpaintedObject(this, visualOverflowRect());
return;
}
LayoutRect rect = videoBox();
if (rect.isEmpty()) {
if (page && paintInfo.phase == PaintPhaseForeground)
page->addRelevantUnpaintedObject(this, visualOverflowRect());
return;
}
rect.moveBy(paintOffset);
if (page && paintInfo.phase == PaintPhaseForeground)
page->addRelevantRepaintedObject(this, rect);
if (displayingPoster)
paintIntoRect(paintInfo.context, rect);
else if (document()->view() && document()->view()->paintBehavior() & PaintBehaviorFlattenCompositingLayers)
mediaPlayer->paintCurrentFrameInContext(paintInfo.context, pixelSnappedIntRect(rect));
else
mediaPlayer->paint(paintInfo.context, pixelSnappedIntRect(rect));
}
示例5: PRGAPI
BOOL CTeenSpiritDlg::OnCopyData(CWnd* pWnd, COPYDATASTRUCT* pCopyDataStruct)
{
if (pCopyDataStruct->dwData == COMMANDLINE_ARG)
{
static BOOL bEnqueue;
if (pCopyDataStruct->cbData != 0)
{
LPCTSTR path = (LPCTSTR)pCopyDataStruct->lpData;
if (_tcsicmp(path, _T("-q")) == 0)
bEnqueue = TRUE;
if (path[0] != '-' && path[0] !='\\')
{
PrgAPI* pAPI = PRGAPI();
MediaPlayer* pPlayer = pAPI->GetMediaPlayer();
MediaPlayListItem mpli;
if (bEnqueue)
pPlayer->Enqueue(path);
else
pPlayer->Play(path);
bEnqueue = TRUE;
}
}
else
bEnqueue = FALSE;
}
return __super::OnCopyData(pWnd, pCopyDataStruct);
}
示例6: paintCurrentFrameInContext
void HTMLVideoElement::paintCurrentFrameInContext(GraphicsContext* context, const IntRect& destRect)
{
MediaPlayer* player = HTMLMediaElement::player();
if (!player)
return;
player->paintCurrentFrameInContext(context, destRect);
}
开发者ID:IllusionRom-deprecated,项目名称:android_platform_external_chromium_org_third_party_WebKit,代码行数:7,代码来源:HTMLVideoElement.cpp
示例7: mediaElement
void RenderVideo::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
MediaPlayer* mediaPlayer = mediaElement()->player();
bool displayingPoster = videoElement()->shouldDisplayPosterImage();
if (!displayingPoster && !mediaPlayer)
return;
LayoutRect rect = videoBox();
if (rect.isEmpty())
return;
rect.moveBy(paintOffset);
LayoutRect contentRect = contentBoxRect();
contentRect.moveBy(paintOffset);
GraphicsContext* context = paintInfo.context;
bool clip = !contentRect.contains(rect);
if (clip) {
context->save();
context->clip(contentRect);
}
if (displayingPoster)
paintIntoRect(context, rect);
else if ((document().view() && document().view()->paintBehavior() & PaintBehaviorFlattenCompositingLayers) || !acceleratedRenderingInUse())
mediaPlayer->paint(context, pixelSnappedIntRect(rect));
if (clip)
context->restore();
}
示例8: DEPRECATED_DEFINE_STATIC_LOCAL
String MediaControlsHost::externalDeviceType() const
{
DEPRECATED_DEFINE_STATIC_LOCAL(String, none, (ASCIILiteral("none")));
String type = none;
#if ENABLE(IOS_AIRPLAY)
DEPRECATED_DEFINE_STATIC_LOCAL(String, airplay, (ASCIILiteral("airplay")));
DEPRECATED_DEFINE_STATIC_LOCAL(String, tvout, (ASCIILiteral("tvout")));
MediaPlayer* player = m_mediaElement->player();
if (!player) {
LOG(Media, "MediaControlsHost::externalDeviceType - returning \"none\" because player is NULL");
return none;
}
switch (player->wirelessPlaybackTargetType()) {
case MediaPlayer::TargetTypeNone:
type = none;
break;
case MediaPlayer::TargetTypeAirPlay:
type = airplay;
break;
case MediaPlayer::TargetTypeTVOut:
type = tvout;
break;
}
#endif
LOG(Media, "MediaControlsHost::externalDeviceType - returning \"%s\"", type.utf8().data());
return type;
}
示例9: process_media_player_call
// If exception is NULL and opStatus is not OK, this method sends an error
// event to the client application; otherwise, if exception is not NULL and
// opStatus is not OK, this method throws the given exception to the client
// application.
static void process_media_player_call(JNIEnv *env, jobject thiz, int opStatus, const char* exception, const char *message)
{
if (exception == NULL) { // Don't throw exception. Instead, send an event.
if (opStatus != (int) OK) {
MediaPlayer* mp = getMediaPlayer(env, thiz);
if (mp != 0) mp->notify(MEDIA_ERROR, opStatus, 0, 0);
}
} else { // Throw exception!
if ( opStatus == (int) INVALID_OPERATION ) {
jniThrowException(env, "java/lang/IllegalStateException", NULL);
} else if ( opStatus == (int) PERMISSION_DENIED ) {
jniThrowException(env, "java/lang/SecurityException", NULL);
} else if ( opStatus != (int) OK ) {
if (strlen(message) > 230) {
// if the message is too long, don't bother displaying the status code
jniThrowException( env, exception, message);
} else {
char msg[256];
// append the status code to the message
sprintf(msg, "%s: status=0x%X", message, opStatus);
jniThrowException( env, exception, msg);
}
}
}
}
示例10: LOG
bool MediaElementSession::wirelessVideoPlaybackDisabled(const HTMLMediaElement& element) const
{
Settings* settings = element.document().settings();
if (!settings || !settings->allowsAirPlayForMediaPlayback()) {
LOG(Media, "MediaElementSession::wirelessVideoPlaybackDisabled - returning TRUE because of settings");
return true;
}
if (element.fastHasAttribute(HTMLNames::webkitwirelessvideoplaybackdisabledAttr)) {
LOG(Media, "MediaElementSession::wirelessVideoPlaybackDisabled - returning TRUE because of attribute");
return true;
}
#if PLATFORM(IOS)
String legacyAirplayAttributeValue = element.fastGetAttribute(HTMLNames::webkitairplayAttr);
if (equalLettersIgnoringASCIICase(legacyAirplayAttributeValue, "deny")) {
LOG(Media, "MediaElementSession::wirelessVideoPlaybackDisabled - returning TRUE because of legacy attribute");
return true;
}
if (equalLettersIgnoringASCIICase(legacyAirplayAttributeValue, "allow")) {
LOG(Media, "MediaElementSession::wirelessVideoPlaybackDisabled - returning FALSE because of legacy attribute");
return false;
}
#endif
MediaPlayer* player = element.player();
if (!player)
return true;
bool disabled = player->wirelessVideoPlaybackDisabled();
LOG(Media, "MediaElementSession::wirelessVideoPlaybackDisabled - returning %s because media engine says so", disabled ? "TRUE" : "FALSE");
return disabled;
}
示例11: PRGAPI
void TrayToolTipDlg::UpdateSliders()
{
MediaPlayer* pMP = PRGAPI()->GetMediaPlayer();
INT volume = pMP->GetVolume();
INT pos = (INT)(pMP->GetMediaPos() * 1000);
m_volumeSlider.SetPos(volume);
m_positionSlider.SetPos(pos);
m_positionSlider.SetMaxPos((INT)(pMP->GetMediaLength()*1000));
}
示例12: paintCurrentFrameInContext
void HTMLVideoElement::paintCurrentFrameInContext(GraphicsContext& context, const FloatRect& destRect)
{
MediaPlayer* player = HTMLMediaElement::player();
if (!player)
return;
player->setVisible(true); // Make player visible or it won't draw.
player->paintCurrentFrameInContext(context, destRect);
}
示例13: wseemann_media_FFmpegMediaPlayer_attachAuxEffect
static void wseemann_media_FFmpegMediaPlayer_attachAuxEffect(JNIEnv *env, jobject thiz, jint effectId) {
__android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, "attachAuxEffect(): %d", effectId);
MediaPlayer* mp = getMediaPlayer(env, thiz);
if (mp == NULL ) {
jniThrowException(env, "java/lang/IllegalStateException", NULL);
return;
}
process_media_player_call( env, thiz, mp->attachAuxEffect(effectId), NULL, NULL );
}
示例14: wseemann_media_FFmpegMediaPlayer_set_audio_session_id
static void wseemann_media_FFmpegMediaPlayer_set_audio_session_id(JNIEnv *env, jobject thiz, jint sessionId) {
__android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, "set_session_id(): %d", sessionId);
MediaPlayer* mp = getMediaPlayer(env, thiz);
if (mp == NULL ) {
jniThrowException(env, "java/lang/IllegalStateException", NULL);
return;
}
process_media_player_call( env, thiz, mp->setAudioSessionId(sessionId), NULL, NULL );
}
示例15: com_media_ffmpeg_FFMpegPlayer_prepare
static void
com_media_ffmpeg_FFMpegPlayer_prepare(JNIEnv *env, jobject thiz)
{
MediaPlayer* mp = getMediaPlayer(env, thiz);
if (mp == NULL ) {
jniThrowException(env, "java/lang/IllegalStateException", NULL);
return;
}
process_media_player_call( env, thiz, mp->prepare(), "java/io/IOException", "Prepare failed." );
}