Changeset 166268 in webkit


Ignore:
Timestamp:
Mar 25, 2014 4:43:13 PM (10 years ago)
Author:
jer.noble@apple.com
Message:

[iOS] Enable caption support in full screen.
https://bugs.webkit.org/show_bug.cgi?id=130603

Reviewed by Eric Carlson.

Add TextTrackRepresentation support to MediaPlayerPrivateAVFoundationObjC.

  • platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
  • platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:

(WebCore::MediaPlayerPrivateAVFoundationObjC::createVideoLayer): Add the m_textTrackRepresenationLayer if present.
(WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenLayer): Ditto.
(WebCore::MediaPlayerPrivateAVFoundationObjC::requiresTextTrackRepresentation): True, if a m_videoFullscreenLayer is present.
(WebCore::MediaPlayerPrivateAVFoundationObjC::setTextTrackRepresentation): Remove the old, and add the new m_textTrackRepresenationLayer.

Make the text track container a stacking context for painting purposes.

  • Modules/mediacontrols/mediaControlsiOS.css:

(video::-webkit-media-text-track-container):

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r166264 r166268  
     12014-03-21  Jer Noble  <jer.noble@apple.com>
     2
     3        [iOS] Enable caption support in full screen.
     4        https://bugs.webkit.org/show_bug.cgi?id=130603
     5
     6        Reviewed by Eric Carlson.
     7
     8        Add TextTrackRepresentation support to MediaPlayerPrivateAVFoundationObjC.
     9
     10        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
     11        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
     12        (WebCore::MediaPlayerPrivateAVFoundationObjC::createVideoLayer): Add the m_textTrackRepresenationLayer if present.
     13        (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenLayer): Ditto.
     14        (WebCore::MediaPlayerPrivateAVFoundationObjC::requiresTextTrackRepresentation): True, if a m_videoFullscreenLayer is present.
     15        (WebCore::MediaPlayerPrivateAVFoundationObjC::setTextTrackRepresentation): Remove the old, and add the new m_textTrackRepresenationLayer.
     16
     17        Make the text track container a stacking context for painting purposes.
     18        * Modules/mediacontrols/mediaControlsiOS.css:
     19        (video::-webkit-media-text-track-container):
     20
    1212014-03-25  Brian Burg  <bburg@apple.com>
    222
  • trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.css

    r165676 r166268  
    296296    overflow: hidden;
    297297    padding-bottom: 5px;
     298    z-index: 0;
    298299
    299300    text-align: center;
  • trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h

    r165676 r166268  
    191191
    192192    virtual bool hasSingleSecurityOrigin() const;
    193    
     193
     194#if ENABLE(VIDEO_TRACK)
     195    virtual bool requiresTextTrackRepresentation() const override;
     196    virtual void setTextTrackRepresentation(TextTrackRepresentation*) override;
     197#endif
     198
    194199    void createImageGenerator();
    195200    void destroyImageGenerator();
     
    255260    FloatRect m_videoFullscreenFrame;
    256261    MediaPlayer::VideoGravity m_videoFullscreenGravity;
     262    RetainPtr<PlatformLayer> m_textTrackRepresentationLayer;
    257263#endif
    258264    RetainPtr<WebCoreAVFMovieObserver> m_objcObserver;
  • trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm

    r166256 r166268  
    4949#import "SecurityOrigin.h"
    5050#import "SoftLinking.h"
     51#import "TextTrackRepresentation.h"
    5152#import "UUID.h"
    5253#import "VideoTrackPrivateAVFObjC.h"
     
    512513        if (m_videoFullscreenLayer) {
    513514            [m_videoLayer setFrame:CGRectMake(0, 0, m_videoFullscreenFrame.width(), m_videoFullscreenFrame.height())];
    514             [m_videoFullscreenLayer addSublayer:m_videoLayer.get()];
     515            [m_videoFullscreenLayer insertSublayer:m_videoLayer.get() atIndex:0];
    515516        }
    516517#endif
     
    800801    m_videoFullscreenLayer = videoFullscreenLayer;
    801802
    802     if (!m_videoFullscreenLayer || !m_videoLayer)
    803         return;
    804 
    805     [m_videoLayer setFrame:CGRectMake(0, 0, m_videoFullscreenFrame.width(), m_videoFullscreenFrame.height())];
    806     [m_videoFullscreenLayer addSublayer:m_videoLayer.get()];
     803    CGRect frame = CGRectMake(0, 0, m_videoFullscreenFrame.width(), m_videoFullscreenFrame.height());
     804
     805    if (m_videoFullscreenLayer && m_videoLayer) {
     806        [m_videoLayer setFrame:frame];
     807        [m_videoFullscreenLayer insertSublayer:m_videoLayer.get() atIndex:0];
     808    }
     809
     810    if (m_videoFullscreenLayer && m_textTrackRepresentationLayer) {
     811        CGRect textFrame = m_videoLayer ? [m_videoLayer videoRect] : frame;
     812        [m_textTrackRepresentationLayer setFrame:textFrame];
     813        [m_videoFullscreenLayer addSublayer:m_textTrackRepresentationLayer.get()];
     814    }
    807815}
    808816
     
    810818{
    811819    m_videoFullscreenFrame = frame;
    812     if (!m_videoFullscreenLayer || !m_videoLayer)
    813         return;
    814    
    815     [m_videoLayer setFrame:CGRectMake(0, 0, frame.width(), frame.height())];
     820    if (!m_videoFullscreenLayer)
     821        return;
     822
     823    if (m_videoLayer)
     824        [m_videoLayer setFrame:CGRectMake(0, 0, frame.width(), frame.height())];
     825
     826    if (m_textTrackRepresentationLayer) {
     827        CGRect textFrame = m_videoLayer ? [m_videoLayer videoRect] : static_cast<CGRect>(frame);
     828        [m_textTrackRepresentationLayer setFrame:textFrame];
     829    }
    816830}
    817831
     
    14661480{
    14671481    determineChangedTracksFromNewTracksAndOldItems(m_cachedTracks.get(), AVMediaTypeVideo, m_videoTracks, &VideoTrackPrivateAVFObjC::create, player(), &MediaPlayer::removeVideoTrack, &MediaPlayer::addVideoTrack);
     1482}
     1483
     1484bool MediaPlayerPrivateAVFoundationObjC::requiresTextTrackRepresentation() const
     1485{
     1486#if PLATFORM(IOS)
     1487    if (m_videoFullscreenLayer)
     1488        return true;
     1489#endif
     1490    return false;
     1491}
     1492
     1493void MediaPlayerPrivateAVFoundationObjC::setTextTrackRepresentation(TextTrackRepresentation* representation)
     1494{
     1495#if PLATFORM(IOS)
     1496    PlatformLayer* representationLayer = representation ? representation->platformLayer() : nil;
     1497    if (representationLayer == m_textTrackRepresentationLayer)
     1498        return;
     1499
     1500    if (m_textTrackRepresentationLayer)
     1501        [m_textTrackRepresentationLayer removeFromSuperlayer];
     1502
     1503    m_textTrackRepresentationLayer = representationLayer;
     1504
     1505    if (m_videoFullscreenLayer && m_textTrackRepresentationLayer) {
     1506        CGRect textFrame = m_videoLayer ? [m_videoLayer videoRect] : CGRectMake(0, 0, m_videoFullscreenFrame.width(), m_videoFullscreenFrame.height());
     1507
     1508        [m_textTrackRepresentationLayer setFrame:textFrame];
     1509        [m_videoFullscreenLayer addSublayer:m_textTrackRepresentationLayer.get()];
     1510    }
     1511
     1512#else
     1513    UNUSED_PARAM(representation);
     1514#endif
    14681515}
    14691516#endif // ENABLE(VIDEO_TRACK)
Note: See TracChangeset for help on using the changeset viewer.