1/* 2 * Copyright (C) 2011, 2013 Apple Inc. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. 9 * 2. Redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution. 12 * 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25 26#ifndef MediaPlayerPrivateAVFoundationCF_h 27#define MediaPlayerPrivateAVFoundationCF_h 28 29#if PLATFORM(WIN) && ENABLE(VIDEO) && USE(AVFOUNDATION) 30 31#include "MediaPlayerPrivateAVFoundation.h" 32 33namespace WebCore { 34 35class AVFWrapper; 36 37class MediaPlayerPrivateAVFoundationCF : public MediaPlayerPrivateAVFoundation { 38public: 39 virtual ~MediaPlayerPrivateAVFoundationCF(); 40 41 virtual void tracksChanged() OVERRIDE; 42 43 static void registerMediaEngine(MediaEngineRegistrar); 44 45private: 46 MediaPlayerPrivateAVFoundationCF(MediaPlayer*); 47 48 // Engine support 49 static PassOwnPtr<MediaPlayerPrivateInterface> create(MediaPlayer*); 50 static void getSupportedTypes(HashSet<String>& types); 51 static MediaPlayer::SupportsType supportsType(const String& type, const String& codecs, const KURL&); 52 static bool isAvailable(); 53 54 virtual void cancelLoad(); 55 56 virtual PlatformMedia platformMedia() const; 57 58 virtual void platformSetVisible(bool); 59 virtual void platformPlay(); 60 virtual void platformPause(); 61 virtual float currentTime() const; 62 virtual void setVolume(float); 63 virtual void setClosedCaptionsVisible(bool); 64 virtual void paint(GraphicsContext*, const IntRect&); 65 virtual void paintCurrentFrameInContext(GraphicsContext*, const IntRect&); 66 virtual PlatformLayer* platformLayer() const; 67 virtual bool supportsAcceleratedRendering() const { return true; } 68 virtual float mediaTimeForTimeValue(float) const; 69 70 virtual void createAVPlayer(); 71 virtual void createAVPlayerItem(); 72 virtual void createAVAssetForURL(const String& url); 73 virtual MediaPlayerPrivateAVFoundation::ItemStatus playerItemStatus() const; 74 virtual MediaPlayerPrivateAVFoundation::AssetStatus assetStatus() const; 75 76 virtual void checkPlayability(); 77 virtual void updateRate(); 78 virtual float rate() const; 79 virtual void seekToTime(double time); 80 virtual unsigned totalBytes() const; 81 virtual PassRefPtr<TimeRanges> platformBufferedTimeRanges() const; 82 virtual double platformMinTimeSeekable() const; 83 virtual double platformMaxTimeSeekable() const; 84 virtual float platformDuration() const; 85 virtual float platformMaxTimeLoaded() const; 86 virtual void beginLoadingMetadata(); 87 virtual void sizeChanged(); 88 virtual bool requiresImmediateCompositing() const OVERRIDE; 89 90 virtual bool hasAvailableVideoFrame() const; 91 92 virtual void createContextVideoRenderer(); 93 virtual void destroyContextVideoRenderer(); 94 95 virtual void createVideoLayer(); 96 virtual void destroyVideoLayer(); 97 98 virtual bool hasContextRenderer() const; 99 virtual bool hasLayerRenderer() const; 100 101 virtual void contentsNeedsDisplay(); 102 103 virtual String languageOfPrimaryAudioTrack() const OVERRIDE; 104 105#if HAVE(AVFOUNDATION_MEDIA_SELECTION_GROUP) 106 void processMediaSelectionOptions(); 107#endif 108 109 virtual void setCurrentTrack(InbandTextTrackPrivateAVF*) OVERRIDE; 110 virtual InbandTextTrackPrivateAVF* currentTrack() const OVERRIDE; 111 112#if !HAVE(AVFOUNDATION_LEGIBLE_OUTPUT_SUPPORT) 113 void processLegacyClosedCaptionsTracks(); 114#endif 115 116 friend class AVFWrapper; 117 AVFWrapper* m_avfWrapper; 118 119 mutable String m_languageOfPrimaryAudioTrack; 120 bool m_videoFrameHasDrawn; 121}; 122 123} 124 125#endif // PLATFORM(WIN) && ENABLE(VIDEO) && USE(AVFOUNDATION) 126#endif // MediaPlayerPrivateAVFoundationCF_h 127