Skip to content

Commit da9f31e

Browse files
committed
Created static instances for "urn:x-cast:com.google.cast.media" and made Namespace implement equals() and hashCode()
1 parent 1956672 commit da9f31e

4 files changed

Lines changed: 73 additions & 48 deletions

File tree

src/main/java/org/digitalmediaserver/cast/CastDevice.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
import org.digitalmediaserver.cast.event.CastEvent.CastEventType;
4747
import org.digitalmediaserver.cast.event.CastEvent.ThreadedCastEventListenerList;
4848
import org.digitalmediaserver.cast.message.entity.Application;
49+
import org.digitalmediaserver.cast.message.entity.Namespace;
4950
import org.digitalmediaserver.cast.message.entity.ReceiverStatus;
5051
import org.digitalmediaserver.cast.message.entity.Volume;
5152
import org.digitalmediaserver.cast.message.enumeration.VirtualConnectionType;
@@ -67,6 +68,12 @@ public class CastDevice {
6768
/** The application ID for the "Default Media Receiver" application */
6869
public static final String DEFAULT_MEDIA_RECEIVER_APP_ID = "CC1AD845";
6970

71+
/** The namespace string for standard cast media control */
72+
public static final String CAST_MEDIA_NAMESPACE = "urn:x-cast:com.google.cast.media";
73+
74+
/** The {@link Namespace} string for standard cast media control */
75+
public static final Namespace CAST_MEDIA = new Namespace(CAST_MEDIA_NAMESPACE);
76+
7077
/** The {@link ExecutorService} that is used for asynchronous operations */
7178
@Nonnull
7279
protected static final ExecutorService EXECUTOR = createExecutor();

src/main/java/org/digitalmediaserver/cast/Channel.java

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -996,7 +996,7 @@ public MediaStatus getMediaStatus(@Nonnull Session session, long responseTimeout
996996
requireNotNull(session, "session");
997997
MediaStatusResponse status = send(
998998
session,
999-
"urn:x-cast:com.google.cast.media",
999+
CastDevice.CAST_MEDIA_NAMESPACE,
10001000
new GetStatus(),
10011001
session.sourceId,
10021002
session.destinationId,
@@ -1011,7 +1011,7 @@ public MediaStatus getMediaStatus(@Nonnull Session session, long responseTimeout
10111011
* {@link Load} request.
10121012
* <p>
10131013
* This can only succeed if the remote application supports the
1014-
* "{@code urn:x-cast:com.google.cast.media}" namespace.
1014+
* {@link CastDevice#CAST_MEDIA_NAMESPACE}.
10151015
*
10161016
* @param session the {@link Session} to use.
10171017
* @param loadRequest the {@link Load} request to send.
@@ -1043,7 +1043,7 @@ public MediaStatus load(
10431043
requireNotNull(loadRequest, "loadRequest");
10441044
MediaStatusResponse status = send(
10451045
session,
1046-
"urn:x-cast:com.google.cast.media",
1046+
CastDevice.CAST_MEDIA_NAMESPACE,
10471047
loadRequest,
10481048
session.sourceId,
10491049
session.destinationId,
@@ -1058,7 +1058,7 @@ public MediaStatus load(
10581058
* using the specified parameters.
10591059
* <p>
10601060
* This can only succeed if the remote application supports the
1061-
* "{@code urn:x-cast:com.google.cast.media}" namespace.
1061+
* {@link CastDevice#CAST_MEDIA_NAMESPACE}.
10621062
*
10631063
* @param session the {@link Session} to use.
10641064
* @param media the {@link Media} to load.
@@ -1098,7 +1098,7 @@ public MediaStatus load(
10981098
requireNotNull(media, "media");
10991099
MediaStatusResponse status = send(
11001100
session,
1101-
"urn:x-cast:com.google.cast.media",
1101+
CastDevice.CAST_MEDIA_NAMESPACE,
11021102
new Load(null, autoplay, null, null, currentTime, null, null, media, null, null),
11031103
session.sourceId,
11041104
session.destinationId,
@@ -1114,7 +1114,7 @@ public MediaStatus load(
11141114
* {@code media} or {@code queueData} must be non-{@code null}.
11151115
* <p>
11161116
* This can only succeed if the remote application supports the
1117-
* "{@code urn:x-cast:com.google.cast.media}" namespace.
1117+
* {@link CastDevice#CAST_MEDIA_NAMESPACE}.
11181118
*
11191119
* @param session the {@link Session} to use.
11201120
* @param activeTrackIds the {@link List} of track IDs that are active. If
@@ -1172,7 +1172,7 @@ public MediaStatus load(
11721172
requireNotNull(session, "session");
11731173
MediaStatusResponse status = send(
11741174
session,
1175-
"urn:x-cast:com.google.cast.media",
1175+
CastDevice.CAST_MEDIA_NAMESPACE,
11761176
new Load(
11771177
activeTrackIds,
11781178
autoplay,
@@ -1199,7 +1199,7 @@ public MediaStatus load(
11991199
* the timeout value.
12001200
* <p>
12011201
* This can only succeed if the remote application supports the
1202-
* "{@code urn:x-cast:com.google.cast.media}" namespace.
1202+
* {@link CastDevice#CAST_MEDIA_NAMESPACE}.
12031203
*
12041204
* @param session the {@link Session} to use.
12051205
* @param mediaSessionId the media session ID for which the play request
@@ -1231,7 +1231,7 @@ public MediaStatus play(
12311231
* specified media session ID.
12321232
* <p>
12331233
* This can only succeed if the remote application supports the
1234-
* "{@code urn:x-cast:com.google.cast.media}" namespace.
1234+
* {@link CastDevice#CAST_MEDIA_NAMESPACE}.
12351235
*
12361236
* @param session the {@link Session} to use.
12371237
* @param mediaSessionId the media session ID for which the play request
@@ -1259,7 +1259,7 @@ public MediaStatus play(
12591259
* specified media session ID.
12601260
* <p>
12611261
* This can only succeed if the remote application supports the
1262-
* "{@code urn:x-cast:com.google.cast.media}" namespace.
1262+
* {@link CastDevice#CAST_MEDIA_NAMESPACE}.
12631263
*
12641264
* @param session the {@link Session} to use.
12651265
* @param mediaSessionId the media session ID for which the play request
@@ -1290,7 +1290,7 @@ protected MediaStatus play(
12901290
requireNotNull(session, "session");
12911291
MediaStatusResponse status = send(
12921292
session,
1293-
"urn:x-cast:com.google.cast.media",
1293+
CastDevice.CAST_MEDIA_NAMESPACE,
12941294
new Play(mediaSessionId, session.id),
12951295
session.sourceId,
12961296
session.destinationId,
@@ -1306,7 +1306,7 @@ protected MediaStatus play(
13061306
* as the timeout value.
13071307
* <p>
13081308
* This can only succeed if the remote application supports the
1309-
* "{@code urn:x-cast:com.google.cast.media}" namespace.
1309+
* {@link CastDevice#CAST_MEDIA_NAMESPACE}.
13101310
*
13111311
* @param session the {@link Session} to use.
13121312
* @param mediaSessionId the media session ID for which the pause request
@@ -1338,7 +1338,7 @@ public MediaStatus pause(
13381338
* the specified media session ID.
13391339
* <p>
13401340
* This can only succeed if the remote application supports the
1341-
* "{@code urn:x-cast:com.google.cast.media}" namespace.
1341+
* {@link CastDevice#CAST_MEDIA_NAMESPACE}.
13421342
*
13431343
* @param session the {@link Session} to use.
13441344
* @param mediaSessionId the media session ID for which the pause request
@@ -1366,7 +1366,7 @@ public MediaStatus pause(
13661366
* the specified media session ID.
13671367
* <p>
13681368
* This can only succeed if the remote application supports the
1369-
* "{@code urn:x-cast:com.google.cast.media}" namespace.
1369+
* {@link CastDevice#CAST_MEDIA_NAMESPACE}.
13701370
*
13711371
* @param session the {@link Session} to use.
13721372
* @param mediaSessionId the media session ID for which the pause request
@@ -1397,7 +1397,7 @@ protected MediaStatus pause(
13971397
requireNotNull(session, "session");
13981398
MediaStatusResponse status = send(
13991399
session,
1400-
"urn:x-cast:com.google.cast.media",
1400+
CastDevice.CAST_MEDIA_NAMESPACE,
14011401
new Pause(mediaSessionId, session.id),
14021402
session.sourceId,
14031403
session.destinationId,
@@ -1413,7 +1413,7 @@ protected MediaStatus pause(
14131413
* using {@value #DEFAULT_RESPONSE_TIMEOUT} as the timeout value.
14141414
* <p>
14151415
* This can only succeed if the remote application supports the
1416-
* "{@code urn:x-cast:com.google.cast.media}" namespace.
1416+
* {@link CastDevice#CAST_MEDIA_NAMESPACE}.
14171417
*
14181418
* @param session the {@link Session} to use.
14191419
* @param mediaSessionId the media session ID for which the pause request
@@ -1458,7 +1458,7 @@ public MediaStatus seek(
14581458
* referenced by the specified media session ID to the specified position.
14591459
* <p>
14601460
* This can only succeed if the remote application supports the
1461-
* "{@code urn:x-cast:com.google.cast.media}" namespace.
1461+
* {@link CastDevice#CAST_MEDIA_NAMESPACE}.
14621462
*
14631463
* @param session the {@link Session} to use.
14641464
* @param mediaSessionId the media session ID for which the pause request
@@ -1492,7 +1492,7 @@ public MediaStatus seek(
14921492
* referenced by the specified media session ID to the specified position.
14931493
* <p>
14941494
* This can only succeed if the remote application supports the
1495-
* "{@code urn:x-cast:com.google.cast.media}" namespace.
1495+
* {@link CastDevice#CAST_MEDIA_NAMESPACE}.
14961496
*
14971497
* @param session the {@link Session} to use.
14981498
* @param mediaSessionId the media session ID for which the pause request
@@ -1529,7 +1529,7 @@ protected MediaStatus seek(
15291529
requireNotNull(session, "session");
15301530
MediaStatusResponse status = send(
15311531
session,
1532-
"urn:x-cast:com.google.cast.media",
1532+
CastDevice.CAST_MEDIA_NAMESPACE,
15331533
new Seek(mediaSessionId, session.id, currentTime, resumeState),
15341534
session.sourceId,
15351535
session.destinationId,
@@ -1545,7 +1545,7 @@ protected MediaStatus seek(
15451545
* {@value #DEFAULT_RESPONSE_TIMEOUT} as the timeout value.
15461546
* <p>
15471547
* This can only succeed if the remote application supports the
1548-
* "{@code urn:x-cast:com.google.cast.media}" namespace.
1548+
* {@link CastDevice#CAST_MEDIA_NAMESPACE}.
15491549
*
15501550
* @param session the {@link Session} to use.
15511551
* @param mediaSessionId the media session ID for which the
@@ -1573,7 +1573,7 @@ public MediaStatus stopMedia(@Nonnull Session session, int mediaSessionId, boole
15731573
* referenced by the specified media session ID.
15741574
* <p>
15751575
* This can only succeed if the remote application supports the
1576-
* "{@code urn:x-cast:com.google.cast.media}" namespace.
1576+
* {@link CastDevice#CAST_MEDIA_NAMESPACE}.
15771577
*
15781578
* @param session the {@link Session} to use.
15791579
* @param mediaSessionId the media session ID for which the
@@ -1601,7 +1601,7 @@ public MediaStatus stopMedia(
16011601
* referenced by the specified media session ID.
16021602
* <p>
16031603
* This can only succeed if the remote application supports the
1604-
* "{@code urn:x-cast:com.google.cast.media}" namespace.
1604+
* {@link CastDevice#CAST_MEDIA_NAMESPACE}.
16051605
*
16061606
* @param session the {@link Session} to use.
16071607
* @param mediaSessionId the media session ID for which the
@@ -1632,7 +1632,7 @@ protected MediaStatus stopMedia(
16321632
requireNotNull(session, "session");
16331633
MediaStatusResponse status = send(
16341634
session,
1635-
"urn:x-cast:com.google.cast.media",
1635+
CastDevice.CAST_MEDIA_NAMESPACE,
16361636
new StopMedia(mediaSessionId, null),
16371637
session.sourceId,
16381638
session.destinationId,
@@ -1650,7 +1650,7 @@ protected MediaStatus stopMedia(
16501650
* {@value #DEFAULT_RESPONSE_TIMEOUT} as the timeout value.
16511651
* <p>
16521652
* This can only succeed if the remote application supports the
1653-
* "{@code urn:x-cast:com.google.cast.media}" namespace.
1653+
* {@link CastDevice#CAST_MEDIA_NAMESPACE}.
16541654
*
16551655
* @param session the {@link Session} to use.
16561656
* @param mediaSessionId the media session ID for which the
@@ -1693,7 +1693,7 @@ public MediaStatus setMediaVolume(
16931693
* give the user no visual indication.
16941694
* <p>
16951695
* This can only succeed if the remote application supports the
1696-
* "{@code urn:x-cast:com.google.cast.media}" namespace.
1696+
* {@link CastDevice#CAST_MEDIA_NAMESPACE}.
16971697
*
16981698
* @param session the {@link Session} to use.
16991699
* @param mediaSessionId the media session ID for which the
@@ -1727,7 +1727,7 @@ public MediaStatus setMediaVolume(
17271727
* give the user no visual indication.
17281728
* <p>
17291729
* This can only succeed if the remote application supports the
1730-
* "{@code urn:x-cast:com.google.cast.media}" namespace.
1730+
* {@link CastDevice#CAST_MEDIA_NAMESPACE}.
17311731
*
17321732
* @param session the {@link Session} to use.
17331733
* @param mediaSessionId the media session ID for which the
@@ -1762,7 +1762,7 @@ protected MediaStatus setMediaVolume(
17621762
requireNotNull(session, "session");
17631763
MediaStatusResponse status = send(
17641764
session,
1765-
"urn:x-cast:com.google.cast.media",
1765+
CastDevice.CAST_MEDIA_NAMESPACE,
17661766
new VolumeRequest(session.id, mediaSessionId, volume, null),
17671767
session.sourceId,
17681768
session.destinationId,

0 commit comments

Comments
 (0)