• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef FRAMEWORKS_WM_INCLUDE_SUBWINDOW_VIDEO_IMPL_H
17 #define FRAMEWORKS_WM_INCLUDE_SUBWINDOW_VIDEO_IMPL_H
18 
19 #include <subwindow.h>
20 #include <videodisplaymanager.h>
21 
22 #include "window_attribute.h"
23 #include "wl_subsurface.h"
24 #include "wl_surface.h"
25 #include "window_manager_impl.h"
26 
27 namespace OHOS {
28 class SubwindowVideoImpl : public Subwindow {
29 public:
30     ~SubwindowVideoImpl();
31 
32     GSError Init(const sptr<Window> &window,
33                  const sptr<SubwindowOption> &option);
34 
35     virtual sptr<Surface> GetSurface() const override;
36 
37     virtual GSError Move(int32_t x, int32_t y) override;
38     virtual GSError Resize(uint32_t width, uint32_t height) override;
39     virtual GSError Destroy() override;
40 
41     virtual void OnPositionChange(WindowPositionChangeFunc func) override;
42     virtual void OnSizeChange(WindowSizeChangeFunc func) override;
43     virtual void OnBeforeFrameSubmit(BeforeFrameSubmitFunc func) override;
44 
45 private:
46     GSError CreateWlSurface(const sptr<WlSurface> &parentWlSurface);
47     GSError CreateLayer();
48     GSError CreateSHMBuffer();
49     GSError CreateSurface();
50 
51     // base attribute
52     WindowAttribute attr;
53     wptr<Window> pw = nullptr;
54     uint32_t layerId = 0;
55 
56     // functional member
57     sptr<VideoDisplayManager> display = nullptr;
58     sptr<Surface> csurf = nullptr;
59     sptr<Surface> psurf = nullptr;
60     sptr<WlSubsurface> wlSubsurf = nullptr;
61     sptr<WlSurface> wlSurface = nullptr;
62     sptr<WlBuffer> wlBuffer = nullptr;
63     BeforeFrameSubmitFunc onBeforeFrameSubmitFunc = nullptr;
64 };
65 } // namespace OHOS
66 #endif // FRAMEWORKS_WM_INCLUDE_SUBWINDOW_VIDEO_IMPL_H
67