Commit 14783b4c authored by eric.carlson@apple.com's avatar eric.carlson@apple.com
Browse files

2009-11-25 Eric Carlson <eric.carlson@apple.com>

        Reviewed by Simon Fraser.

        <rdar://problem/7409331> Windows: Support closed caption in <video> element

        Enable closed captions in QuickTime/Windows media engine.

        * platform/graphics/win/MediaPlayerPrivateQuickTimeWin.cpp:
        (WebCore::MediaPlayerPrivate::hasClosedCaptions):
        (WebCore::MediaPlayerPrivate::setClosedCaptionsVisible):
            New, all through to m_qtMovie.

        * platform/graphics/win/MediaPlayerPrivateQuickTimeWin.h:
            Make all but the destructor private since MediaPlayer call through the media
            engine interface.

        * platform/graphics/win/QTMovieWin.cpp:
        (QTMovieWin::disableUnsupportedTracks):
            Use handy new constants for QuickTime track types.
        (QTMovieWin::hasClosedCaptions):
        (QTMovieWin::setClosedCaptionsVisible):
            New, closed caption support.
        * platform/graphics/win/QTMovieWin.h:

        * rendering/RenderMediaControls.cpp:
        (WebCore::RenderMediaControls::paintMediaControlsPart):
            Deal with closed caption buttons.

        * rendering/RenderThemeWin.cpp:
        (WebCore::RenderThemeWin::shouldRenderMediaControlPart):
            New, don't ask the media engine if it has closed captions unless the Safari theme will
            be able to render the button.
        (WebCore::RenderThemeWin::paintMediaToggleClosedCaptionsButton):
            New.
        * rendering/RenderThemeWin.h:

2009-11-25  Eric Carlson  <eric.carlson@apple.com>

        Reviewed by Simon Fraser.

        <rdar://problem/7409331> Windows: Support closed caption in <video> element

        * platform/win/Skipped:
            Enable the closed caption test.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@51393 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent ea9b2c6a
2009-11-25 Eric Carlson <eric.carlson@apple.com>
Reviewed by Simon Fraser.
<rdar://problem/7409331> Windows: Support closed caption in <video> element
* platform/win/Skipped:
Enable the closed caption test.
2009-11-25 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
 
We do not have a strategy in place to mimick the output for load
#
# Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
# Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
......@@ -55,9 +55,6 @@ media/video-volume-slider.html
media/media-fullscreen-inline.html
media/media-fullscreen-not-in-document.html
# Requires media engine closed caption support
media/media-captions.html
# <rdar://problem/5075790> Layout tests that depend on certain fonts don't match Mac results:
# - Mac OS X and Windows do not have an Arabic font in common
fast/text/international/bidi-AN-after-L.html
......
2009-11-25 Eric Carlson <eric.carlson@apple.com>
Reviewed by Simon Fraser.
<rdar://problem/7409331> Windows: Support closed caption in <video> element
Enable closed captions in QuickTime/Windows media engine.
* platform/graphics/win/MediaPlayerPrivateQuickTimeWin.cpp:
(WebCore::MediaPlayerPrivate::hasClosedCaptions):
(WebCore::MediaPlayerPrivate::setClosedCaptionsVisible):
New, all through to m_qtMovie.
* platform/graphics/win/MediaPlayerPrivateQuickTimeWin.h:
Make all but the destructor private since MediaPlayer call through the media
engine interface.
* platform/graphics/win/QTMovieWin.cpp:
(QTMovieWin::disableUnsupportedTracks):
Use handy new constants for QuickTime track types.
(QTMovieWin::hasClosedCaptions):
(QTMovieWin::setClosedCaptionsVisible):
New, closed caption support.
* platform/graphics/win/QTMovieWin.h:
* rendering/RenderMediaControls.cpp:
(WebCore::RenderMediaControls::paintMediaControlsPart):
Deal with closed caption buttons.
* rendering/RenderThemeWin.cpp:
(WebCore::RenderThemeWin::shouldRenderMediaControlPart):
New, don't ask the media engine if it has closed captions unless the Safari theme will
be able to render the button.
(WebCore::RenderThemeWin::paintMediaToggleClosedCaptionsButton):
New.
* rendering/RenderThemeWin.h:
2009-11-25 Drew Wilson <atwilson@chromium.org>
 
Reviewed by David Levin.
......@@ -318,6 +318,20 @@ void MediaPlayerPrivate::setPreservesPitch(bool preservesPitch)
m_qtMovie->setPreservesPitch(preservesPitch);
}
bool MediaPlayerPrivate::hasClosedCaptions() const
{
if (!m_qtMovie)
return false;
return m_qtMovie->hasClosedCaptions();
}
void MediaPlayerPrivate::setClosedCaptionsVisible(bool visible)
{
if (!m_qtMovie)
return;
m_qtMovie->setClosedCaptionsVisible(visible);
}
int MediaPlayerPrivate::dataRate() const
{
// This is not used at the moment
......
......@@ -49,7 +49,10 @@ public:
static void registerMediaEngine(MediaEngineRegistrar);
~MediaPlayerPrivate();
private:
MediaPlayerPrivate(MediaPlayer*);
IntSize naturalSize() const;
bool hasVideo() const;
bool hasAudio() const;
......@@ -93,8 +96,8 @@ public:
bool hasSingleSecurityOrigin() const;
private:
MediaPlayerPrivate(MediaPlayer*);
bool hasClosedCaptions() const;
void setClosedCaptionsVisible(bool);
void updateStates();
void doSeek();
......
......@@ -45,6 +45,12 @@ using namespace std;
static const long minimumQuickTimeVersion = 0x07300000; // 7.3
static const long closedCaptionTrackType = 'clcp';
static const long subTitleTrackType = 'sbtl';
static const long mpeg4ObjectDescriptionTrackType = 'odsm';
static const long mpeg4SceneDescriptionTrackType = 'sdsm';
static const long closedCaptionDisplayPropertyID = 'disp';
// Resizing GWorlds is slow, give them a minimum size so size of small
// videos can be animated smoothly
static const int cGWorldMinWidth = 640;
......@@ -757,10 +763,10 @@ void QTMovieWin::disableUnsupportedTracks(unsigned& enabledTrackCount, unsigned&
allowedTrackTypes->add(SoundMediaType);
allowedTrackTypes->add(TextMediaType);
allowedTrackTypes->add(BaseMediaType);
allowedTrackTypes->add('clcp'); // Closed caption
allowedTrackTypes->add('sbtl'); // Subtitle
allowedTrackTypes->add('odsm'); // MPEG-4 object descriptor stream
allowedTrackTypes->add('sdsm'); // MPEG-4 scene description stream
allowedTrackTypes->add(closedCaptionTrackType);
allowedTrackTypes->add(subTitleTrackType);
allowedTrackTypes->add(mpeg4ObjectDescriptionTrackType);
allowedTrackTypes->add(mpeg4SceneDescriptionTrackType);
allowedTrackTypes->add(TimeCodeMediaType);
allowedTrackTypes->add(TimeCode64MediaType);
}
......@@ -877,6 +883,27 @@ bool QTMovieWin::hasAudio() const
return (GetMovieIndTrackType(m_private->m_movie, 1, AudioMediaCharacteristic, movieTrackCharacteristic | movieTrackEnabledOnly));
}
bool QTMovieWin::hasClosedCaptions() const
{
if (!m_private->m_movie)
return false;
return GetMovieIndTrackType(m_private->m_movie, 1, closedCaptionTrackType, movieTrackMediaType);
}
void QTMovieWin::setClosedCaptionsVisible(bool visible)
{
if (!m_private->m_movie)
return;
Track ccTrack = GetMovieIndTrackType(m_private->m_movie, 1, closedCaptionTrackType, movieTrackMediaType);
if (!ccTrack)
return;
Boolean doDisplay = visible;
QTSetTrackProperty(ccTrack, closedCaptionTrackType, closedCaptionDisplayPropertyID, sizeof(doDisplay), &doDisplay);
}
pascal OSErr movieDrawingCompleteProc(Movie movie, long data)
{
UppParam param;
......
......@@ -98,6 +98,9 @@ public:
bool hasVideo() const;
bool hasAudio() const;
bool hasClosedCaptions() const;
void setClosedCaptionsVisible(bool);
static unsigned countSupportedTypes();
static void getSupportedType(unsigned index, const UChar*& str, unsigned& len);
......
......@@ -90,6 +90,15 @@ bool RenderMediaControls::paintMediaControlsPart(MediaControlElementType part, R
case MediaFullscreenButton:
paintThemePart(SafariTheme::MediaFullscreenButtonPart, paintInfo.context->platformContext(), r, NSRegularControlSize, determineState(o));
break;
case MediaShowClosedCaptionsButton:
case MediaHideClosedCaptionsButton:
#if SAFARI_THEME_VERSION >= 4
if (MediaControlToggleClosedCaptionsButtonElement* btn = static_cast<MediaControlToggleClosedCaptionsButtonElement*>(o->node())) {
bool captionsVisible = btn->displayType() == MediaHideClosedCaptionsButton;
paintThemePart(captionsVisible ? SafariTheme::MediaHideClosedCaptionsButtonPart : SafariTheme::MediaShowClosedCaptionsButtonPart, paintInfo.context->platformContext(), r, NSRegularControlSize, determineState(o));
}
#endif
break;
case MediaMuteButton:
case MediaUnMuteButton:
if (MediaControlMuteButtonElement* btn = static_cast<MediaControlMuteButtonElement*>(o->node())) {
......
......@@ -955,6 +955,23 @@ Color RenderThemeWin::systemColor(int cssValueId) const
}
#if ENABLE(VIDEO)
bool RenderThemeWin::shouldRenderMediaControlPart(ControlPart part, Element* element)
{
if (part == MediaToggleClosedCaptionsButtonPart) {
// We rely on QuickTime to render captions so only enable the button for a video element.
#if SAFARI_THEME_VERSION >= 4
if (!element->hasTagName(videoTag))
return false;
#else
return false;
#endif
}
return RenderTheme::shouldRenderMediaControlPart(part, element);
}
bool RenderThemeWin::paintMediaFullscreenButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r)
{
return RenderMediaControls::paintMediaControlsPart(MediaFullscreenButton, o, paintInfo, r);
......@@ -989,6 +1006,12 @@ bool RenderThemeWin::paintMediaSliderThumb(RenderObject* o, const RenderObject::
{
return RenderMediaControls::paintMediaControlsPart(MediaSliderThumb, o, paintInfo, r);
}
bool RenderThemeWin::paintMediaToggleClosedCaptionsButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r)
{
return RenderMediaControls::paintMediaControlsPart(MediaShowClosedCaptionsButton, o, paintInfo, r);
}
#endif
}
......@@ -125,6 +125,7 @@ public:
virtual bool supportsFocusRing(const RenderStyle*) const;
#if ENABLE(VIDEO)
virtual bool shouldRenderMediaControlPart(ControlPart, Element*);
virtual bool paintMediaFullscreenButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
virtual bool paintMediaPlayButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
virtual bool paintMediaMuteButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
......@@ -132,6 +133,7 @@ public:
virtual bool paintMediaSeekForwardButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
virtual bool paintMediaSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
virtual bool paintMediaSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
virtual bool paintMediaToggleClosedCaptionsButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
#endif
private:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment