Skip to content

Commit 5d965b1

Browse files
committed
[[ WindowsPlayer ]] Update callback marker times to be MCPlatformPlayerDuration
1 parent dfa2935 commit 5d965b1

8 files changed

Lines changed: 24 additions & 18 deletions

File tree

engine/src/desktop.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1352,7 +1352,7 @@ void MCPlatformHandlePlayerFrameChanged(MCPlatformPlayerRef p_player)
13521352
MCPlatformBreakWait();
13531353
}
13541354

1355-
void MCPlatformHandlePlayerMarkerChanged(MCPlatformPlayerRef p_player, uint32_t p_time)
1355+
void MCPlatformHandlePlayerMarkerChanged(MCPlatformPlayerRef p_player, MCPlatformPlayerDuration p_time)
13561356
{
13571357
MCPlayer *t_player;
13581358
t_player = find_player(p_player);

engine/src/mac-av-player.mm

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ static CVReturn MyDisplayLinkCallback (CVDisplayLinkRef displayLink,
146146
// MW-2014-10-22: [[ Bug 13267 ]] Use an end-time observer rather than the built in 'action at end' (10.8 bug).
147147
id m_endtime_observer_token;
148148

149-
uint32_t *m_markers;
149+
MCPlatformPlayerDuration *m_markers;
150150
uindex_t m_marker_count;
151151
uint32_t m_last_marker;
152152

@@ -1140,15 +1140,17 @@ bool MCMacPlayerSnapshotCVImageBuffer(CVImageBufferRef p_imagebuffer, uint32_t p
11401140
break;
11411141
case kMCPlatformPlayerPropertyMarkers:
11421142
{
1143-
array_t<uint32_t> *t_markers;
1144-
t_markers = (array_t<uint32_t> *)p_value;
1143+
MCAssert(p_type == kMCPlatformPropertyTypePlayerDurationArray);
1144+
1145+
array_t<MCPlatformPlayerDuration> *t_markers;
1146+
t_markers = (array_t<MCPlatformPlayerDuration> *)p_value;
11451147

11461148
m_last_marker = UINT32_MAX;
11471149
MCMemoryDeleteArray(m_markers);
11481150
m_markers = nil;
11491151

11501152
/* UNCHECKED */ MCMemoryResizeArray(t_markers -> count, m_markers, m_marker_count);
1151-
MCMemoryCopy(m_markers, t_markers -> ptr, m_marker_count * sizeof(uint32_t));
1153+
MCMemoryCopy(m_markers, t_markers -> ptr, m_marker_count * sizeof(MCPlatformPlayerDuration));
11521154
}
11531155
break;
11541156
}

engine/src/mac-qt-player.mm

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ - (NSView *) newHitTest: (NSPoint) aPoint;
119119

120120
com_runrev_livecode_MCQTKitPlayerObserver *m_observer;
121121

122-
uint32_t *m_markers;
122+
MCPlatformPlayerDuration *m_markers;
123123
uindex_t m_marker_count;
124124
uint32_t m_last_marker;
125125
double m_scale;
@@ -751,15 +751,17 @@ inline NSComparisonResult do_QTTimeCompare (QTTime time, QTTime otherTime)
751751
break;
752752
case kMCPlatformPlayerPropertyMarkers:
753753
{
754-
array_t<uint32_t> *t_markers;
755-
t_markers = (array_t<uint32_t> *)p_value;
754+
MCAssert(p_type == kMCPlatformPropertyTypePlayerDurationArray);
755+
756+
array_t<MCPlatformPlayerDuration> *t_markers;
757+
t_markers = (array_t<MCPlatformPlayerDuration> *)p_value;
756758

757759
m_last_marker = UINT32_MAX;
758760
MCMemoryDeleteArray(m_markers);
759761
m_markers = nil;
760762

761763
/* UNCHECKED */ MCMemoryResizeArray(t_markers -> count, m_markers, m_marker_count);
762-
MCMemoryCopy(m_markers, t_markers -> ptr, m_marker_count * sizeof(uint32_t));
764+
MCMemoryCopy(m_markers, t_markers -> ptr, m_marker_count * sizeof(MCPlatformPlayerDuration));
763765
}
764766
break;
765767
}

engine/src/platform-internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ void MCPlatformCallbackSendMenuSelect(MCPlatformMenuRef menu, uindex_t item);
369369
void MCPlatformCallbackSendViewFocusSwitched(MCPlatformWindowRef window, uint32_t view_id);
370370

371371
void MCPlatformCallbackSendPlayerFrameChanged(MCPlatformPlayerRef player);
372-
void MCPlatformCallbackSendPlayerMarkerChanged(MCPlatformPlayerRef player, uint32_t time);
372+
void MCPlatformCallbackSendPlayerMarkerChanged(MCPlatformPlayerRef player, MCPlatformPlayerDuration time);
373373
void MCPlatformCallbackSendPlayerCurrentTimeChanged(MCPlatformPlayerRef player);
374374
void MCPlatformCallbackSendPlayerFinished(MCPlatformPlayerRef player);
375375
void MCPlatformCallbackSendPlayerBufferUpdated(MCPlatformPlayerRef player);

engine/src/platform.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ void MCPlatformHandleMenuSelect(MCPlatformMenuRef menu, uindex_t index);
7474
void MCPlatformHandleViewFocusSwitched(MCPlatformWindowRef window, uint32_t id);
7575

7676
void MCPlatformHandlePlayerFrameChanged(MCPlatformPlayerRef player);
77-
void MCPlatformHandlePlayerMarkerChanged(MCPlatformPlayerRef player, uint32_t time);
77+
void MCPlatformHandlePlayerMarkerChanged(MCPlatformPlayerRef player, MCPlatformPlayerDuration time);
7878
void MCPlatformHandlePlayerCurrentTimeChanged(MCPlatformPlayerRef player);
7979
void MCPlatformHandlePlayerFinished(MCPlatformPlayerRef player);
8080
void MCPlatformHandlePlayerBufferUpdated(MCPlatformPlayerRef player);
@@ -394,7 +394,7 @@ void MCPlatformCallbackSendPlayerFrameChanged(MCPlatformPlayerRef p_player)
394394
MCPlatformHandlePlayerFrameChanged(p_player);
395395
}
396396

397-
void MCPlatformCallbackSendPlayerMarkerChanged(MCPlatformPlayerRef p_player, uint32_t p_time)
397+
void MCPlatformCallbackSendPlayerMarkerChanged(MCPlatformPlayerRef p_player, MCPlatformPlayerDuration p_time)
398398
{
399399
//MCLog("Player(%p) -> MarkerChanged(%d)", p_player, p_time);
400400
MCPlatformHandlePlayerMarkerChanged(p_player, p_time);

engine/src/platform.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ enum MCPlatformPropertyType
125125
kMCPlatformPropertyTypeCursorRef,
126126

127127
kMCPlatformPropertyTypeUInt32Array,
128+
kMCPlatformPropertyTypeUInt64Array,
128129

129130
kMCPlatformPropertyTypePointer,
130131

@@ -1018,6 +1019,7 @@ struct MCPlatformPlayerQTVRConstraints
10181019

10191020
typedef uint64_t MCPlatformPlayerDuration;
10201021
#define kMCPlatformPropertyTypePlayerDuration kMCPlatformPropertyTypeUInt64
1022+
#define kMCPlatformPropertyTypePlayerDurationArray kMCPlatformPropertyTypeUInt64Array
10211023
#define MCPlatformPlayerDurationMax UINT64_MAX
10221024

10231025
void MCPlatformCreatePlayer(bool dontuseqt, MCPlatformPlayerRef& r_player);

engine/src/player-platform.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2129,7 +2129,7 @@ void MCPlayer::updatetraversal()
21292129
// End of virtual MCPlayerInterface's functions
21302130
////////////////////////////////////////////////////////////////////////////////
21312131

2132-
void MCPlayer::markerchanged(uint32_t p_time)
2132+
void MCPlayer::markerchanged(MCPlatformPlayerDuration p_time)
21332133
{
21342134
// Search for the first marker with the given time, and dispatch the message.
21352135
for(uindex_t i = 0; i < m_callback_count; i++)
@@ -2247,7 +2247,7 @@ void MCPlayer::SynchronizeUserCallbacks(void)
22472247

22482248
// SN-2014-07-28: [[ Bug 12984 ]] Mimic the strtol behaviour in case of a parsing failure
22492249
if (MCNumberParse(*t_callback_substring, &t_time))
2250-
m_callbacks[m_callback_count - 1] . time = MCNumberFetchAsInteger(*t_time);
2250+
m_callbacks[m_callback_count - 1] . time = MCNumberFetchAsReal(*t_time);
22512251
else
22522252
m_callbacks[m_callback_count - 1] . time = 0;
22532253

@@ -2291,12 +2291,12 @@ void MCPlayer::SynchronizeUserCallbacks(void)
22912291
return;
22922292

22932293
// Now set the markers in the player so that we get notified.
2294-
array_t<uint32_t> t_markers;
2294+
array_t<MCPlatformPlayerDuration> t_markers;
22952295
/* UNCHECKED */ MCMemoryNewArray(m_callback_count, t_markers . ptr);
22962296
for(uindex_t i = 0; i < m_callback_count; i++)
22972297
t_markers . ptr[i] = m_callbacks[i] . time;
22982298
t_markers . count = m_callback_count;
2299-
MCPlatformSetPlayerProperty(m_platform_player, kMCPlatformPlayerPropertyMarkers, kMCPlatformPropertyTypeUInt32Array, &t_markers);
2299+
MCPlatformSetPlayerProperty(m_platform_player, kMCPlatformPlayerPropertyMarkers, kMCPlatformPropertyTypePlayerDurationArray, &t_markers);
23002300
MCMemoryDeleteArray(t_markers . ptr);
23012301
}
23022302

engine/src/player-platform.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ struct MCPlayerCallback
5656
{
5757
MCNameRef message;
5858
MCNameRef parameter;
59-
uint32_t time;
59+
MCPlayerDuration time;
6060
};
6161

6262
// SN-2014-07-23: [[ Bug 12893 ]] MCControl must be the first class inherited
@@ -371,7 +371,7 @@ class MCPlayer : public MCControl, public MCPlayerInterface
371371
return t_has_invalid_filename;
372372
}
373373

374-
void markerchanged(uint32_t p_time);
374+
void markerchanged(MCPlatformPlayerDuration p_time);
375375
void selectionchanged(void);
376376
void currenttimechanged(void);
377377
void moviefinished(void);

0 commit comments

Comments
 (0)