Skip to content

Commit 1d7b212

Browse files
committed
Media: fix code smells
1 parent 4b6f2a9 commit 1d7b212

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

src/detection/media/media_apple.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
extern void MRMediaRemoteGetNowPlayingClient(dispatch_queue_t dispatcher, void (^callback)(_Nullable id clientObj)) __attribute__((weak_import));
1212
extern CFStringRef MRNowPlayingClientGetBundleIdentifier(id clientObj) __attribute__((weak_import));
1313
extern CFStringRef MRNowPlayingClientGetParentAppBundleIdentifier(id clientObj) __attribute__((weak_import));
14-
void MRMediaRemoteGetNowPlayingApplicationIsPlaying(dispatch_queue_t queue, void (^callback)(BOOL playing));
14+
void MRMediaRemoteGetNowPlayingApplicationIsPlaying(dispatch_queue_t queue, void (^callback)(BOOL playing)) __attribute__((weak_import));
1515

1616
static const char* getMedia(FFMediaResult* result)
1717
{
@@ -20,6 +20,7 @@
2020
FF_TEST_FN_EXISTANCE(MRMediaRemoteGetNowPlayingClient);
2121
FF_TEST_FN_EXISTANCE(MRNowPlayingClientGetBundleIdentifier);
2222
FF_TEST_FN_EXISTANCE(MRNowPlayingClientGetParentAppBundleIdentifier);
23+
FF_TEST_FN_EXISTANCE(MRMediaRemoteGetNowPlayingApplicationIsPlaying);
2324
#undef FF_TEST_FN_EXISTANCE
2425

2526
dispatch_group_t group = dispatch_group_create();
@@ -63,6 +64,7 @@
6364
});
6465

6566
dispatch_group_wait(group, DISPATCH_TIME_FOREVER);
67+
// Don't dispatch_release because we are using ARC
6668

6769
if(result->playerId.length > 0)
6870
{

src/detection/media/media_linux.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,9 @@ static bool getBusProperties(FFDBusData* data, const char* busName, FFMediaResul
129129
}
130130
else
131131
{
132-
char str[] = { fileName[1], fileName[2], 0 };
133-
if (str[0] == 0 || str[1] == 0)
132+
if (fileName[1] == 0 || fileName[2] == 0)
134133
break;
134+
char str[] = { fileName[1], fileName[2], 0 };
135135
ffStrbufAppendC(&result->song, (char) strtoul(str, NULL, 16));
136136
fileName += 2;
137137
}

src/detection/media/media_windows.dll.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ const char* ffWinrtDetectMedia(FFWinrtMediaResult* result)
3232
{
3333
switch (playbackInfo.PlaybackStatus())
3434
{
35-
#define FF_MEDIA_SET_STATUS(status_code) \
36-
case GlobalSystemMediaTransportControlsSessionPlaybackStatus::status_code: result->status = #status_code; break
37-
FF_MEDIA_SET_STATUS(Closed);
38-
FF_MEDIA_SET_STATUS(Opened);
39-
FF_MEDIA_SET_STATUS(Changing);
40-
FF_MEDIA_SET_STATUS(Stopped);
41-
FF_MEDIA_SET_STATUS(Playing);
42-
FF_MEDIA_SET_STATUS(Paused);
43-
#undef FF_MEDIA_SET_STATUS
35+
#define FF_MEDIA_SET_STATUS(status_code) \
36+
case GlobalSystemMediaTransportControlsSessionPlaybackStatus::status_code: result->status = #status_code; break;
37+
FF_MEDIA_SET_STATUS(Closed)
38+
FF_MEDIA_SET_STATUS(Opened)
39+
FF_MEDIA_SET_STATUS(Changing)
40+
FF_MEDIA_SET_STATUS(Stopped)
41+
FF_MEDIA_SET_STATUS(Playing)
42+
FF_MEDIA_SET_STATUS(Paused)
43+
#undef FF_MEDIA_SET_STATUS
4444
}
4545
}
4646

0 commit comments

Comments
 (0)