57 lines
1.8 KiB
C
57 lines
1.8 KiB
C
/*
|
|
* This file is part of mpv.
|
|
*
|
|
* mpv is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
*/
|
|
|
|
#define EGL_EGLEXT_PROTOTYPES
|
|
#define GL_GLEXT_PROTOTYPES
|
|
|
|
#include <EGL/egl.h>
|
|
#include <EGL/eglext.h>
|
|
#include <GLES2/gl2.h>
|
|
#include <GLES2/gl2ext.h>
|
|
|
|
#include <multimedia/player_framework/native_avbuffer.h>
|
|
#include <native_buffer/native_buffer.h>
|
|
#include <native_window/external_window.h>
|
|
|
|
#include "common/msg.h"
|
|
#include "video/harmony_hwdec.h"
|
|
|
|
MPV_EXPORT int mpv_harmony_ohcodec_gl_probe(struct mp_log *log,
|
|
struct OH_AVBuffer *buffer)
|
|
{
|
|
(void)EGL_OHOS_image_native_buffer;
|
|
(void)EGL_NATIVE_BUFFER_OHOS;
|
|
(void)eglCreateImageKHR;
|
|
(void)glEGLImageTargetTexture2DOES;
|
|
if (!buffer) {
|
|
mp_msg(log, MSGL_V, "OHCodec GL probe requires an OH_AVBuffer\n");
|
|
return -1;
|
|
}
|
|
|
|
OH_NativeBuffer *native = OH_AVBuffer_GetNativeBuffer(buffer);
|
|
if (!native) {
|
|
mpv_harmony_hwdec_set_fallback("OH_AVBuffer_GetNativeBuffer failed");
|
|
return -1;
|
|
}
|
|
OHNativeWindowBuffer *window_buffer =
|
|
OH_NativeWindow_CreateNativeWindowBufferFromNativeBuffer(native);
|
|
OH_NativeBuffer_Unreference(native);
|
|
if (!window_buffer) {
|
|
mpv_harmony_hwdec_set_fallback(
|
|
"OH_NativeWindowBuffer conversion failed");
|
|
return -1;
|
|
}
|
|
OH_NativeWindow_DestroyNativeWindowBuffer(window_buffer);
|
|
mp_msg(log, MSGL_V, "OHCodec GL probe reached NativeBuffer conversion; "
|
|
"upstream output ownership still blocks EGL import\n");
|
|
mpv_harmony_hwdec_set_fallback(
|
|
"OHCODEC-BLOCKER-001: upstream has no non-surface output mode");
|
|
return -1;
|
|
}
|