• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2007, 2008, 2009, 2010 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 QTMovie_h
27 #define QTMovie_h
28 
29 #include "QTTrack.h"
30 #include <WTF/Vector.h>
31 
32 #ifdef QTMOVIEWIN_EXPORTS
33 #define QTMOVIEWIN_API __declspec(dllexport)
34 #else
35 #define QTMOVIEWIN_API __declspec(dllimport)
36 #endif
37 
38 class QTMovie;
39 class QTMoviePrivate;
40 typedef struct MovieType** Movie;
41 typedef Vector<RefPtr<QTTrack>> QTTrackArray;
42 
43 class QTMovieClient {
44 public:
45     virtual void movieEnded(QTMovie*) = 0;
46     virtual void movieLoadStateChanged(QTMovie*) = 0;
47     virtual void movieTimeChanged(QTMovie*) = 0;
48 };
49 
50 enum {
51     QTMovieLoadStateError = -1L,
52     QTMovieLoadStateLoaded  = 2000L,
53     QTMovieLoadStatePlayable = 10000L,
54     QTMovieLoadStatePlaythroughOK = 20000L,
55     QTMovieLoadStateComplete = 100000L
56 };
57 
58 typedef const struct __CFURL * CFURLRef;
59 
60 class QTMOVIEWIN_API QTMovie : public RefCounted<QTMovie> {
61 public:
62     static bool initializeQuickTime();
63     static void taskTimerFired();
64 
65     static void disableComponent(uint32_t[5]);
66 
67     QTMovie(QTMovieClient*);
68     ~QTMovie();
69 
70     void addClient(QTMovieClient*);
71     void removeClient(QTMovieClient*);
72 
73     void loadPath(const UChar* url, int len, bool preservesPitch);
74     void load(const UChar* url, int len, bool preservesPitch);
75     void load(CFURLRef, bool preservesPitch);
76 
77     long loadState() const;
78     float maxTimeLoaded() const;
79 
80     void play();
81     void pause();
82 
83     float rate() const;
84     void setRate(float);
85 
86     float duration() const;
87     float currentTime() const;
88     void setCurrentTime(float) const;
89 
90     void setVolume(float);
91     void setPreservesPitch(bool);
92 
93     unsigned dataSize() const;
94 
95     void getNaturalSize(int& width, int& height);
96 
97     void disableUnsupportedTracks(unsigned& enabledTrackCount, unsigned& totalTrackCount);
98 
99     bool isDisabled() const;
100     void setDisabled(bool);
101 
102     bool hasVideo() const;
103     bool hasAudio() const;
104 
105     QTTrackArray videoTracks() const;
106 
107     bool hasClosedCaptions() const;
108     void setClosedCaptionsVisible(bool);
109 
110     static unsigned countSupportedTypes();
111     static void getSupportedType(unsigned index, const UChar*& str, unsigned& len);
112 
113     CGAffineTransform getTransform() const;
114     void setTransform(CGAffineTransform);
115     void resetTransform();
116 
117     Movie getMovieHandle() const;
118 
119     long timeScale() const;
120 
121     void setPrivateBrowsingMode(bool);
122 
123 private:
124     QTMoviePrivate* m_private;
125     friend class QTMoviePrivate;
126 };
127 
128 #endif
129