OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 | 46 |
47 static PassRefPtr<VideoLayerChromium> create(GraphicsLayerChromium* owner =
0, | 47 static PassRefPtr<VideoLayerChromium> create(GraphicsLayerChromium* owner =
0, |
48 VideoFrameProvider* = 0); | 48 VideoFrameProvider* = 0); |
49 virtual ~VideoLayerChromium(); | 49 virtual ~VideoLayerChromium(); |
50 | 50 |
51 virtual PassRefPtr<CCLayerImpl> createCCLayerImpl(); | 51 virtual PassRefPtr<CCLayerImpl> createCCLayerImpl(); |
52 | 52 |
53 virtual void updateCompositorResources(GraphicsContext3D*); | 53 virtual void updateCompositorResources(GraphicsContext3D*); |
54 virtual bool drawsContent() const { return true; } | 54 virtual bool drawsContent() const { return true; } |
55 | 55 |
56 // This function is called by VideoFrameProvider. When this method is called | 56 void releaseProvider(); |
57 // putCurrentFrame() must be called to return the frame currently held. | |
58 void releaseCurrentFrame(); | |
59 | 57 |
60 virtual void pushPropertiesTo(CCLayerImpl*); | 58 virtual void pushPropertiesTo(CCLayerImpl*); |
61 | 59 |
62 virtual void setLayerTreeHost(CCLayerTreeHost*); | 60 virtual void setLayerTreeHost(CCLayerTreeHost*); |
63 | 61 |
64 protected: | 62 protected: |
65 virtual void cleanupResources(); | 63 virtual void cleanupResources(); |
66 virtual const char* layerTypeAsString() const { return "VideoLayer"; } | 64 virtual const char* layerTypeAsString() const { return "VideoLayer"; } |
67 | 65 |
68 private: | 66 private: |
69 struct Texture { | 67 struct Texture { |
70 IntSize m_visibleSize; | 68 IntSize m_visibleSize; |
71 OwnPtr<ManagedTexture> m_texture; | 69 OwnPtr<ManagedTexture> m_texture; |
72 }; | 70 }; |
73 | 71 |
74 VideoLayerChromium(GraphicsLayerChromium* owner, VideoFrameProvider*); | 72 VideoLayerChromium(GraphicsLayerChromium* owner, VideoFrameProvider*); |
75 | 73 |
76 static GC3Denum determineTextureFormat(const VideoFrameChromium*); | 74 static GC3Denum determineTextureFormat(const VideoFrameChromium*); |
77 static IntSize computeVisibleSize(const VideoFrameChromium*, unsigned plane)
; | 75 static IntSize computeVisibleSize(const VideoFrameChromium*, unsigned plane)
; |
78 bool reserveTextures(const VideoFrameChromium*, GC3Denum textureFormat); | 76 bool reserveTextures(const VideoFrameChromium*, GC3Denum textureFormat); |
79 void updateTexture(GraphicsContext3D*, Texture&, const void*) const; | 77 void updateTexture(GraphicsContext3D*, Texture&, const void*) const; |
80 | 78 |
81 void resetFrameParameters(); | 79 void resetFrameParameters(); |
82 | 80 |
83 bool m_skipsDraw; | 81 bool m_skipsDraw; |
84 VideoFrameChromium::Format m_frameFormat; | 82 VideoFrameChromium::Format m_frameFormat; |
85 VideoFrameProvider* m_provider; | 83 VideoFrameProvider* m_provider; |
86 | 84 |
87 Texture m_textures[3]; | 85 Texture m_textures[3]; |
88 | |
89 // This will be null for the entire duration of video playback if hardware | |
90 // decoding is not being used. | |
91 VideoFrameChromium* m_currentFrame; | |
92 }; | 86 }; |
93 | 87 |
94 } | 88 } |
95 #endif // USE(ACCELERATED_COMPOSITING) | 89 #endif // USE(ACCELERATED_COMPOSITING) |
96 | 90 |
97 #endif | 91 #endif |
OLD | NEW |