View Javadoc
1   /*
2    * Copyright (C) 2013 4th Line GmbH, Switzerland
3    *
4    * The contents of this file are subject to the terms of either the GNU
5    * Lesser General Public License Version 2 or later ("LGPL") or the
6    * Common Development and Distribution License Version 1 or later
7    * ("CDDL") (collectively, the "License"). You may not use this file
8    * except in compliance with the License. See LICENSE.txt for more
9    * information.
10   *
11   * This program is distributed in the hope that it will be useful,
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14   */
15  package org.fourthline.cling.support.model.dlna;
16  
17  /** DLNA.ORG_FLAGS, padded with 24 trailing 0s
18   *
19   * <pre>
20   *     80000000  31  senderPaced
21   *     40000000  30  lsopTimeBasedSeekSupported
22   *     20000000  29  lsopByteBasedSeekSupported
23   *     10000000  28  playcontainerSupported
24   *      8000000  27  s0IncreasingSupported
25   *      4000000  26  sNIncreasingSupported
26   *      2000000  25  rtspPauseSupported
27   *      1000000  24  streamingTransferModeSupported
28   *       800000  23  interactiveTransferModeSupported
29   *       400000  22  backgroundTransferModeSupported
30   *       200000  21  connectionStallingSupported
31   *       100000  20  dlnaVersion15Supported
32   *
33   *     Example: (1 << 24) | (1 << 22) | (1 << 21) | (1 << 20)
34   *       DLNA.ORG_FLAGS=01700000[000000000000000000000000] // [] show padding
35   * </pre>
36   *
37   * @author Mario Franco
38   */
39  public enum DLNAFlags {
40  
41      SENDER_PACED(1 << 31),
42      TIME_BASED_SEEK(1 << 30),
43      BYTE_BASED_SEEK(1 << 29),
44      FLAG_PLAY_CONTAINER(1 << 28),
45      S0_INCREASE(1 << 27),
46      SN_INCREASE(1 << 26),
47      RTSP_PAUSE(1 << 25),
48      STREAMING_TRANSFER_MODE(1 << 24),
49      INTERACTIVE_TRANSFERT_MODE(1 << 23),
50      BACKGROUND_TRANSFERT_MODE(1 << 22),
51      CONNECTION_STALL(1 << 21),
52      DLNA_V15(1 << 20);
53  
54      private int code;
55  
56      DLNAFlags(int code) {
57          this.code = code;
58      }
59  
60      public int getCode() {
61          return code;
62      }
63  
64      public static DLNAFlags valueOf(int code) {
65          for (DLNAFlags errorCode : values()) {
66              if (errorCode.getCode() == code) {
67                  return errorCode;
68              }
69          }
70          return null;
71      }
72  }