Fix the issue that short black glitch when switching bandwidth.
[framework/web/webkit-efl.git] / Source / WebCore / platform / graphics / gstreamer / tizen / SharedVideoPlatformSurfaceTizen.h
1 /*
2     Copyright (C) 2012 Samsung Electronics.
3
4     This library is free software; you can redistribute it and/or
5     modify it under the terms of the GNU Library General Public
6     License as published by the Free Software Foundation; either
7     version 2.1 of the License, or (at your option) any later version.
8
9     This library is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12     Library General Public License for more details.
13
14     You should have received a copy of the GNU Library General Public License
15     along with this library; see the file COPYING.LIB.  If not, write to
16     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17     Boston, MA 02110-1301, USA.
18 */
19
20 #ifndef SharedVideoPlatformSurfaceTizen_h
21 #define SharedVideoPlatformSurfaceTizen_h
22
23 #if ENABLE(TIZEN_WEBKIT2_TILED_AC_SHARED_PLATFORM_SURFACE)
24
25 #include "IntSize.h"
26 #include <Ecore.h>
27 #include <Ecore_X.h>
28 #include <wtf/OwnPtr.h>
29 #include <wtf/PassOwnPtr.h>
30
31 namespace WebCore {
32
33 class GraphicsContext;
34 class IntRect;
35 class VideoPlatformSurface;
36
37 class VideoPlatformSurfaceUpdateListener {
38 public:
39     virtual void platformSurfaceUpdated() = 0;
40 };
41
42 class SharedVideoPlatformSurfaceTizen {
43 public:
44     static PassOwnPtr<SharedVideoPlatformSurfaceTizen> create(IntSize size);
45     ~SharedVideoPlatformSurfaceTizen();
46
47     int id() const;
48     void platformSurfaceUpdated();
49     void setVideoPlatformSurfaceUpdateListener(VideoPlatformSurfaceUpdateListener* listener);
50     void paintCurrentFrameInContext(GraphicsContext*, const IntRect&);
51     void copySurface(SharedVideoPlatformSurfaceTizen*);
52     int graphicsSurfaceFlags() const;
53
54 private:
55     SharedVideoPlatformSurfaceTizen(IntSize size);
56
57     void registerDamageHandler();
58     void unregisterDamageHandler();
59
60     Ecore_X_Damage m_damage;
61     Ecore_Event_Handler* m_damageHandler;
62     VideoPlatformSurfaceUpdateListener* m_listener;
63     OwnPtr<VideoPlatformSurface> m_platformSurface;
64     int m_flags;
65 };
66
67 } // WebCore
68
69 #endif // ENABLE(TIZEN_WEBKIT2_TILED_AC_SHARED_PLATFORM_SURFACE)
70
71 #endif // SharedVideoPlatformSurfaceTizen_h