Diff
Modified: trunk/Source/WebCore/ChangeLog (161611 => 161612)
--- trunk/Source/WebCore/ChangeLog 2014-01-10 01:45:16 UTC (rev 161611)
+++ trunk/Source/WebCore/ChangeLog 2014-01-10 01:49:21 UTC (rev 161612)
@@ -1,3 +1,27 @@
+2014-01-08 Jer Noble <jer.no...@apple.com>
+
+ [MSE][Mac] Report the intrinsic size of the media element
+ https://bugs.webkit.org/show_bug.cgi?id=125156
+
+ Reviewed by Eric Carlson.
+
+ * WebCore.xcodeproj/project.pbxproj:
+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
+ (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::naturalSize): Pass to MediaSourcePrivateAVFObjC.
+ (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::sizeChanged): Added; Pass to MediaPlayer.
+ * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.h:
+ * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm:
+ (WebCore::MediaSourcePrivateAVFObjC::naturalSize): Return the union of the naturalSizes of all active buffers.
+ * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
+ * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
+ (WebCore::SourceBufferPrivateAVFObjC::didParseStreamDataAsAsset): Notify the media player that the size changed.
+ (WebCore::SourceBufferPrivateAVFObjC::naturalSize): Return the size of the selected video track.
+ * platform/graphics/avfoundation/objc/VideoTrackPrivateMediaSourceAVFObjC.h:
+ * platform/graphics/avfoundation/objc/VideoTrackPrivateMediaSourceAVFObjC.mm: Renamed from Source/WebCore/platform/graphics/avfoundation/objc/VideoTrackPrivateMediaSourceAVFObjC.cpp.
+ (WebCore::VideoTrackPrivateMediaSourceAVFObjC::assetTrack): Made const.
+ (WebCore::VideoTrackPrivateMediaSourceAVFObjC::naturalSize): Return the size of the AVAssetTrack.
+
2014-01-09 Joseph Pecoraro <pecor...@apple.com>
Unreviewed Windows build fix for r161563.
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (161611 => 161612)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2014-01-10 01:45:16 UTC (rev 161611)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2014-01-10 01:49:21 UTC (rev 161612)
@@ -5472,7 +5472,7 @@
CD82030D1395AB6A00F956C6 /* WebVideoFullscreenHUDWindowController.mm in Sources */ = {isa = PBXBuildFile; fileRef = CD8203091395AB6A00F956C6 /* WebVideoFullscreenHUDWindowController.mm */; };
CD8203101395ACE700F956C6 /* WebWindowAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = CD82030E1395ACE700F956C6 /* WebWindowAnimation.h */; settings = {ATTRIBUTES = (Private, ); }; };
CD8203111395ACE700F956C6 /* WebWindowAnimation.mm in Sources */ = {isa = PBXBuildFile; fileRef = CD82030F1395ACE700F956C6 /* WebWindowAnimation.mm */; };
- CD8B5A42180D149A008B8E65 /* VideoTrackPrivateMediaSourceAVFObjC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD8B5A40180D149A008B8E65 /* VideoTrackPrivateMediaSourceAVFObjC.cpp */; };
+ CD8B5A42180D149A008B8E65 /* VideoTrackPrivateMediaSourceAVFObjC.mm in Sources */ = {isa = PBXBuildFile; fileRef = CD8B5A40180D149A008B8E65 /* VideoTrackPrivateMediaSourceAVFObjC.mm */; };
CD8B5A43180D149A008B8E65 /* VideoTrackPrivateMediaSourceAVFObjC.h in Headers */ = {isa = PBXBuildFile; fileRef = CD8B5A41180D149A008B8E65 /* VideoTrackPrivateMediaSourceAVFObjC.h */; };
CD8B5A46180DFF4E008B8E65 /* VideoTrackMediaSource.h in Headers */ = {isa = PBXBuildFile; fileRef = CD8B5A45180DFF4E008B8E65 /* VideoTrackMediaSource.h */; };
CD8B5A49180E138B008B8E65 /* TextTrackMediaSource.h in Headers */ = {isa = PBXBuildFile; fileRef = CD8B5A48180E138B008B8E65 /* TextTrackMediaSource.h */; };
@@ -12697,7 +12697,7 @@
CD8203091395AB6A00F956C6 /* WebVideoFullscreenHUDWindowController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebVideoFullscreenHUDWindowController.mm; sourceTree = "<group>"; };
CD82030E1395ACE700F956C6 /* WebWindowAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebWindowAnimation.h; sourceTree = "<group>"; };
CD82030F1395ACE700F956C6 /* WebWindowAnimation.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebWindowAnimation.mm; sourceTree = "<group>"; };
- CD8B5A40180D149A008B8E65 /* VideoTrackPrivateMediaSourceAVFObjC.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = VideoTrackPrivateMediaSourceAVFObjC.cpp; path = objc/VideoTrackPrivateMediaSourceAVFObjC.cpp; sourceTree = "<group>"; };
+ CD8B5A40180D149A008B8E65 /* VideoTrackPrivateMediaSourceAVFObjC.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = VideoTrackPrivateMediaSourceAVFObjC.mm; path = objc/VideoTrackPrivateMediaSourceAVFObjC.mm; sourceTree = "<group>"; };
CD8B5A41180D149A008B8E65 /* VideoTrackPrivateMediaSourceAVFObjC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VideoTrackPrivateMediaSourceAVFObjC.h; path = objc/VideoTrackPrivateMediaSourceAVFObjC.h; sourceTree = "<group>"; };
CD8B5A44180DD8D6008B8E65 /* VideoTrackMediaSource.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = VideoTrackMediaSource.idl; sourceTree = "<group>"; };
CD8B5A45180DFF4E008B8E65 /* VideoTrackMediaSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoTrackMediaSource.h; sourceTree = "<group>"; };
@@ -20952,7 +20952,7 @@
CDC8B5A818047FF10016E685 /* SourceBufferPrivateAVFObjC.mm */,
CD336F6517FA0AC600DDDCD0 /* VideoTrackPrivateAVFObjC.cpp */,
CD336F6617FA0AC600DDDCD0 /* VideoTrackPrivateAVFObjC.h */,
- CD8B5A40180D149A008B8E65 /* VideoTrackPrivateMediaSourceAVFObjC.cpp */,
+ CD8B5A40180D149A008B8E65 /* VideoTrackPrivateMediaSourceAVFObjC.mm */,
CD8B5A41180D149A008B8E65 /* VideoTrackPrivateMediaSourceAVFObjC.h */,
CD7E05201651A84100C1201F /* WebCoreAVFResourceLoader.h */,
CD7E05211651A84100C1201F /* WebCoreAVFResourceLoader.mm */,
@@ -26877,7 +26877,7 @@
07969DB917D14151007FF842 /* JSRTCPeerConnection.cpp in Sources */,
E0FEF372B27C53EAC1C1FBEE /* EventSource.cpp in Sources */,
E12EDBEA0B308E0B002704B6 /* EventTarget.cpp in Sources */,
- CD8B5A42180D149A008B8E65 /* VideoTrackPrivateMediaSourceAVFObjC.cpp in Sources */,
+ CD8B5A42180D149A008B8E65 /* VideoTrackPrivateMediaSourceAVFObjC.mm in Sources */,
BC60D8F20D2A11E000B9918F /* ExceptionBase.cpp in Sources */,
973DC63F145A9409002842C2 /* ExceptionCodeDescription.cpp in Sources */,
A7CACDB113CE875C00BBBE3F /* ExceptionCodePlaceholder.cpp in Sources */,
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h (161611 => 161612)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h 2014-01-10 01:45:16 UTC (rev 161611)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h 2014-01-10 01:49:21 UTC (rev 161612)
@@ -69,6 +69,7 @@
void durationChanged();
void effectiveRateChanged();
+ void sizeChanged();
private:
// MediaPlayerPrivateInterface
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm (161611 => 161612)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm 2014-01-10 01:45:16 UTC (rev 161611)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm 2014-01-10 01:49:21 UTC (rev 161612)
@@ -303,8 +303,7 @@
IntSize MediaPlayerPrivateMediaSourceAVFObjC::naturalSize() const
{
- // FIXME(125156): Report the intrinsic size of the enabled video track.
- return IntSize();
+ return m_mediaSourcePrivate->naturalSize();
}
bool MediaPlayerPrivateMediaSourceAVFObjC::hasVideo() const
@@ -520,6 +519,11 @@
m_player->rateChanged();
}
+void MediaPlayerPrivateMediaSourceAVFObjC::sizeChanged()
+{
+ m_player->sizeChanged();
+}
+
void MediaPlayerPrivateMediaSourceAVFObjC::setReadyState(MediaPlayer::ReadyState readyState)
{
if (m_readyState == readyState)
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.h (161611 => 161612)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.h 2014-01-10 01:45:16 UTC (rev 161611)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.h 2014-01-10 01:49:21 UTC (rev 161612)
@@ -66,6 +66,7 @@
bool hasVideo() const;
MediaTime seekToTime(MediaTime, MediaTime negativeThreshold, MediaTime positiveThreshold);
+ IntSize naturalSize() const;
private:
MediaSourcePrivateAVFObjC(MediaPlayerPrivateMediaSourceAVFObjC*);
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm (161611 => 161612)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm 2014-01-10 01:45:16 UTC (rev 161611)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm 2014-01-10 01:49:21 UTC (rev 161612)
@@ -174,6 +174,16 @@
return seekTime;
}
+IntSize MediaSourcePrivateAVFObjC::naturalSize() const
+{
+ IntSize result;
+
+ for (auto* sourceBuffer : m_activeSourceBuffers)
+ result = result.expandedTo(sourceBuffer->naturalSize());
+
+ return result;
}
+}
+
#endif // ENABLE(MEDIA_SOURCE) && USE(AVFOUNDATION)
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h (161611 => 161612)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h 2014-01-10 01:45:16 UTC (rev 161611)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h 2014-01-10 01:49:21 UTC (rev 161612)
@@ -79,6 +79,7 @@
void seekToTime(MediaTime);
MediaTime fastSeekTimeForMediaTime(MediaTime, MediaTime negativeThreshold, MediaTime positiveThreshold);
+ IntSize naturalSize();
private:
explicit SourceBufferPrivateAVFObjC(MediaSourcePrivateAVFObjC*);
@@ -104,8 +105,8 @@
void didBecomeReadyForMoreSamples(int trackID);
void destroyRenderers();
- Vector<RefPtr<VideoTrackPrivate>> m_videoTracks;
- Vector<RefPtr<AudioTrackPrivate>> m_audioTracks;
+ Vector<RefPtr<VideoTrackPrivateMediaSourceAVFObjC>> m_videoTracks;
+ Vector<RefPtr<AudioTrackPrivateMediaSourceAVFObjC>> m_audioTracks;
RetainPtr<AVStreamDataParser> m_parser;
RetainPtr<AVAsset> m_asset;
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm (161611 => 161612)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm 2014-01-10 01:45:16 UTC (rev 161611)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm 2014-01-10 01:49:21 UTC (rev 161612)
@@ -319,18 +319,25 @@
m_asset = asset;
+ m_videoTracks.clear();
+ m_audioTracks.clear();
+
SourceBufferPrivateClient::InitializationSegment segment;
segment.duration = toMediaTime([m_asset duration]);
for (AVAssetTrack* track in [m_asset tracks]) {
if ([track hasMediaCharacteristic:AVMediaCharacteristicVisual]) {
SourceBufferPrivateClient::InitializationSegment::VideoTrackInformation info;
- info.track = VideoTrackPrivateMediaSourceAVFObjC::create(track, this);
+ RefPtr<VideoTrackPrivateMediaSourceAVFObjC> videoTrack = VideoTrackPrivateMediaSourceAVFObjC::create(track, this);
+ info.track = videoTrack;
+ m_videoTracks.append(videoTrack);
info.description = MediaDescriptionAVFObjC::create(track);
segment.videoTracks.append(info);
} else if ([track hasMediaCharacteristic:AVMediaCharacteristicAudible]) {
SourceBufferPrivateClient::InitializationSegment::AudioTrackInformation info;
- info.track = AudioTrackPrivateMediaSourceAVFObjC::create(track, this);
+ RefPtr<AudioTrackPrivateMediaSourceAVFObjC> audioTrack = AudioTrackPrivateMediaSourceAVFObjC::create(track, this);
+ info.track = audioTrack;
+ m_audioTracks.append(audioTrack);
info.description = MediaDescriptionAVFObjC::create(track);
segment.audioTracks.append(info);
}
@@ -338,6 +345,9 @@
// FIXME(125161): Add TextTrack support
}
+ if (!m_videoTracks.isEmpty())
+ m_mediaSource->player()->sizeChanged();
+
if (m_client)
m_client->sourceBufferPrivateDidReceiveInitializationSegment(this, segment);
}
@@ -633,6 +643,16 @@
m_client->sourceBufferPrivateSeekToTime(this, time);
}
+IntSize SourceBufferPrivateAVFObjC::naturalSize()
+{
+ for (auto videoTrack : m_videoTracks) {
+ if (videoTrack->selected())
+ return videoTrack->naturalSize();
+ }
+
+ return IntSize();
+}
+
void SourceBufferPrivateAVFObjC::didBecomeReadyForMoreSamples(int trackID)
{
if (trackID == m_enabledVideoTrackID)
Deleted: trunk/Source/WebCore/platform/graphics/avfoundation/objc/VideoTrackPrivateMediaSourceAVFObjC.cpp (161611 => 161612)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/VideoTrackPrivateMediaSourceAVFObjC.cpp 2014-01-10 01:45:16 UTC (rev 161611)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/VideoTrackPrivateMediaSourceAVFObjC.cpp 2014-01-10 01:49:21 UTC (rev 161612)
@@ -1,83 +0,0 @@
-/*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "VideoTrackPrivateMediaSourceAVFObjC.h"
-
-#if ENABLE(MEDIA_SOURCE) && ENABLE(VIDEO_TRACK)
-
-#include "AVTrackPrivateAVFObjCImpl.h"
-#include "SourceBufferPrivateAVFObjC.h"
-
-namespace WebCore {
-
-VideoTrackPrivateMediaSourceAVFObjC::VideoTrackPrivateMediaSourceAVFObjC(AVAssetTrack* track, SourceBufferPrivateAVFObjC* parent)
- : m_impl(std::make_unique<AVTrackPrivateAVFObjCImpl>(track))
- , m_parent(parent)
- , m_trackID(-1)
- , m_selected(false)
-{
- resetPropertiesFromTrack();
-}
-
-void VideoTrackPrivateMediaSourceAVFObjC::resetPropertiesFromTrack()
-{
- m_trackID = m_impl->trackID();
-
- setKind(m_impl->videoKind());
- setId(m_impl->id());
- setLabel(m_impl->label());
- setLanguage(m_impl->language());
-}
-
-void VideoTrackPrivateMediaSourceAVFObjC::setAssetTrack(AVAssetTrack *track)
-{
- m_impl = std::make_unique<AVTrackPrivateAVFObjCImpl>(track);
- resetPropertiesFromTrack();
-}
-
-AVAssetTrack* VideoTrackPrivateMediaSourceAVFObjC::assetTrack()
-{
- return m_impl->assetTrack();
-}
-
-
-bool VideoTrackPrivateMediaSourceAVFObjC::selected() const
-{
- return m_selected;
-}
-
-void VideoTrackPrivateMediaSourceAVFObjC::setSelected(bool selected)
-{
- if (m_selected == selected)
- return;
-
- m_selected = selected;
- m_parent->trackDidChangeEnabled(this);
-}
-
-}
-
-#endif
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/VideoTrackPrivateMediaSourceAVFObjC.h (161611 => 161612)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/VideoTrackPrivateMediaSourceAVFObjC.h 2014-01-10 01:45:16 UTC (rev 161611)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/VideoTrackPrivateMediaSourceAVFObjC.h 2014-01-10 01:49:21 UTC (rev 161612)
@@ -26,6 +26,7 @@
#ifndef VideoTrackPrivateMediaSourceAVFObjC_h
#define VideoTrackPrivateMediaSourceAVFObjC_h
+#include "IntSize.h"
#include "VideoTrackPrivateAVF.h"
#if ENABLE(MEDIA_SOURCE) && ENABLE(VIDEO_TRACK)
@@ -50,10 +51,12 @@
virtual void setSelected(bool) OVERRIDE;
void setAssetTrack(AVAssetTrack*);
- AVAssetTrack* assetTrack();
+ AVAssetTrack* assetTrack() const;
int trackID() { return m_trackID; }
+ IntSize naturalSize() const;
+
private:
explicit VideoTrackPrivateMediaSourceAVFObjC(AVAssetTrack*, SourceBufferPrivateAVFObjC* parent);
Copied: trunk/Source/WebCore/platform/graphics/avfoundation/objc/VideoTrackPrivateMediaSourceAVFObjC.mm (from rev 161611, trunk/Source/WebCore/platform/graphics/avfoundation/objc/VideoTrackPrivateMediaSourceAVFObjC.cpp) (0 => 161612)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/VideoTrackPrivateMediaSourceAVFObjC.mm (rev 0)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/VideoTrackPrivateMediaSourceAVFObjC.mm 2014-01-10 01:49:21 UTC (rev 161612)
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "VideoTrackPrivateMediaSourceAVFObjC.h"
+
+#if ENABLE(MEDIA_SOURCE) && ENABLE(VIDEO_TRACK)
+
+#import "AVTrackPrivateAVFObjCImpl.h"
+#import "SourceBufferPrivateAVFObjC.h"
+#import <AVFoundation/AVAssetTrack.h>
+
+namespace WebCore {
+
+VideoTrackPrivateMediaSourceAVFObjC::VideoTrackPrivateMediaSourceAVFObjC(AVAssetTrack* track, SourceBufferPrivateAVFObjC* parent)
+ : m_impl(std::make_unique<AVTrackPrivateAVFObjCImpl>(track))
+ , m_parent(parent)
+ , m_trackID(-1)
+ , m_selected(false)
+{
+ resetPropertiesFromTrack();
+}
+
+void VideoTrackPrivateMediaSourceAVFObjC::resetPropertiesFromTrack()
+{
+ m_trackID = m_impl->trackID();
+
+ setKind(m_impl->videoKind());
+ setId(m_impl->id());
+ setLabel(m_impl->label());
+ setLanguage(m_impl->language());
+}
+
+void VideoTrackPrivateMediaSourceAVFObjC::setAssetTrack(AVAssetTrack *track)
+{
+ m_impl = std::make_unique<AVTrackPrivateAVFObjCImpl>(track);
+ resetPropertiesFromTrack();
+}
+
+AVAssetTrack* VideoTrackPrivateMediaSourceAVFObjC::assetTrack() const
+{
+ return m_impl->assetTrack();
+}
+
+
+bool VideoTrackPrivateMediaSourceAVFObjC::selected() const
+{
+ return m_selected;
+}
+
+void VideoTrackPrivateMediaSourceAVFObjC::setSelected(bool selected)
+{
+ if (m_selected == selected)
+ return;
+
+ m_selected = selected;
+ m_parent->trackDidChangeEnabled(this);
+}
+
+IntSize VideoTrackPrivateMediaSourceAVFObjC::naturalSize() const
+{
+ return IntSize([assetTrack() naturalSize]);
+}
+
+}
+
+#endif