summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/recording.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/emu/recording.cpp')
-rw-r--r--src/emu/recording.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/emu/recording.cpp b/src/emu/recording.cpp
index 9e3c1f3f4ae..d9c25c57767 100644
--- a/src/emu/recording.cpp
+++ b/src/emu/recording.cpp
@@ -9,7 +9,11 @@
***************************************************************************/
#include "emu.h"
+
+#include "fileio.h"
+#include "main.h"
#include "screen.h"
+
#include "aviio.h"
#include "png.h"
@@ -175,8 +179,8 @@ bool avi_movie_recording::initialize(running_machine &machine, std::unique_ptr<e
// build up information about this new movie
avi_file::movie_info info;
info.video_format = 0;
- info.video_timescale = 1000 * (screen() ? screen()->frame_period().as_hz() : screen_device::DEFAULT_FRAME_RATE);
- info.video_sampletime = 1000;
+ info.video_timescale = 0x3fff'fffc; // multiple of 60, for screenless machines
+ info.video_sampletime = screen() ? screen()->frame_period().as_ticks(info.video_timescale) : 0x0111'1111;
info.video_numsamples = 0;
info.video_width = width;
info.video_height = height;
@@ -191,7 +195,7 @@ bool avi_movie_recording::initialize(running_machine &machine, std::unique_ptr<e
info.audio_samplerate = machine.sample_rate();
// compute the frame time
- set_frame_period(attotime::from_seconds(1000) / info.video_timescale);
+ set_frame_period(attotime::from_ticks(info.video_sampletime, info.video_timescale));
// create the file
avi_file::error avierr = avi_file::create(fullpath, info, m_avi_file);
@@ -218,14 +222,13 @@ bool avi_movie_recording::append_single_video_frame(bitmap_rgb32 &bitmap, const
bool avi_movie_recording::add_sound_to_recording(const s16 *sound, int numsamples)
{
- g_profiler.start(PROFILER_MOVIE_REC);
+ auto profile = g_profiler.start(PROFILER_MOVIE_REC);
// write the next frame
avi_file::error avierr = m_avi_file->append_sound_samples(0, sound + 0, numsamples, 1);
if (avierr == avi_file::error::NONE)
avierr = m_avi_file->append_sound_samples(1, sound + 1, numsamples, 1);
- g_profiler.stop();
return avierr == avi_file::error::NONE;
}