From 08965cfa0d7c5c1bba2e9f8eed73346eb1934bd3 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 3 May 2014 00:21:07 +0200 Subject: [PATCH] Change HAVE_FFMPEG ifdefs into HAVE_RECORD - recording will get a proper interface soon so there can be multiple implementations instead of just ffmpeg --- Makefile | 2 +- Makefile.win | 2 +- driver.c | 2 +- dynamic.c | 2 +- general.h | 4 ++-- gfx/gl_common.h | 2 +- retroarch.c | 30 +++++++++++++++--------------- 7 files changed, 22 insertions(+), 22 deletions(-) diff --git a/Makefile b/Makefile index d9c535ea2d..95a83d0c53 100644 --- a/Makefile +++ b/Makefile @@ -328,7 +328,7 @@ endif ifeq ($(HAVE_FFMPEG), 1) OBJ += record/ffemu.o LIBS += $(AVCODEC_LIBS) $(AVFORMAT_LIBS) $(AVUTIL_LIBS) $(SWSCALE_LIBS) - DEFINES += $(AVCODEC_CFLAGS) $(AVFORMAT_CFLAGS) $(AVUTIL_CFLAGS) $(SWSCALE_CFLAGS) + DEFINES += $(AVCODEC_CFLAGS) $(AVFORMAT_CFLAGS) $(AVUTIL_CFLAGS) $(SWSCALE_CFLAGS) -DHAVE_RECORD endif ifeq ($(HAVE_DYNAMIC), 1) diff --git a/Makefile.win b/Makefile.win index 40a15524f2..18efbe5c5f 100644 --- a/Makefile.win +++ b/Makefile.win @@ -249,7 +249,7 @@ endif ifeq ($(HAVE_FFMPEG), 1) LIBS += -lavformat -lavcodec -lavutil -lswscale -lws2_32 -lz - DEFINES += -DHAVE_FFMPEG -Iffmpeg + DEFINES += -DHAVE_FFMPEG -DHAVE_RECORD -Iffmpeg OBJ += record/ffemu.o endif diff --git a/driver.c b/driver.c index f2a64b9da3..3bb08cb685 100644 --- a/driver.c +++ b/driver.c @@ -700,7 +700,7 @@ bool driver_update_system_av_info(const struct retro_system_av_info *info) rarch_set_fullscreen(g_settings.video.fullscreen); // Cannot continue recording with different parameters. // Take the easiest route out and just restart the recording. -#ifdef HAVE_FFMPEG +#ifdef HAVE_RECORD if (g_extern.recording) { static const char *msg = "Restarting FFmpeg recording due to driver reinit."; diff --git a/dynamic.c b/dynamic.c index 92b4531749..3fff42ff5d 100644 --- a/dynamic.c +++ b/dynamic.c @@ -814,7 +814,7 @@ bool rarch_environment_cb(unsigned cmd, void *data) RARCH_LOG("Environ SET_AUDIO_CALLBACK.\n"); const struct retro_audio_callback *info = (const struct retro_audio_callback*)data; -#ifdef HAVE_FFMPEG +#ifdef HAVE_RECORD if (g_extern.recording) // A/V sync is a must. return false; #endif diff --git a/general.h b/general.h index 2bb3d476cb..742c4ce112 100644 --- a/general.h +++ b/general.h @@ -588,7 +588,7 @@ struct global #endif // FFmpeg record. -#ifdef HAVE_FFMPEG +#ifdef HAVE_RECORD ffemu_t *rec; char record_path[PATH_MAX]; char record_config[PATH_MAX]; @@ -747,7 +747,7 @@ void rarch_save_state(void); void rarch_state_slot_increase(void); void rarch_state_slot_decrease(void); -#ifdef HAVE_FFMPEG +#ifdef HAVE_RECORD void rarch_init_recording(void); void rarch_deinit_recording(void); #endif diff --git a/gfx/gl_common.h b/gfx/gl_common.h index 4569343ead..1e09f2df6e 100644 --- a/gfx/gl_common.h +++ b/gfx/gl_common.h @@ -58,7 +58,7 @@ gl->ctx_driver->write_egl_image(gl, frame, width, height, pitch, base_size, tex_index,img) #endif -#if defined(HAVE_FFMPEG) && (!defined(HAVE_OPENGLES) || defined(HAVE_OPENGLES3)) +#if defined(HAVE_RECORD) && (!defined(HAVE_OPENGLES) || defined(HAVE_OPENGLES3)) #define HAVE_GL_ASYNC_READBACK #endif diff --git a/retroarch.c b/retroarch.c index 4691ed5b22..273974488b 100644 --- a/retroarch.c +++ b/retroarch.c @@ -211,7 +211,7 @@ static void readjust_audio_input_rate(void) // g_extern.audio_data.src_ratio, g_extern.audio_data.orig_src_ratio); } -#ifdef HAVE_FFMPEG +#ifdef HAVE_RECORD static void recording_dump_frame(const void *data, unsigned width, unsigned height, size_t pitch) { struct ffemu_video_data ffemu_data = {0}; @@ -298,7 +298,7 @@ static void video_frame(const void *data, unsigned width, unsigned height, size_ // Slightly messy code, // but we really need to do processing before blocking on VSync for best possible scheduling. -#ifdef HAVE_FFMPEG +#ifdef HAVE_RECORD if (g_extern.recording && (!g_extern.filter.filter || !g_settings.video.post_filter_record || !data || g_extern.record_gpu_buffer)) recording_dump_frame(data, width, height, pitch); #endif @@ -323,7 +323,7 @@ static void video_frame(const void *data, unsigned width, unsigned height, size_ data, width, height, pitch); RARCH_PERFORMANCE_STOP(softfilter_process); -#ifdef HAVE_FFMPEG +#ifdef HAVE_RECORD if (g_extern.recording && g_settings.video.post_filter_record) recording_dump_frame(g_extern.filter.buffer, owidth, oheight, opitch); #endif @@ -337,7 +337,7 @@ static void video_frame(const void *data, unsigned width, unsigned height, size_ void rarch_render_cached_frame(void) { -#ifdef HAVE_FFMPEG +#ifdef HAVE_RECORD // Cannot allow FFmpeg recording when pushing duped frames. bool recording = g_extern.recording; g_extern.recording = false; @@ -355,14 +355,14 @@ void rarch_render_cached_frame(void) g_extern.frame_cache.height, g_extern.frame_cache.pitch); -#ifdef HAVE_FFMPEG +#ifdef HAVE_RECORD g_extern.recording = recording; #endif } static bool audio_flush(const int16_t *data, size_t samples) { -#ifdef HAVE_FFMPEG +#ifdef HAVE_RECORD if (g_extern.recording) { struct ffemu_audio_data ffemu_data = {0}; @@ -802,7 +802,7 @@ static void print_help(void) puts("\t\tAvailable commands are listed if command is invalid."); #endif -#ifdef HAVE_FFMPEG +#ifdef HAVE_RECORD puts("\t-r/--record: Path to record video file.\n\t\tUsing .mkv extension is recommended."); puts("\t--recordconfig: Path to settings used during recording."); puts("\t--size: Overrides output video size when recording with FFmpeg (format: WIDTHxHEIGHT)."); @@ -913,7 +913,7 @@ static void parse_input(int argc, char *argv[]) { "help", 0, NULL, 'h' }, { "save", 1, NULL, 's' }, { "fullscreen", 0, NULL, 'f' }, -#ifdef HAVE_FFMPEG +#ifdef HAVE_RECORD { "record", 1, NULL, 'r' }, { "recordconfig", 1, &val, 'R' }, { "size", 1, &val, 's' }, @@ -951,7 +951,7 @@ static void parse_input(int argc, char *argv[]) { NULL, 0, NULL, 0 } }; -#ifdef HAVE_FFMPEG +#ifdef HAVE_RECORD #define FFMPEG_RECORD_ARG "r:" #else #define FFMPEG_RECORD_ARG @@ -1060,7 +1060,7 @@ static void parse_input(int argc, char *argv[]) strlcpy(g_extern.config_path, optarg, sizeof(g_extern.config_path)); break; -#ifdef HAVE_FFMPEG +#ifdef HAVE_RECORD case 'r': strlcpy(g_extern.record_path, optarg, sizeof(g_extern.record_path)); g_extern.recording = true; @@ -1176,7 +1176,7 @@ static void parse_input(int argc, char *argv[]) g_extern.block_patch = true; break; -#ifdef HAVE_FFMPEG +#ifdef HAVE_RECORD case 's': { if (sscanf(optarg, "%ux%u", &g_extern.record_width, &g_extern.record_height) != 2) @@ -1293,7 +1293,7 @@ static inline void save_files(void) } } -#ifdef HAVE_FFMPEG +#ifdef HAVE_RECORD void rarch_init_recording(void) { if (!g_extern.recording) @@ -2944,7 +2944,7 @@ int rarch_main_init(int argc, char *argv[]) init_controllers(); -#ifdef HAVE_FFMPEG +#ifdef HAVE_RECORD rarch_init_recording(); #endif @@ -3014,7 +3014,7 @@ static inline void update_frame_time(void) retro_time_t delta = 0; bool is_locked_fps = g_extern.is_paused || driver.nonblock_state; -#ifdef HAVE_FFMPEG +#ifdef HAVE_RECORD is_locked_fps |= g_extern.recording; #endif @@ -3145,7 +3145,7 @@ void rarch_main_deinit(void) rarch_deinit_autosave(); #endif -#ifdef HAVE_FFMPEG +#ifdef HAVE_RECORD rarch_deinit_recording(); #endif