Skip to content
  • jer.noble@apple.com's avatar
    [Mac] Add AudioTrack support to MediaPlayerPrivateAVFObC. · 876b8519
    jer.noble@apple.com authored
    https://bugs.webkit.org/show_bug.cgi?id=122043
    
    Reviewed by Eric Carlson.
    
    Source/WebCore:
    
    Test: media/track/audio-track.html
    
    Add a new class AudioTrackPrivateAVF and subclass AudioTrackPrivateAVFObjC
    which are backed by a AVPlayerItemTrack. Create one of these tracks when
    we are notified that the list of available tracks has changed.
    
    * WebCore.xcodeproj/project.pbxproj:
    * html/track/AudioTrack.cpp:
    (WebCore::AudioTrack::setEnabled): Pass through to the AudioTrackPrivate
        so that the underlying media track can be (dis|en)abled.
    * platform/graphics/avfoundation/AudioTrackPrivateAVF.h: Added.
    (WebCore::AudioTrackPrivateAVF::kind): Simple getter.
    (WebCore::AudioTrackPrivateAVF::id): Ditto.
    (WebCore::AudioTrackPrivateAVF::label): Ditto.
    (WebCore::AudioTrackPrivateAVF::language): Ditto.
    (WebCore::AudioTrackPrivateAVF::setKind): Simple Setter.
    (WebCore::AudioTrackPrivateAVF::setId): Ditto.
    (WebCore::AudioTrackPrivateAVF::setLabel): Ditto.
    (WebCore::AudioTrackPrivateAVF::setLanguage): Ditto.
    (WebCore::AudioTrackPrivateAVF::AudioTrackPrivateAVF): Simple constructor.
    * platform/graphics/avfoundation/objc/AudioTrackPrivateAVFObjC.h: Added.
    (WebCore::AudioTrackPrivateAVFObjC::create): Simple factory.
    (WebCore::AudioTrackPrivateAVFObjC::playerItemTrack): Simple getter.
    * platform/graphics/avfoundation/objc/AudioTrackPrivateAVFObjC.mm: Added.
    (WebCore::AudioTrackPrivateAVFObjC::AudioTrackPrivateAVFObjC): Call resetPropertiesFromTrack.
    (WebCore::AudioTrackPrivateAVFObjC::resetPropertiesFromTrack): Fill out the values from
        the associated AVPlayerItemTrack and its AVAssetTrack.
    (WebCore::AudioTrackPrivateAVFObjC::setPlayerItemTrack): Call resetPropertiesFromTrack.
    (WebCore::AudioTrackPrivateAVFObjC::setEnabled): (En|Dis)able the AVPlayerItemTrack.
    (WebCore::AudioTrackPrivateAVFObjC::languageForAVAssetTrack): Refactored from
        MediaPlayerPrivateAVFoundationObjC::languageOfPrimaryAudioTrack.
    * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
    * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
    (WebCore::MediaPlayerPrivateAVFoundationObjC::tracksChanged): Determine which tracks
        have been added or removed and notify the clients accordingly.
    (WebCore::MediaPlayerPrivateAVFoundationObjC::languageOfPrimaryAudioTrack): Refactor into
        AudioTrackPrivateAVFObjC::languageForAVAssetTrack.
    
    LayoutTests:
    
    * media/track/audio-track-expected.txt: Added.
    * media/track/audio-track.html: Added.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156652 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    876b8519