summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/machine/laserdsc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/machine/laserdsc.cpp')
-rw-r--r--src/devices/machine/laserdsc.cpp369
1 files changed, 231 insertions, 138 deletions
diff --git a/src/devices/machine/laserdsc.cpp b/src/devices/machine/laserdsc.cpp
index 436a238fe88..dc9fd2f5064 100644
--- a/src/devices/machine/laserdsc.cpp
+++ b/src/devices/machine/laserdsc.cpp
@@ -2,20 +2,19 @@
// copyright-holders:Aaron Giles
/*************************************************************************
- laserdsc.c
-
Core laserdisc player implementation.
*************************************************************************/
#include "emu.h"
#include "laserdsc.h"
-#include "avhuff.h"
-#include "vbiparse.h"
+
#include "config.h"
#include "render.h"
#include "romload.h"
+
#include "chd.h"
+#include "xmlfile.h"
@@ -23,7 +22,9 @@
// DEBUGGING
//**************************************************************************
-#define LOG_SLIDER 0
+#define LOG_SLIDER (1U << 1)
+#define VERBOSE (0)
+#include "logmacro.h"
@@ -54,45 +55,57 @@ const uint32_t VIRTUAL_LEAD_OUT_TRACKS = LEAD_OUT_MIN_SIZE_IN_UM * 1000 / NOMINA
// CORE IMPLEMENTATION
//**************************************************************************
+ALLOW_SAVE_TYPE(laserdisc_device::player_state);
+ALLOW_SAVE_TYPE(laserdisc_device::slider_position);
+
+parallel_laserdisc_device::parallel_laserdisc_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
+ : laserdisc_device(mconfig, type, tag, owner, clock)
+{
+}
+
//-------------------------------------------------
// laserdisc_device - constructor
//-------------------------------------------------
laserdisc_device::laserdisc_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, type, tag, owner, clock),
- device_sound_interface(mconfig, *this),
- device_video_interface(mconfig, *this),
- m_overwidth(0),
- m_overheight(0),
- m_overclip(0, -1, 0, -1),
- m_disc(nullptr),
- m_width(0),
- m_height(0),
- m_fps_times_1million(0),
- m_samplerate(0),
- m_readresult(CHDERR_NONE),
- m_chdtracks(0),
- m_work_queue(osd_work_queue_alloc(WORK_QUEUE_FLAG_IO)),
- m_audiosquelch(0),
- m_videosquelch(0),
- m_fieldnum(0),
- m_curtrack(0),
- m_maxtrack(0),
- m_attospertrack(0),
- m_sliderupdate(attotime::zero),
- m_videoindex(0),
- m_stream(nullptr),
- m_audiobufsize(0),
- m_audiobufin(0),
- m_audiobufout(0),
- m_audiocursamples(0),
- m_audiomaxsamples(0),
- m_videoenable(false),
- m_videotex(nullptr),
- m_videopalette(nullptr),
- m_overenable(false),
- m_overindex(0),
- m_overtex(nullptr)
+ : device_t(mconfig, type, tag, owner, clock)
+ , device_sound_interface(mconfig, *this)
+ , device_video_interface(mconfig, *this)
+ , m_getdisc_callback(*this)
+ , m_audio_callback(*this)
+ , m_overwidth(0)
+ , m_overheight(0)
+ , m_overclip(0, -1, 0, -1)
+ , m_overupdate_rgb32(*this)
+ , m_disc(nullptr)
+ , m_is_cav_disc(false)
+ , m_width(0)
+ , m_height(0)
+ , m_fps_times_1million(0)
+ , m_samplerate(0)
+ , m_readresult()
+ , m_chdtracks(0)
+ , m_work_queue(osd_work_queue_alloc(WORK_QUEUE_FLAG_IO))
+ , m_audiosquelch(0)
+ , m_videosquelch(0)
+ , m_fieldnum(0)
+ , m_curtrack(0)
+ , m_maxtrack(0)
+ , m_attospertrack(0)
+ , m_sliderupdate(attotime::zero)
+ , m_videoindex(0)
+ , m_stream(nullptr)
+ , m_audiobufsize(0)
+ , m_audiobufin(0)
+ , m_audiobufout(0)
+ , m_audiocursamples(0)
+ , m_audiomaxsamples(0)
+ , m_videoenable(false)
+ , m_videotex(nullptr)
+ , m_videopalette(nullptr)
+ , m_overenable(false)
+ , m_overindex(0)
+ , m_overtex(nullptr)
{
// initialize overlay_config
m_orig_config.m_overposx = m_orig_config.m_overposy = 0.0f;
@@ -184,8 +197,10 @@ uint32_t laserdisc_device::screen_update(screen_device &screen, bitmap_rgb32 &bi
screen.container().empty();
// add the video texture
- if (m_videoenable)
- screen.container().add_quad(0.0f, 0.0f, 1.0f, 1.0f, rgb_t(0xff,0xff,0xff,0xff), m_videotex, PRIMFLAG_BLENDMODE(BLENDMODE_NONE) | PRIMFLAG_SCREENTEX(1));
+ rgb_t videocolor = 0xffffffff; // Fully visible, white
+ if (!m_videoenable)
+ videocolor = 0xff000000; // Blank the texture's RGB of the texture
+ screen.container().add_quad(0.0f, 0.0f, 1.0f, 1.0f, videocolor, m_videotex, PRIMFLAG_BLENDMODE(BLENDMODE_NONE) | PRIMFLAG_SCREENTEX(1));
// add the overlay
if (m_overenable && overbitmap.valid())
@@ -198,7 +213,7 @@ uint32_t laserdisc_device::screen_update(screen_device &screen, bitmap_rgb32 &bi
}
// swap to the next bitmap
- m_overindex = (m_overindex + 1) % ARRAY_LENGTH(m_overbitmap);
+ m_overindex = (m_overindex + 1) % std::size(m_overbitmap);
}
return 0;
}
@@ -219,8 +234,81 @@ void laserdisc_device::device_start()
init_video();
init_audio();
+ // register our timer
+ m_vbi_fetch_timer = timer_alloc(FUNC(laserdisc_device::fetch_vbi_data), this);
+
// register callbacks
- machine().configuration().config_register("laserdisc", config_load_delegate(&laserdisc_device::config_load, this), config_save_delegate(&laserdisc_device::config_save, this));
+ machine().configuration().config_register(
+ "laserdisc",
+ configuration_manager::load_delegate(&laserdisc_device::config_load, this),
+ configuration_manager::save_delegate(&laserdisc_device::config_save, this));
+
+ // register state
+ save_item(NAME(m_player_state.m_state));
+ save_item(NAME(m_player_state.m_substate));
+ save_item(NAME(m_player_state.m_param));
+ save_item(NAME(m_player_state.m_endtime));
+
+ save_item(NAME(m_saved_state.m_state));
+ save_item(NAME(m_saved_state.m_substate));
+ save_item(NAME(m_saved_state.m_param));
+ save_item(NAME(m_saved_state.m_endtime));
+
+ save_item(NAME(m_overposx));
+ save_item(NAME(m_overposy));
+ save_item(NAME(m_overscalex));
+ save_item(NAME(m_overscaley));
+
+ save_item(NAME(m_orig_config.m_overposx));
+ save_item(NAME(m_orig_config.m_overposy));
+ save_item(NAME(m_orig_config.m_overscalex));
+ save_item(NAME(m_orig_config.m_overscaley));
+
+ save_item(NAME(m_overwidth));
+ save_item(NAME(m_overheight));
+ save_item(NAME(m_overclip.min_x));
+ save_item(NAME(m_overclip.max_x));
+ save_item(NAME(m_overclip.min_y));
+ save_item(NAME(m_overclip.max_y));
+
+ save_item(NAME(m_vbidata));
+ save_item(NAME(m_is_cav_disc));
+ save_item(NAME(m_width));
+ save_item(NAME(m_height));
+ save_item(NAME(m_fps_times_1million));
+ save_item(NAME(m_samplerate));
+ save_item(NAME(m_chdtracks));
+
+ save_item(NAME(m_audiosquelch));
+ save_item(NAME(m_videosquelch));
+ save_item(NAME(m_fieldnum));
+ save_item(NAME(m_curtrack));
+ save_item(NAME(m_maxtrack));
+ save_item(NAME(m_attospertrack));
+ save_item(NAME(m_sliderupdate));
+
+ save_item(STRUCT_MEMBER(m_frame, m_numfields));
+ save_item(STRUCT_MEMBER(m_frame, m_lastfield));
+ save_item(NAME(m_videoindex));
+
+ save_item(NAME(m_audiobuffer[0]));
+ save_item(NAME(m_audiobuffer[1]));
+ save_item(NAME(m_audiobufsize));
+ save_item(NAME(m_audiobufin));
+ save_item(NAME(m_audiobufout));
+ save_item(NAME(m_audiocursamples));
+ save_item(NAME(m_audiomaxsamples));
+
+ save_item(STRUCT_MEMBER(m_metadata, white));
+ save_item(STRUCT_MEMBER(m_metadata, line16));
+ save_item(STRUCT_MEMBER(m_metadata, line17));
+ save_item(STRUCT_MEMBER(m_metadata, line18));
+ save_item(STRUCT_MEMBER(m_metadata, line1718));
+
+ save_item(NAME(m_videoenable));
+
+ save_item(NAME(m_overenable));
+ save_item(NAME(m_overindex));
}
@@ -231,15 +319,15 @@ void laserdisc_device::device_start()
void laserdisc_device::device_stop()
{
// make sure all async operations have completed
- if (m_disc != nullptr)
+ if (m_disc)
osd_work_queue_wait(m_work_queue, osd_ticks_per_second() * 10);
// free any textures and palettes
- if (m_videotex != nullptr)
+ if (m_videotex)
machine().render().texture_free(m_videotex);
- if (m_videopalette != nullptr)
+ if (m_videopalette)
m_videopalette->deref();
- if (m_overtex != nullptr)
+ if (m_overtex)
machine().render().texture_free(m_overtex);
}
@@ -253,7 +341,7 @@ void laserdisc_device::device_reset()
// attempt to wire up the audio
m_stream->set_sample_rate(m_samplerate);
- // set up the general ld
+ // set up the general LD
m_audiosquelch = 3;
m_videosquelch = 1;
m_fieldnum = 0;
@@ -272,35 +360,30 @@ void laserdisc_device::device_validity_check(validity_checker &valid) const
{
}
+
//-------------------------------------------------
-// device_timer - handle timers set by this
-// device
+// fetch_vbi_data - perform an update and
+// process the track that was read, including
+// VBI data
//-------------------------------------------------
-void laserdisc_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
+TIMER_CALLBACK_MEMBER(laserdisc_device::fetch_vbi_data)
{
- switch (id)
- {
- case TID_VBI_FETCH:
- {
- // wait for previous read and decode to finish
- process_track_data();
+ // wait for previous read and decode to finish
+ process_track_data();
- // update current track based on slider speed
- update_slider_pos();
+ // update current track based on slider speed
+ update_slider_pos();
- // update the state
- add_and_clamp_track(player_update(m_metadata[m_fieldnum], m_fieldnum, machine().time()));
+ // update the state
+ add_and_clamp_track(player_update(m_metadata[m_fieldnum], m_fieldnum, machine().time()));
- // flush any audio before we read more
- m_stream->update();
+ // flush any audio before we read more
+ m_stream->update();
- // start reading the track data for the next round
- m_fieldnum ^= 1;
- read_track_data();
- break;
- }
- }
+ // start reading the track data for the next round
+ m_fieldnum ^= 1;
+ read_track_data();
}
@@ -309,7 +392,7 @@ void laserdisc_device::device_timer(emu_timer &timer, device_timer_id id, int pa
// laserdiscs
//-------------------------------------------------
-void laserdisc_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void laserdisc_device::sound_stream_update(sound_stream &stream)
{
// compute AND values based on the squelch
int16_t leftand = (m_audiosquelch & 1) ? 0x0000 : 0xffff;
@@ -320,27 +403,18 @@ void laserdisc_device::sound_stream_update(sound_stream &stream, stream_sample_t
if (samples_avail < 0)
samples_avail += m_audiobufsize;
- // if no attached ld, just clear the buffers
- stream_sample_t *dst0 = outputs[0];
- stream_sample_t *dst1 = outputs[1];
- if (samples_avail < samples)
- {
- memset(dst0, 0, samples * sizeof(dst0[0]));
- memset(dst1, 0, samples * sizeof(dst1[0]));
- }
-
- // otherwise, stream from our buffer
- else
+ if (samples_avail >= stream.samples())
{
int16_t *buffer0 = &m_audiobuffer[0][0];
int16_t *buffer1 = &m_audiobuffer[1][0];
int sampout = m_audiobufout;
// copy samples, clearing behind us as we go
- while (sampout != m_audiobufin && samples-- > 0)
+ int sampindex;
+ for (sampindex = 0; sampout != m_audiobufin && sampindex < stream.samples(); sampindex++)
{
- *dst0++ = buffer0[sampout] & leftand;
- *dst1++ = buffer1[sampout] & rightand;
+ stream.put_int(0, sampindex, buffer0[sampout] & leftand, 32768);
+ stream.put_int(1, sampindex, buffer1[sampout] & rightand, 32768);
buffer0[sampout] = 0;
buffer1[sampout] = 0;
sampout++;
@@ -350,16 +424,16 @@ void laserdisc_device::sound_stream_update(sound_stream &stream, stream_sample_t
m_audiobufout = sampout;
// clear out the rest of the buffer
- if (samples > 0)
+ if (sampindex < stream.samples())
{
sampout = (m_audiobufout == 0) ? m_audiobufsize - 1 : m_audiobufout - 1;
- stream_sample_t fill0 = buffer0[sampout] & leftand;
- stream_sample_t fill1 = buffer1[sampout] & rightand;
+ s32 fill0 = buffer0[sampout] & leftand;
+ s32 fill1 = buffer1[sampout] & rightand;
- while (samples-- > 0)
+ for ( ; sampindex < stream.samples(); sampindex++)
{
- *dst0++ = fill0;
- *dst1++ = fill1;
+ stream.put_int(0, sampindex, fill0, 32768);
+ stream.put_int(1, sampindex, fill1, 32768);
}
}
}
@@ -372,29 +446,30 @@ void laserdisc_device::sound_stream_update(sound_stream &stream, stream_sample_t
//-------------------------------------------------
// set_slider_speed - dynamically change the
-// slider speed
+// slider speed, supports fractional values
//-------------------------------------------------
-void laserdisc_device::set_slider_speed(int32_t tracks_per_vsync)
+void laserdisc_device::set_slider_speed(const double tracks_per_vsync)
{
// update to the current time
update_slider_pos();
// if 0, set the time to 0
- attotime vsyncperiod = screen().frame_period();
+ double vsyncperiod = screen().frame_period().as_double();
if (tracks_per_vsync == 0)
m_attospertrack = 0;
// positive values store positive times
else if (tracks_per_vsync > 0)
- m_attospertrack = (vsyncperiod / tracks_per_vsync).as_attoseconds();
+ m_attospertrack = DOUBLE_TO_ATTOSECONDS(vsyncperiod / tracks_per_vsync);
// negative values store negative times
else
- m_attospertrack = -(vsyncperiod / -tracks_per_vsync).as_attoseconds();
+ {
+ m_attospertrack = DOUBLE_TO_ATTOSECONDS(-vsyncperiod / -tracks_per_vsync);
+ }
- if (LOG_SLIDER)
- printf("Slider speed = %d\n", tracks_per_vsync);
+ LOGMASKED(LOG_SLIDER, "Slider speed = %f\n", tracks_per_vsync);
}
@@ -410,8 +485,7 @@ void laserdisc_device::advance_slider(int32_t numtracks)
// then update the track position
add_and_clamp_track(numtracks);
- if (LOG_SLIDER)
- printf("Advance by %d\n", numtracks);
+ LOGMASKED(LOG_SLIDER, "Advance by %d\n", numtracks);
}
@@ -629,6 +703,8 @@ int32_t laserdisc_device::generic_update(const vbi_metadata &vbi, int fieldnum,
void laserdisc_device::init_disc()
{
+ m_getdisc_callback.resolve();
+
// get a handle to the disc to play
if (!m_getdisc_callback.isnull())
m_disc = m_getdisc_callback();
@@ -641,10 +717,10 @@ void laserdisc_device::init_disc()
m_fps_times_1million = 59940000;
m_samplerate = 48000;
- // get the disc metadata and extract the ld
+ // get the disc metadata and extract the LD
m_chdtracks = 0;
m_maxtrack = VIRTUAL_LEAD_IN_TRACKS + MAX_TOTAL_TRACKS + VIRTUAL_LEAD_OUT_TRACKS;
- if (m_disc != nullptr)
+ if (m_disc)
{
// require the A/V codec and nothing else
if (m_disc->compression(0) != CHD_CODEC_AVHUFF || m_disc->compression(1) != CHD_CODEC_NONE)
@@ -652,8 +728,9 @@ void laserdisc_device::init_disc()
// read the metadata
std::string metadata;
- chd_error err = m_disc->read_metadata(AV_METADATA_TAG, 0, metadata);
- if (err != CHDERR_NONE)
+ std::error_condition err;
+ err = m_disc->read_metadata(AV_METADATA_TAG, 0, metadata);
+ if (err)
throw emu_fatalerror("Non-A/V CHD file specified");
// extract the metadata
@@ -673,8 +750,25 @@ void laserdisc_device::init_disc()
// allocate memory for the precomputed per-frame metadata
err = m_disc->read_metadata(AV_LD_METADATA_TAG, 0, m_vbidata);
- if (err != CHDERR_NONE || m_vbidata.size() != totalhunks * VBI_PACKED_BYTES)
+ if (err || (m_vbidata.size() != totalhunks * VBI_PACKED_BYTES))
throw emu_fatalerror("Precomputed VBI metadata missing or incorrect size");
+
+ m_is_cav_disc = false;
+ vbi_metadata vbidata_even = { 0 };
+ vbi_metadata_unpack(&vbidata_even, nullptr, &m_vbidata[m_chdtracks * VBI_PACKED_BYTES]);
+ if ((vbidata_even.line1718 & VBI_MASK_CAV_PICTURE) == VBI_CODE_CAV_PICTURE)
+ {
+ m_is_cav_disc = true;
+ }
+ else
+ {
+ vbi_metadata vbidata_odd = { 0 };
+ vbi_metadata_unpack(&vbidata_odd, nullptr, &m_vbidata[(m_chdtracks + 1) * VBI_PACKED_BYTES]);
+ if ((vbidata_odd.line1718 & VBI_MASK_CAV_PICTURE) == VBI_CODE_CAV_PICTURE)
+ {
+ m_is_cav_disc = true;
+ }
+ }
}
m_maxtrack = std::max(m_maxtrack, VIRTUAL_LEAD_IN_TRACKS + VIRTUAL_LEAD_OUT_TRACKS + m_chdtracks);
}
@@ -707,10 +801,10 @@ void laserdisc_device::init_video()
fillbitmap_yuy16(frame.m_bitmap, 40, 109, 240);
// make a copy of the bitmap that clips out the VBI and horizontal blanking areas
- frame.m_visbitmap.wrap(&frame.m_bitmap.pix16(44, frame.m_bitmap.width() * 8 / 720),
- frame.m_bitmap.width() - 2 * frame.m_bitmap.width() * 8 / 720,
- frame.m_bitmap.height() - 44,
- frame.m_bitmap.rowpixels());
+ frame.m_visbitmap.wrap(&frame.m_bitmap.pix(
+ 44, frame.m_bitmap.width() * 8 / 720),
+ frame.m_bitmap.width() - 2 * frame.m_bitmap.width() * 8 / 720, frame.m_bitmap.height() - 44,
+ frame.m_bitmap.rowpixels());
frame.m_visbitmap.set_palette(m_videopalette);
}
@@ -730,7 +824,7 @@ void laserdisc_device::init_video()
if (m_overenable)
{
// bind our handlers
- m_overupdate_rgb32.bind_relative_to(*owner());
+ m_overupdate_rgb32.resolve();
// allocate overlay bitmaps
for (auto & elem : m_overbitmap)
@@ -754,6 +848,8 @@ void laserdisc_device::init_video()
void laserdisc_device::init_audio()
{
+ m_audio_callback.resolve();
+
// allocate a stream
m_stream = stream_alloc(0, 2, 48000);
@@ -782,7 +878,7 @@ void laserdisc_device::fillbitmap_yuy16(bitmap_yuy16 &bitmap, uint8_t yval, uint
// write 32 bits of color (2 pixels at a time)
for (int y = 0; y < bitmap.height(); y++)
{
- uint16_t *dest = &bitmap.pix16(y);
+ uint16_t *dest = &bitmap.pix(y);
for (int x = 0; x < bitmap.width() / 2; x++)
{
*dest++ = color0;
@@ -846,8 +942,8 @@ void laserdisc_device::vblank_state_changed(screen_device &screen, bool vblank_s
// call the player's VSYNC callback
player_vsync(m_metadata[m_fieldnum], m_fieldnum, machine().time());
- // set a timer to begin fetching the next frame just before the VBI data would be fetched
- timer_set(screen.time_until_pos(16*2), TID_VBI_FETCH);
+ // set our timer to begin fetching the next frame just before the VBI data would be fetched
+ m_vbi_fetch_timer->adjust(screen.time_until_pos(16*2));
}
}
@@ -862,7 +958,7 @@ laserdisc_device::frame_data &laserdisc_device::current_frame()
// determine the most recent live set of frames
frame_data *frame = &m_frame[m_videoindex];
if (frame->m_numfields < 2)
- frame = &m_frame[(m_videoindex + ARRAY_LENGTH(m_frame) - 1) % ARRAY_LENGTH(m_frame)];
+ frame = &m_frame[(m_videoindex + std::size(m_frame) - 1) % std::size(m_frame)];
return *frame;
}
@@ -891,14 +987,14 @@ void laserdisc_device::read_track_data()
vbidata.line16 = 0;
vbidata.line17 = vbidata.line18 = vbidata.line1718 = VBI_CODE_LEADIN;
}
-//printf("track %5d.%d: %06X %06X %06X\n", m_curtrack, m_fieldnum, vbidata.line16, vbidata.line17, vbidata.line18);
+ LOGMASKED(LOG_SLIDER, "track %5d.%d: %06X %06X %06X\n", m_curtrack, m_fieldnum, vbidata.line16, vbidata.line17, vbidata.line18);
// if we're about to read the first field in a frame, advance
frame_data *frame = &m_frame[m_videoindex];
if ((vbidata.line1718 & VBI_MASK_CAV_PICTURE) == VBI_CODE_CAV_PICTURE)
{
if (frame->m_numfields >= 2)
- m_videoindex = (m_videoindex + 1) % ARRAY_LENGTH(m_frame);
+ m_videoindex = (m_videoindex + 1) % std::size(m_frame);
frame = &m_frame[m_videoindex];
frame->m_numfields = 0;
}
@@ -911,7 +1007,8 @@ void laserdisc_device::read_track_data()
frame->m_lastfield = m_curtrack * 2 + m_fieldnum;
// set the video target information
- m_avhuff_config.video.wrap(&frame->m_bitmap.pix16(m_fieldnum), frame->m_bitmap.width(), frame->m_bitmap.height() / 2, frame->m_bitmap.rowpixels() * 2);
+ m_avhuff_video.wrap(&frame->m_bitmap.pix(m_fieldnum), frame->m_bitmap.width(), frame->m_bitmap.height() / 2, frame->m_bitmap.rowpixels() * 2);
+ m_avhuff_config.video = &m_avhuff_video;
// set the audio target information
if (m_audiobufin + m_audiomaxsamples <= m_audiobufsize)
@@ -947,14 +1044,14 @@ void laserdisc_device::read_track_data()
}
// configure the codec and then read
- m_readresult = CHDERR_FILE_NOT_FOUND;
- if (m_disc != nullptr && !m_videosquelch)
+ m_readresult = std::errc::no_such_file_or_directory;
+ if (m_disc && !m_videosquelch)
{
m_readresult = m_disc->codec_configure(CHD_CODEC_AVHUFF, AVHUFF_CODEC_DECOMPRESS_CONFIG, &m_avhuff_config);
- if (m_readresult == CHDERR_NONE)
+ if (!m_readresult)
{
m_queued_hunknum = readhunk;
- m_readresult = CHDERR_OPERATION_PENDING;
+ m_readresult = chd_file::error::OPERATION_PENDING;
osd_work_item_queue(m_work_queue, read_async_static, this, WORK_ITEM_FLAG_AUTO_RELEASE);
}
}
@@ -969,7 +1066,7 @@ void laserdisc_device::read_track_data()
void *laserdisc_device::read_async_static(void *param, int threadid)
{
laserdisc_device &ld = *reinterpret_cast<laserdisc_device *>(param);
- ld.m_readresult = ld.m_disc->read_hunk(ld.m_queued_hunknum, nullptr);
+ ld.m_readresult = ld.m_disc->codec_process_hunk(ld.m_queued_hunknum);
return nullptr;
}
@@ -982,19 +1079,19 @@ void *laserdisc_device::read_async_static(void *param, int threadid)
void laserdisc_device::process_track_data()
{
// wait for the async operation to complete
- if (m_readresult == CHDERR_OPERATION_PENDING)
+ if (m_readresult == chd_file::error::OPERATION_PENDING)
osd_work_queue_wait(m_work_queue, osd_ticks_per_second() * 10);
- assert(m_readresult != CHDERR_OPERATION_PENDING);
+ assert(m_readresult != chd_file::error::OPERATION_PENDING);
// remove the video if we had an error
- if (m_readresult != CHDERR_NONE)
- m_avhuff_config.video.reset();
+ if (m_readresult)
+ m_avhuff_video.reset();
// count the field as read if we are successful
- if (m_avhuff_config.video.valid())
+ if (m_avhuff_video.valid())
{
m_frame[m_videoindex].m_numfields++;
- player_overlay(m_avhuff_config.video);
+ player_overlay(m_avhuff_video);
}
// pass the audio to the callback
@@ -1031,20 +1128,16 @@ void laserdisc_device::process_track_data()
// configuration file
//-------------------------------------------------
-void laserdisc_device::config_load(config_type cfg_type, util::xml::data_node const *parentnode)
+void laserdisc_device::config_load(config_type cfg_type, config_level cfg_level, util::xml::data_node const *parentnode)
{
- // we only care about game files
- if (cfg_type != config_type::GAME)
- return;
-
- // might not have any data
- if (parentnode == nullptr)
+ // we only care system-specific configuration
+ if ((cfg_type != config_type::SYSTEM) || !parentnode)
return;
// iterate over overlay nodes
for (util::xml::data_node const *ldnode = parentnode->get_child("device"); ldnode != nullptr; ldnode = ldnode->get_next_sibling("device"))
{
- const char *devtag = ldnode->get_attribute_string("tag", "");
+ char const *const devtag = ldnode->get_attribute_string("tag", "");
if (strcmp(devtag, tag()) == 0)
{
// handle the overlay node
@@ -1069,13 +1162,13 @@ void laserdisc_device::config_load(config_type cfg_type, util::xml::data_node co
void laserdisc_device::config_save(config_type cfg_type, util::xml::data_node *parentnode)
{
- // we only care about game files
- if (cfg_type != config_type::GAME)
+ // we only save system-specific configuration
+ if (cfg_type != config_type::SYSTEM)
return;
// create a node
util::xml::data_node *const ldnode = parentnode->add_child("device", nullptr);
- if (ldnode != nullptr)
+ if (ldnode)
{
// output the basics
ldnode->set_attribute("tag", tag());