Buildfix !USE_FFMPEG

This commit is contained in:
Sacha committed 2013-11-12 17:52:43 +10:00
1 parent aad70d8912
commit efad755ccc
2 files changed
+36 -22

No files matched your search

+29 -21
View File
@@ -60,24 +60,6 @@ static AVPixelFormat getSwsFormat(int pspFormat)
return (AVPixelFormat)0;
}
}
#endif
static int getPixelFormatBytes(int pspFormat)
{
switch (pspFormat)
{
case TPSM_PIXEL_STORAGE_MODE_16BIT_BGR5650:
case TPSM_PIXEL_STORAGE_MODE_16BIT_ABGR5551:
case TPSM_PIXEL_STORAGE_MODE_16BIT_ABGR4444:
return 2;
case TPSM_PIXEL_STORAGE_MODE_32BIT_ABGR8888:
return 4;
default:
ERROR_LOG(ME, "Unknown pixel format");
return 4;
}
}
void ffmpeg_logger(void *, int level, const char *format, va_list va_args) {
// We're still called even if the level doesn't match.
@@ -113,6 +95,24 @@ bool InitFFmpeg() {
return true;
}
#endif
static int getPixelFormatBytes(int pspFormat)
{
switch (pspFormat)
{
case TPSM_PIXEL_STORAGE_MODE_16BIT_BGR5650:
case TPSM_PIXEL_STORAGE_MODE_16BIT_ABGR5551:
case TPSM_PIXEL_STORAGE_MODE_16BIT_ABGR4444:
return 2;
case TPSM_PIXEL_STORAGE_MODE_32BIT_ABGR8888:
return 4;
default:
ERROR_LOG(ME, "Unknown pixel format");
return 4;
}
}
void __AdjustBGMVolume(s16 *samples, u32 count) {
if (g_Config.iBGMVolume < 0 || g_Config.iBGMVolume >= MAX_CONFIG_VOLUME) {
@@ -126,11 +126,13 @@ void __AdjustBGMVolume(s16 *samples, u32 count) {
}
MediaEngine::MediaEngine(): m_pdata(0) {
#ifdef USE_FFMPEG
m_pFormatCtx = 0;
m_pCodecCtx = 0;
m_pFrame = 0;
m_pFrameRGB = 0;
m_pIOContext = 0;
#endif
m_videoStream = -1;
m_audioStream = -1;
m_buffer = 0;
@@ -170,11 +172,13 @@ void MediaEngine::closeMedia() {
if (m_demux)
delete m_demux;
m_buffer = 0;
#ifdef USE_FFMPEG
m_pFrame = 0;
m_pFrameRGB = 0;
m_pIOContext = 0;
m_pCodecCtx = 0;
m_pFormatCtx = 0;
#endif
m_pdata = 0;
m_demux = 0;
AT3Close(&m_audioContext);
@@ -198,10 +202,12 @@ void MediaEngine::DoState(PointerWrap &p){
p.Do(hasloadStream);
if (hasloadStream && p.mode == p.MODE_READ)
loadStream(m_mpegheader, 2048, m_ringbuffersize);
#ifdef USE_FFMPEG
u32 hasopencontext = m_pFormatCtx != NULL;
p.Do(hasopencontext);
if (hasopencontext && p.mode == p.MODE_READ)
openContext();
#endif
if (m_pdata)
m_pdata->DoState(p);
if (m_demux)
@@ -338,9 +344,9 @@ int MediaEngine::addStreamData(u8* buffer, int addSize) {
bool MediaEngine::setVideoDim(int width, int height)
{
#ifdef USE_FFMPEG
if (!m_pCodecCtx)
return false;
#ifdef USE_FFMPEG
if (width == 0 && height == 0)
{
// use the orignal video size
@@ -488,9 +494,9 @@ inline void writeVideoLineABGR4444(void *destp, const void *srcp, int width) {
}
int MediaEngine::writeVideoImage(u8* buffer, int frameWidth, int videoPixelMode) {
#ifdef USE_FFMPEG
if ((!m_pFrame)||(!m_pFrameRGB))
return false;
#ifdef USE_FFMPEG
int videoImageSize = 0;
// lock the image size
int height = m_desHeight;
@@ -546,9 +552,9 @@ int MediaEngine::writeVideoImage(u8* buffer, int frameWidth, int videoPixelMode)
int MediaEngine::writeVideoImageWithRange(u8* buffer, int frameWidth, int videoPixelMode,
int xpos, int ypos, int width, int height) {
#ifdef USE_FFMPEG
if ((!m_pFrame)||(!m_pFrameRGB))
return false;
#ifdef USE_FFMPEG
int videoImageSize = 0;
// lock the image size
u8 *imgbuf = buffer;
@@ -610,7 +616,9 @@ int MediaEngine::writeVideoImageWithRange(u8* buffer, int frameWidth, int videoP
}
u8 *MediaEngine::getFrameImage() {
#ifdef USE_FFMPEG
return m_pFrameRGB->data[0];
#endif
}
int MediaEngine::getRemainSize() {
+7 -1
View File
@@ -19,7 +19,6 @@
// Simulation of the hardware video/audio decoders.
// The idea is high level emulation where we simply use FFMPEG.
// TODO: Actually hook up to ffmpeg.
#pragma once
@@ -32,18 +31,22 @@
struct SimpleAT3;
#ifdef USE_FFMPEG
struct SwsContext;
struct AVFrame;
struct AVIOContext;
struct AVFormatContext;
struct AVCodecContext;
#endif
inline s64 getMpegTimeStamp(u8* buf) {
return (s64)buf[5] | ((s64)buf[4] << 8) | ((s64)buf[3] << 16) | ((s64)buf[2] << 24)
| ((s64)buf[1] << 32) | ((s64)buf[0] << 36);
}
#ifdef USE_FFMPEG
bool InitFFmpeg();
#endif
void __AdjustBGMVolume(s16 *samples, u32 count);
@@ -89,12 +92,15 @@ private:
public: // TODO: Very little of this below should be public.
// Video ffmpeg context - not used for audio
#ifdef USE_FFMPEG
AVFormatContext *m_pFormatCtx;
AVCodecContext *m_pCodecCtx;
AVFrame *m_pFrame;
AVFrame *m_pFrameRGB;
AVIOContext *m_pIOContext;
SwsContext *m_sws_ctx;
#endif
int m_sws_fmt;
u8 *m_buffer;
int m_videoStream;