move video_frame to gfx/video_driver.c

This commit is contained in:
twinaphex 2015-11-24 01:26:59 +01:00
parent 909ee01012
commit 1f62479068
3 changed files with 70 additions and 63 deletions

View File

@ -1777,3 +1777,60 @@ void video_driver_frame(const void *data,
*frame_count = *frame_count + 1;
}
/**
* video_frame:
* @data : pointer to data of the video frame.
* @width : width of the video frame.
* @height : height of the video frame.
* @pitch : pitch of the video frame.
*
* Video frame render callback function.
**/
void video_frame(const void *data, unsigned width,
unsigned height, size_t pitch)
{
unsigned output_width = 0;
unsigned output_height = 0;
unsigned output_pitch = 0;
const char *msg = NULL;
driver_t *driver = driver_get_ptr();
global_t *global = global_get_ptr();
settings_t *settings = config_get_ptr();
if (!driver->video_active)
return;
if (video_pixel_frame_scale(data, width, height, pitch))
{
video_pixel_scaler_t *scaler = scaler_get_ptr();
data = scaler->scaler_out;
pitch = scaler->scaler->out_stride;
}
video_driver_cached_frame_set(data, width, height, pitch);
/* Slightly messy code,
* but we really need to do processing before blocking on VSync
* for best possible scheduling.
*/
if ((!video_driver_ctl(RARCH_DISPLAY_CTL_FRAME_FILTER_ALIVE, NULL)
|| !settings->video.post_filter_record || !data
|| global->record.gpu_buffer)
)
recording_dump_frame(data, width, height, pitch);
if (video_driver_frame_filter(data, width, height, pitch,
&output_width, &output_height, &output_pitch))
{
data = video_driver_frame_filter_get_buf_ptr();
width = output_width;
height = output_height;
pitch = output_pitch;
}
msg = rarch_main_msg_queue_pull();
video_driver_frame(data, width, height, pitch, msg);
}

View File

@ -525,6 +525,18 @@ video_pixel_scaler_t *scaler_get_ptr(void);
const video_poke_interface_t *video_driver_get_poke(void);
/**
* video_frame:
* @data : pointer to data of the video frame.
* @width : width of the video frame.
* @height : height of the video frame.
* @pitch : pitch of the video frame.
*
* Video frame render callback function.
**/
void video_frame(const void *data, unsigned width,
unsigned height, size_t pitch);
extern video_driver_t video_gl;
extern video_driver_t video_psp1;
extern video_driver_t video_vita2d;

View File

@ -26,78 +26,16 @@
#include "libretro.h"
#include "general.h"
#include "runloop.h"
#include "runloop_data.h"
#include "retroarch.h"
#include "rewind.h"
#include "performance.h"
#include "input/input_common.h"
#include "input/input_remapping.h"
#include "gfx/video_driver.h"
#include "audio/audio_driver.h"
#include "record/record_driver.h"
#include "verbosity.h"
#ifdef HAVE_NETPLAY
#include "netplay.h"
#endif
/**
* video_frame:
* @data : pointer to data of the video frame.
* @width : width of the video frame.
* @height : height of the video frame.
* @pitch : pitch of the video frame.
*
* Video frame render callback function.
**/
static void video_frame(const void *data, unsigned width,
unsigned height, size_t pitch)
{
unsigned output_width = 0;
unsigned output_height = 0;
unsigned output_pitch = 0;
const char *msg = NULL;
driver_t *driver = driver_get_ptr();
global_t *global = global_get_ptr();
settings_t *settings = config_get_ptr();
if (!driver->video_active)
return;
if (video_pixel_frame_scale(data, width, height, pitch))
{
video_pixel_scaler_t *scaler = scaler_get_ptr();
data = scaler->scaler_out;
pitch = scaler->scaler->out_stride;
}
video_driver_cached_frame_set(data, width, height, pitch);
/* Slightly messy code,
* but we really need to do processing before blocking on VSync
* for best possible scheduling.
*/
if ((!video_driver_ctl(RARCH_DISPLAY_CTL_FRAME_FILTER_ALIVE, NULL)
|| !settings->video.post_filter_record || !data
|| global->record.gpu_buffer)
)
recording_dump_frame(data, width, height, pitch);
if (video_driver_frame_filter(data, width, height, pitch,
&output_width, &output_height, &output_pitch))
{
data = video_driver_frame_filter_get_buf_ptr();
width = output_width;
height = output_height;
pitch = output_pitch;
}
msg = rarch_main_msg_queue_pull();
video_driver_frame(data, width, height, pitch, msg);
}
/**
* retro_set_default_callbacks:
* @data : pointer to retro_callbacks object