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

ijkplayer: rename SDL_VoutFFmpeg_CreateOverlay

上级 891a40fa
......@@ -27,7 +27,6 @@
#include <jni.h>
#include "ff_ffmsg_queue.h"
#define IJK_LOG_TAG "IJKPLAYER"
#include "ijkutil/ijkutil_android.h"
#ifndef MPTRACE
......
......@@ -35,7 +35,9 @@
#include "libswresample/swresample.h"
#include "ijksdl/ijksdl.h"
#ifndef IJK_LOG_TAG
#define IJK_LOG_TAG "IJKPLAYER"
#endif
#include "ijkutil/ijkutil.h"
#endif
......@@ -580,7 +580,7 @@ static void alloc_picture(FFPlayer *ffp)
video_open(ffp, 0, vp);
#endif
vp->bmp = SDL_VoutCreateFFmpegYUVOverlay(vp->width, vp->height,
vp->bmp = SDL_VoutFFmpeg_CreateOverlay(vp->width, vp->height,
SDL_FCC_YV12,
ffp->vout);
if (!vp->bmp || vp->bmp->pitches[0] < vp->width) {
......
......@@ -105,13 +105,13 @@ static int overlay_unlock(SDL_VoutOverlay *overlay)
return SDL_UnlockMutex(opaque->mutex);
}
SDL_VoutOverlay *SDL_VoutCreateFFmpegOverlay(int width, int height, enum AVPixelFormat format, SDL_Vout *display)
SDL_VoutOverlay *SDL_VoutFFmpeg_CreateOverlay(int width, int height, Uint32 format, SDL_Vout *display)
{
SDLTRACE("SDL_VoutCreateFFmpegOverlay(w=%d, h=%d, fmt=%s(0x%x), dp=%p)",
width, height, av_get_pix_fmt_name(format), (int)format, display);
SDLTRACE("SDL_VoutFFmpeg_CreateOverlay(w=%d, h=%d, fmt=%.4s(0x%x, dp=%p)",
width, height, (const char*) &format, format, display);
SDL_VoutOverlay *overlay = SDL_VoutOverlay_CreateInternal(sizeof(SDL_VoutOverlay_Opaque));
if (!overlay) {
ALOGE("SDL_VoutCreateFFmpegOverlay(...)=NULL");
ALOGE("SDL_VoutFFmpeg_CreateOverlay(...)=NULL");
return NULL;
}
......@@ -123,73 +123,37 @@ SDL_VoutOverlay *SDL_VoutCreateFFmpegOverlay(int width, int height, enum AVPixel
overlay->h = height;
switch (format) {
case AV_PIX_FMT_YUV420P:
case SDL_FCC_YV12: {
opaque->frame = alloc_avframe(opaque, AV_PIX_FMT_YUV420P, width, height);
if (opaque->frame) {
overlay_fill(overlay, opaque->frame, format, 3);
}
overlay->format = SDL_FCC_I420;
break;
default:
ALOGE("SDL_VoutCreateFFmpegOverlay(...): unknown format");
overlay->format = SDL_FCC_UNDF;
break;
}
if (overlay) {
SDLTRACE("SDL_VoutCreateFFmpegOverlay(...): overlay(w=%d, h=%d, fmt=%.4s(0x%x), planes=%d, pitches=%d,%d,%d)",
overlay->w,
overlay->h,
(char*)&overlay->format,
overlay->format,
overlay->planes,
overlay->pitches[0],
overlay->pitches[1],
overlay->pitches[2]);
if (opaque->frame) {
opaque->mutex = SDL_CreateMutex();
overlay->free_l = overlay_free_l;
overlay->lock = overlay_lock;
overlay->unlock = overlay_unlock;
} else {
overlay_free_l(overlay);
overlay = NULL;
}
}
SDLTRACE("SDL_VoutCreateFFmpegOverlay(...)=%p", overlay);
return overlay;
}
SDL_VoutOverlay *SDL_VoutCreateFFmpegYUVOverlay(int width, int height, Uint32 format, SDL_Vout *display)
{
SDLTRACE("SDL_VoutCreateFFmpegYUVOverlay(w=%d, h=%d, fmt=%.4s(0x%x, dp=%p)",
width, height, (const char*) &format, format, display);
SDL_VoutOverlay *overlay = NULL;
switch (format) {
case SDL_FCC_YV12: {
overlay = SDL_VoutCreateFFmpegOverlay(width, height, AV_PIX_FMT_YUV420P, display);
if (overlay) {
/* swap U,V */
FFSWAP(Uint8*, overlay->pixels[1], overlay->pixels[2]);
FFSWAP(Uint16, overlay->pitches[1], overlay->pitches[2]);
overlay->format = SDL_FCC_YV12;
}
overlay->format = SDL_FCC_YV12;
break;
}
case SDL_FCC_RGBP: {
ALOGE("SDL_VoutFFmpeg_CreateOverlay(...): unknown format");
overlay->format = SDL_FCC_UNDF;
break;
}
default:
ALOGE("SDL_VoutCreateFFmpegYUVOverlay(...): unknown format");
ALOGE("SDL_VoutFFmpeg_CreateOverlay(...): unknown format");
overlay->format = SDL_FCC_UNDF;
break;
}
if (!overlay) {
ALOGE("SDL_VoutCreateFFmpegYUVOverlay(...)=NULL");
if (opaque->frame) {
opaque->mutex = SDL_CreateMutex();
overlay->free_l = overlay_free_l;
overlay->lock = overlay_lock;
overlay->unlock = overlay_unlock;
} else {
overlay_free_l(overlay);
overlay = NULL;
ALOGE("SDL_VoutFFmpeg_CreateOverlay(...)=NULL");
}
return overlay;
......
......@@ -28,9 +28,7 @@
#include "../ijksdl_vout.h"
#include "ijksdl_inc_ffmpeg.h"
SDL_VoutOverlay *SDL_VoutCreateFFmpegOverlay(int width, int height, enum AVPixelFormat format, SDL_Vout *display);
// TODO: 9 setup overlay stride to speed up memcpy
SDL_VoutOverlay *SDL_VoutCreateFFmpegYUVOverlay(int width, int height, Uint32 format, SDL_Vout *display);
SDL_VoutOverlay *SDL_VoutFFmpeg_CreateOverlay(int width, int height, Uint32 format, SDL_Vout *display);
#endif
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册