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<jni::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<jni::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;
154 std::string m_formatname;
155 bool m_opened =
false;
156 bool m_needSecureDecoder =
false;
157 int m_codecControlFlags;
160 std::shared_ptr<jni::CJNIXBMCVideoView> m_jnivideoview;
161 CJNISurface m_jnivideosurface;
162 unsigned int m_textureId = 0;
163 std::shared_ptr<CJNIMediaCodec> m_codec;
164 CJNIMediaCrypto* m_crypto =
nullptr;
165 std::shared_ptr<CJNISurfaceTexture> m_surfaceTexture;
166 std::shared_ptr<CDVDMediaCodecOnFrameAvailable> m_frameAvailable;
169 std::shared_ptr<CMediaCodecVideoBufferPool> m_videoBufferPool;
171 uint32_t m_OutputDuration = 0, m_fpsDuration = 0;
172 int64_t m_lastPTS = -1;
173 int64_t m_invalidPTSValue = 0;
174 double m_dtsShift = DVD_NOPTS_VALUE;
176 static std::atomic<bool> m_InstanceGuard;
178 std::unique_ptr<CBitstreamConverter> m_bitstream;
181 int m_indexInputBuffer;
182 bool m_render_surface;
186 bool m_useDTSforPTS =
false;
190 void surfaceChanged(CJNISurfaceHolder holder,
int format,
int width,
int height)
override;
191 void surfaceCreated(CJNISurfaceHolder holder)
override;
192 void surfaceDestroyed(CJNISurfaceHolder holder)
override;
Definition: DVDStreamInfo.h:25
Definition: VideoBuffer.h:85
Definition: BitstreamConverter.h:30
Definition: DVDCodecs.h:23
Definition: DVDVideoCodecAndroidMediaCodec.h:44
Definition: VideoBuffer.h:51
Definition: BitstreamConverter.h:85
Definition: ProcessInfo.h:26
Definition: DemuxCrypto.h:51
Definition: DVDVideoCodec.h:36
Definition: DemuxPacket.h:22
Definition: DVDVideoCodec.h:110