提交 ccbd0b6b 编写于 作者: Z Zhang Rui

ffplay: do not call ffmpeg overlay directly

上级 d5c8c7f5
......@@ -740,7 +740,7 @@ static void alloc_picture(FFPlayer *ffp)
video_open(ffp, 0, vp);
#endif
vp->bmp = SDL_VoutFFmpeg_CreateOverlay(vp->width, vp->height,
vp->bmp = SDL_Vout_CreateOverlay(vp->width, vp->height,
ffp->overlay_format,
ffp->vout);
#ifdef FFP_MERGE
......
......@@ -39,6 +39,19 @@ typedef struct SDL_Vout_Opaque {
ANativeWindow *native_window;
} SDL_Vout_Opaque;
static SDL_VoutOverlay *vout_create_overlay_l(int width, int height, Uint32 format, SDL_Vout *vout)
{
return SDL_VoutFFmpeg_CreateOverlay(width, height, format, vout);
}
static SDL_VoutOverlay *vout_create_overlay(int width, int height, Uint32 format, SDL_Vout *vout)
{
SDL_LockMutex(vout->mutex);
SDL_VoutOverlay *overlay = vout_create_overlay_l(width, height, format, vout);
SDL_UnlockMutex(vout->mutex);
return overlay;
}
static void vout_free_l(SDL_Vout *vout)
{
if (!vout)
......@@ -94,6 +107,7 @@ SDL_Vout *SDL_VoutAndroid_CreateForANativeWindow()
SDL_Vout_Opaque *opaque = vout->opaque;
opaque->native_window = NULL;
vout->create_overlay = vout_create_overlay;
vout->free_l = vout_free_l;
vout->display_overlay = voud_display_overlay;
......
......@@ -29,7 +29,7 @@
#include "ijksdl_inc_ffmpeg.h"
// TODO: 9 alignment to speed up memcpy when display
SDL_VoutOverlay *SDL_VoutFFmpeg_CreateOverlay(int width, int height, Uint32 format, SDL_Vout *display);
SDL_VoutOverlay *SDL_VoutFFmpeg_CreateOverlay(int width, int height, Uint32 format, SDL_Vout *vout);
int SDL_VoutFFmpeg_ConvertFrame(
SDL_VoutOverlay *overlay, AVFrame *frame,
......
......@@ -57,6 +57,15 @@ int SDL_VoutDisplayYUVOverlay(SDL_Vout *vout, SDL_VoutOverlay *overlay)
return -1;
}
SDL_VoutOverlay *SDL_Vout_CreateOverlay(int width, int height, Uint32 format, SDL_Vout *vout)
{
if (vout && vout->create_overlay)
return vout->create_overlay(width, height, format, vout);
return NULL;
}
int SDL_VoutLockYUVOverlay(SDL_VoutOverlay *overlay)
{
if (overlay && overlay->lock)
......
......@@ -50,6 +50,7 @@ typedef struct SDL_Vout {
SDL_mutex *mutex;
SDL_Vout_Opaque *opaque;
SDL_VoutOverlay *(*create_overlay)(int width, int height, Uint32 format, SDL_Vout *vout);
void (*free_l)(SDL_Vout *vout);
int (*display_overlay)(SDL_Vout *vout, SDL_VoutOverlay *overlay);
} SDL_Vout;
......@@ -58,6 +59,7 @@ void SDL_VoutFree(SDL_Vout *vout);
void SDL_VoutFreeP(SDL_Vout **pvout);
int SDL_VoutDisplayYUVOverlay(SDL_Vout *vout, SDL_VoutOverlay *overlay);
SDL_VoutOverlay *SDL_Vout_CreateOverlay(int width, int height, Uint32 format, SDL_Vout *vout);
int SDL_VoutLockYUVOverlay(SDL_VoutOverlay *overlay);
int SDL_VoutUnlockYUVOverlay(SDL_VoutOverlay *overlay);
void SDL_VoutFreeYUVOverlay(SDL_VoutOverlay *overlay);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册