diff options
author | 2016-03-13 13:54:57 +1100 | |
---|---|---|
committer | 2016-03-14 18:55:00 +1100 | |
commit | 42fbb9c3967fcda37f2d9ae17d5796a79cf027b9 (patch) | |
tree | a43047ee00431e5e22bfc5f8f612ff775586e415 /src/tools/ldverify.cpp | |
parent | 5fc27747031b6ed6f6c0582502098ebfb960be67 (diff) |
Make osd_file a polymorphic class that's held with smart pointers
Make avi_file a class that's held with smart pointers, encapsulate various AVI I/O structures
Make zip_file and _7z_file classes rather than having free functions everywhere
Hide zip/7z class implementation behind an interface, no longer need to call close() to send back to the cache
Don't dump as much crap in global namespace
Add solaris PTY implementation
Improve variable expansion for SDL OSD - supports ~/$FOO/${BAR} syntax
Rearrange stuff so the same things are in file module for all OSDs
Move file stuff into its own module
7z/zip open and destruct are still not thread-safe due to lack of interlocks around cache access
Directory functions still need to be moved to file module
SDL OSD may not initialise WinSock on Windows
Diffstat (limited to 'src/tools/ldverify.cpp')
-rw-r--r-- | src/tools/ldverify.cpp | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/src/tools/ldverify.cpp b/src/tools/ldverify.cpp index ab3947dfaea..45c20d9d70c 100644 --- a/src/tools/ldverify.cpp +++ b/src/tools/ldverify.cpp @@ -102,23 +102,23 @@ static bool chdinterlaced; static void *open_avi(const char *filename, movie_info &info) { // open the file - avi_file *avi; - avi_error avierr = avi_open(filename, &avi); - if (avierr != AVIERR_NONE) + avi_file::ptr avi; + avi_file::error avierr = avi_file::open(filename, avi); + if (avierr != avi_file::error::NONE) { - fprintf(stderr, "Error opening AVI file: %s\n", avi_error_string(avierr)); + fprintf(stderr, "Error opening AVI file: %s\n", avi_file::error_string(avierr)); return nullptr; } // extract movie info - const avi_movie_info *aviinfo = avi_get_movie_info(avi); - info.framerate = (double)aviinfo->video_timescale / (double)aviinfo->video_sampletime; - info.numframes = aviinfo->video_numsamples; - info.width = aviinfo->video_width; - info.height = aviinfo->video_height; - info.samplerate = aviinfo->audio_samplerate; - info.channels = aviinfo->audio_channels; - return avi; + const avi_file::movie_info &aviinfo = avi->get_movie_info(); + info.framerate = (double)aviinfo.video_timescale / (double)aviinfo.video_sampletime; + info.numframes = aviinfo.video_numsamples; + info.width = aviinfo.video_width; + info.height = aviinfo.video_height; + info.samplerate = aviinfo.audio_samplerate; + info.channels = aviinfo.audio_channels; + return avi.release(); } @@ -131,17 +131,17 @@ static bool read_avi(void *file, int frame, bitmap_yuy16 &bitmap, INT16 *lsound, avi_file *avifile = reinterpret_cast<avi_file *>(file); // read the frame - avi_error avierr = avi_read_video_frame(avifile, frame, bitmap); - if (avierr != AVIERR_NONE) + avi_file::error avierr = avifile->read_video_frame(frame, bitmap); + if (avierr != avi_file::error::NONE) return FALSE; // read the samples - const avi_movie_info *aviinfo = avi_get_movie_info(avifile); - UINT32 firstsample = (UINT64(aviinfo->audio_samplerate) * UINT64(frame) * UINT64(aviinfo->video_sampletime) + aviinfo->video_timescale - 1) / UINT64(aviinfo->video_timescale); - UINT32 lastsample = (UINT64(aviinfo->audio_samplerate) * UINT64(frame + 1) * UINT64(aviinfo->video_sampletime) + aviinfo->video_timescale - 1) / UINT64(aviinfo->video_timescale); - avierr = avi_read_sound_samples(avifile, 0, firstsample, lastsample - firstsample, lsound); - avierr = avi_read_sound_samples(avifile, 1, firstsample, lastsample - firstsample, rsound); - if (avierr != AVIERR_NONE) + const avi_file::movie_info &aviinfo = avifile->get_movie_info(); + UINT32 firstsample = (UINT64(aviinfo.audio_samplerate) * UINT64(frame) * UINT64(aviinfo.video_sampletime) + aviinfo.video_timescale - 1) / UINT64(aviinfo.video_timescale); + UINT32 lastsample = (UINT64(aviinfo.audio_samplerate) * UINT64(frame + 1) * UINT64(aviinfo.video_sampletime) + aviinfo.video_timescale - 1) / UINT64(aviinfo.video_timescale); + avierr = avifile->read_sound_samples(0, firstsample, lastsample - firstsample, lsound); + avierr = avifile->read_sound_samples(1, firstsample, lastsample - firstsample, rsound); + if (avierr != avi_file::error::NONE) return false; samples = lastsample - firstsample; return true; @@ -155,7 +155,7 @@ static bool read_avi(void *file, int frame, bitmap_yuy16 &bitmap, INT16 *lsound, static void close_avi(void *file) { avi_file *avifile = reinterpret_cast<avi_file *>(file); - avi_close(avifile); + delete avifile; } |