102 lines
3.0 KiB
C++
102 lines
3.0 KiB
C++
/*
|
|
* Copyright (C) 2025 Amlogic Corporation.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
#ifndef __MESON_VIDEO_COMPOSITOR_IMPLEMENT_H__
|
|
#define __MESON_VIDEO_COMPOSITOR_IMPLEMENT_H__
|
|
#include <unordered_map>
|
|
#include "Mutex.h"
|
|
#include "Thread.h"
|
|
#include "Poll.h"
|
|
#include "videotunnel_lib_wrap.h"
|
|
#include "displayAdapter_lib_wrap.h"
|
|
#include "meson_display_wrap.h"
|
|
|
|
class MesonVideoCompositorPlugin;
|
|
class MesonVideoCompositorImpl : public ATools::Thread
|
|
{
|
|
public:
|
|
MesonVideoCompositorImpl(MesonVideoCompositorPlugin *plugin, int logCategory);
|
|
virtual ~MesonVideoCompositorImpl();
|
|
bool init();
|
|
bool release();
|
|
bool connect();
|
|
bool disconnect();
|
|
bool displayFrame(RenderBuffer *buf, int64_t displayTime);
|
|
void flush();
|
|
void setFrameSize(int width, int height);
|
|
void setWindow(RenderRect win);
|
|
void setImmediatelyOutout(bool immediately);
|
|
void setHideVideo(bool hide);
|
|
void setKeepLastFrame(bool keep);
|
|
void setPip(int pip);
|
|
void getVideotunnelId(int *id) {
|
|
if (id) {
|
|
*id = mInstanceId;
|
|
}
|
|
};
|
|
void setDisplayOutput(int output);
|
|
void setZorder(int zorder);
|
|
void videoCenterRect(struct rect src, struct rect dst, struct rect *result);
|
|
void setPixelAspectRatio(double ratio);
|
|
//thread func
|
|
virtual void readyToRun();
|
|
virtual bool threadLoop();
|
|
private:
|
|
void waitFence(int fence);
|
|
MesonVideoCompositorPlugin *mPlugin;
|
|
mutable ATools::Mutex mMutex;
|
|
VideotunnelLib *mVideotunnelLib;
|
|
displayAdapterLib *mDisplayAdapterLib;
|
|
|
|
int mLogCategory;
|
|
|
|
int mDisplayId;
|
|
int mLayerId;
|
|
|
|
int mFd;
|
|
int mInstanceId;
|
|
bool mImmediately;
|
|
bool mHideVideo;
|
|
bool mKeepLastFrame;
|
|
int mPip; //indicate pip index,if more than 1 pip video
|
|
bool mIsVideoTunnelConnected;
|
|
bool mStarted;
|
|
bool mRequestStop;
|
|
|
|
//fd as key index,if has two fd,the key is fd0 << 32 | fd1
|
|
std::unordered_map<int, RenderBuffer *> mQueueRenderBufferMap;
|
|
int mQueueFrameCnt;
|
|
|
|
int mFrameWidth;
|
|
int mFrameHeight;
|
|
struct rect mWindow;
|
|
bool mWindowChanged;
|
|
ATools::Poll *mPoll;
|
|
int64_t mLastDisplayTime;
|
|
bool mSignalFirstFrameDiplayed;
|
|
bool mUnderFlowDetect;
|
|
int mZorder;
|
|
double mPixelAspectRatio;
|
|
|
|
mesonDisplayLib *mMesonDisplayLib;
|
|
int mResolutionWidth;
|
|
int mResolutionHeight;
|
|
|
|
int mDisplayedFrameWidth; //latest committed compositor frame width
|
|
int mDisplayedFrameHeight; //latest committed compositor frame height
|
|
};
|
|
|
|
#endif /*__MESON_VIDEO_COMPOSITOR_IMPLEMENT_H__*/
|