11 #include "DVDStreamInfo.h" 12 #include "DVDVideoCodec.h" 13 #include "cores/VideoPlayer/Buffers/VideoBuffer.h" 14 #include "threads/SingleLock.h" 15 #include "threads/Thread.h" 16 #include "utils/Geometry.h" 18 #include "platform/android/activity/JNIXBMCVideoView.h" 26 #include <android/native_window.h> 27 #include <android/native_window_jni.h> 28 #include <androidjni/Surface.h> 31 class CJNISurfaceTexture;
33 class CJNIMediaCrypto;
34 class CJNIMediaFormat;
35 class CJNIMediaCodecBufferInfo;
60 void Set(
int internalId,
62 std::shared_ptr<CJNISurfaceTexture> surfaceTexture,
63 std::shared_ptr<CDVDMediaCodecOnFrameAvailable> frameAvailable,
64 std::shared_ptr<CJNIXBMCVideoView> videoView);
67 bool WaitForFrame(
int millis);
69 void ReleaseOutputBuffer(
bool render,
73 int GetBufferId()
const;
74 int GetTextureId()
const;
75 void GetTransformMatrix(
float* textureMatrix);
76 void UpdateTexImage();
77 void RenderUpdate(
const CRect& DestRect, int64_t displayTime);
78 bool HasSurfaceTexture()
const {
return m_surfacetexture.operator bool(); }
82 unsigned int m_textureId = 0;
85 std::shared_ptr<CJNISurfaceTexture> m_surfacetexture;
86 std::shared_ptr<CDVDMediaCodecOnFrameAvailable> m_frameready;
87 std::shared_ptr<CJNIXBMCVideoView> m_videoview;
94 : m_codec(std::move(mediaCodec))
101 void Return(
int id)
override;
103 std::shared_ptr<CJNIMediaCodec> GetMediaCodec();
104 void ResetMediaCodec();
105 void ReleaseMediaCodecBuffers();
108 CCriticalSection m_criticalSection;
109 std::shared_ptr<CJNIMediaCodec> m_codec;
111 std::vector<CMediaCodecVideoBuffer*> m_videoBuffers;
112 std::vector<int> m_freeBuffers;
122 static std::unique_ptr<CDVDVideoCodec> Create(
CProcessInfo& processInfo);
123 static bool Register();
128 void Reset()
override;
130 VCReturn GetPicture(
VideoPicture* pVideoPicture)
override;
131 const char*
GetName()
override {
return m_formatname.c_str(); }
132 void SetCodecControl(
int flags)
override;
133 unsigned GetAllowedReferences()
override;
137 void FlushInternal(
void);
138 void SignalEndOfStream();
139 void InjectExtraData(CJNIMediaFormat& mediaformat);
140 std::vector<uint8_t> GetHDRStaticMetadata();
141 bool ConfigureMediaCodec(
void);
142 int GetOutputPicture(
void);
143 void ConfigureOutputFormat(CJNIMediaFormat& mediaformat);
144 void UpdateFpsDuration();
147 static void CallbackInitSurfaceTexture(
void*);
148 void InitSurfaceTexture(
void);
149 void ReleaseSurfaceTexture(
void);
153 std::string m_codecname;
155 std::string m_formatname;
157 bool m_needSecureDecoder =
false;
158 int m_codecControlFlags;
161 std::shared_ptr<CJNIXBMCVideoView> m_jnivideoview;
162 CJNISurface m_jnivideosurface;
163 unsigned int m_textureId;
164 std::shared_ptr<CJNIMediaCodec> m_codec;
165 CJNIMediaCrypto* m_crypto =
nullptr;
166 std::shared_ptr<CJNISurfaceTexture> m_surfaceTexture;
167 std::shared_ptr<CDVDMediaCodecOnFrameAvailable> m_frameAvailable;
170 std::shared_ptr<CMediaCodecVideoBufferPool> m_videoBufferPool;
172 uint32_t m_OutputDuration, m_fpsDuration;
174 int64_t m_invalidPTSValue = 0;
177 static std::atomic<bool> m_InstanceGuard;
179 std::unique_ptr<CBitstreamConverter> m_bitstream;
182 int m_indexInputBuffer;
183 bool m_render_surface;
191 void surfaceChanged(CJNISurfaceHolder holder,
int format,
int width,
int height)
override;
192 void surfaceCreated(CJNISurfaceHolder holder)
override;
193 void surfaceDestroyed(CJNISurfaceHolder holder)
override;
Definition: DVDStreamInfo.h:23
Definition: VideoBuffer.h:85
Definition: BitstreamConverter.h:28
Definition: DVDCodecs.h:23
Definition: DVDVideoCodecAndroidMediaCodec.h:44
Definition: VideoBuffer.h:51
Definition: BitstreamConverter.h:83
Definition: ProcessInfo.h:26
Definition: DemuxCrypto.h:50
Definition: DVDVideoCodec.h:36
Definition: DemuxPacket.h:22
Definition: DVDVideoCodec.h:107