提交 11f259e7 编写于 作者: Z Zhang Rui

ijksdl: move overlay setup to ijksdl

上级 0bf2b768
......@@ -683,13 +683,7 @@ static int queue_picture(FFPlayer *ffp, AVFrame *src_frame, double pts, int64_t
/* get a pointer on the bitmap */
SDL_VoutLockYUVOverlay(vp->bmp);
pict.data[0] = vp->bmp->pixels[0];
pict.data[1] = vp->bmp->pixels[2];
pict.data[2] = vp->bmp->pixels[1];
pict.linesize[0] = vp->bmp->pitches[0];
pict.linesize[1] = vp->bmp->pitches[2];
pict.linesize[2] = vp->bmp->pitches[1];
SDL_VoutFFmpeg_SetupPicture(vp->bmp, &pict, AV_PIX_FMT_YUV420P);
#if CONFIG_AVFILTER
// FIXME use direct rendering
......
......@@ -23,9 +23,11 @@
#include "ijksdl_vout_overlay_ffmpeg.h"
#include <assert.h>
#include "../ijksdl_stdinc.h"
#include "../ijksdl_mutex.h"
#include "../ijksdl_vout_internal.h"
#include "../ijksdl_video.h"
#include "ijksdl_inc_ffmpeg.h"
typedef struct SDL_VoutOverlay_Opaque {
......@@ -159,3 +161,35 @@ SDL_VoutOverlay *SDL_VoutFFmpeg_CreateOverlay(int width, int height, Uint32 form
return overlay;
}
int SDL_VoutFFmpeg_SetupPicture(const SDL_VoutOverlay *overlay, AVPicture *pic, enum AVPixelFormat ff_format)
{
assert(overlay);
assert(pic);
int retval = -1;
switch (ff_format) {
case AV_PIX_FMT_YUV420P: {
switch (overlay->format) {
case SDL_FCC_YV12: {
for (int i = 0; i < overlay->planes; ++i) {
pic->data[i] = overlay->pixels[i];
pic->linesize[i] = overlay->pitches[i];
}
retval = 0;
break;
}
}
break;
}
default: {
break;
}
}
if (retval) {
ALOGE("SDL_VoutFFmpeg_SetupPicture: unexpected %d, 0x%x", ff_format, overlay->format);
}
return retval;
}
......@@ -31,4 +31,6 @@
// TODO: 9 setup overlay stride to speed up memcpy
SDL_VoutOverlay *SDL_VoutFFmpeg_CreateOverlay(int width, int height, Uint32 format, SDL_Vout *display);
int SDL_VoutFFmpeg_SetupPicture(const SDL_VoutOverlay *overlay, AVPicture *pic, enum AVPixelFormat ff_format);
#endif
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册