1a1201626aa87a88bc2a8fd976db92724a244abe
[mediacube.git] /
1 package user.commons.nexio.server.protocol;\r
2 \r
3 import java.io.IOException;\r
4 \r
5 /*\r
6 Number                                          Field Description                                                                                                               Max Size\r
7 \r
8 0  Record Date/Time                     A FILETIME structure representing the time and date stamp \r
9                                                         of when the media was recorded                                                                                  8\r
10 1  Codec Where Recorded         The video server name and channel where the media was recorded                  19\r
11 2  Legacy Field                         Used only in Nexio Browse 1.0 and older low-res systems to link \r
12                                                         a low-res clip to its matching high-res clip�s 8-byte ID handle.              8\r
13 3  UMID                                         Unique Media Identifier                                                                                                 64\r
14 4  Video Info                           Extended video format and frame rate in a bit-wise algorithm \r
15                                                         of 128 bits                                                                                                                     16\r
16 5  Video Codec FourCC Value     The FourCC value used in MOV files to identify the video format \r
17                                                         of the media (as of Nexio 8.0)                                                                                  4\r
18 6  Legacy Field                         128-bit global unique identifier                                                                                16\r
19 7  User Name                            UNICODE-stored field indicating the individual logged in \r
20                                                         to the Nexio system at record time                                                                              64\r
21 8  Department                           UNICODE-stored field typically indicating the department \r
22                                                         of the individual logged in at record time                                                              64\r
23 9  Title                                        UNICODE-stored field typically indicating \r
24                                                         a title associated with the clip                                                                                64\r
25 10 Reserved                                     Reserved                                                                                                                                12\r
26 11 Link                                         UNICODE-stored field for use with ClipSync feature that stores \r
27                                                         the ID of media linked to the current ID for in sync dual playback              64\r
28 12 Description                          UNICODE-stored 120-character user entry text field \r
29                                                         for storing detail about media                                                                                  240\r
30 13 Agency                                       UNICODE-stored 15-character user entry text field \r
31                                                         for storing detail about media                                                                                  30\r
32 14 User-definable Field #1      UNICODE-stored 25-character user entry field                                                    50\r
33 15 User-definable Field #2      UNICODE-stored 25-character user entry field                                                    50\r
34 16 User-definable Field #3      UNICODE-stored 25-character user entry field                                                    50\r
35 17 User-definable Field #4      UNICODE-stored 25-character user entry field                                                    50\r
36 18 External Controller UID      A field reserved for external controllers needing a place \r
37                                                         to store their own unique identifiers                                                                   16\r
38 19 Video ARC                            A series of seven 2-byte values defining a clip�s video \r
39                                                         aspect ratio conversion when loaded into \r
40                                                         a channel of opposite resolution. \r
41                                                         This field also sets whether to override existing AFD data and whether \r
42                                                         to override an SD clip�s native aspect ratio.                                                         14\r
43 20 Modified Timestamp           A FILETIME structure representing the time and date stamp when \r
44                                                         the media was last modified. See below for list of protocol \r
45                                                         commands which trigger this timestamp.                                                                  8\r
46 21 Video QA Status                      Results of video quality analysis as performed by \r
47                                                         the QuiC software application                                                                                   2\r
48 22 User Segments In Use         Used for managing the information stored \r
49                                                         in user data segments, part of the DTA modes.  \r
50                                                         The 2 bytes represent a bitmask of �in use� user data slots                         2\r
51 23 Audio Track Compression Info         A series of 1-byte data per audio track (up to 32 tracks) to indicate \r
52                                                         each track�s compression type and channel count                                               32\r
53 24 Audio Track Tag Info         A series of 1-byte data per audio track (up to 32 tracks) \r
54                                                         to identify the content  of each track using special audio tags                 32*/\r
55 public class GetExtendedFieldCommand extends Command {\r
56 \r
57         private final static byte[] GET_EXTENDED_FIELD = { (byte) 0xc9, (byte) 0xc3 };\r
58         public final static byte[] FN_RECORD_DATETIME = { (byte) 0 };\r
59         public final static byte[] FN_CODEC_WHERE_RECORDED = { (byte) 1 };\r
60         public final static byte[] FN_LEGACY_FIELD = { (byte) 2 };\r
61         public final static byte[] FN_UMID = { (byte) 3 };\r
62         public final static byte[] FN_VIDEO_INFO = { (byte) 4 };\r
63         public final static byte[] FN_VIDEO_CODEC_FOURCC_VALUE = { (byte) 5 };\r
64         public final static byte[] FN_LEGACY_FIELD128BIT = { (byte) 6 };\r
65         public final static byte[] FN_USER_NAME = { (byte) 7 };\r
66         public final static byte[] FN_DEPARTMENT = { (byte) 8 };\r
67         public final static byte[] FN_TITLE = { (byte) 9 };\r
68         public final static byte[] FN_LINK = { (byte) 11 };\r
69         public final static byte[] FN_DESCRIPTION = { (byte) 12 };\r
70         public final static byte[] FN_AGENCY = { (byte) 13 };\r
71         public final static byte[] FN_USER_DEFINABLE_FIELD_1 = { (byte) 14 };\r
72         public final static byte[] FN_USER_DEFINABLE_FIELD_2 = { (byte) 15 };\r
73         public final static byte[] FN_USER_DEFINABLE_FIELD_3 = { (byte) 16 };\r
74         public final static byte[] FN_USER_DEFINABLE_FIELD_4 = { (byte) 17 };\r
75         public final static byte[] FN_EXTERNAL_CONTROLLER_UID = { (byte) 18 };\r
76         public final static byte[] FN_VIDEO_ARC = { (byte) 19 };\r
77         public final static byte[] FN_MODIFIED_TIMESTAMP = { (byte) 20 };\r
78         public final static byte[] FN_VIDEO_QA_STATUS = { (byte) 21 };\r
79         public final static byte[] FN_USER_SEGMENTS_IN_USE = { (byte) 22 };\r
80         public final static byte[] FN_AUDIO_TRACK_COMPRESSION_INFO = { (byte) 23 };\r
81         public final static byte[] FN_AUDIO_TRACK_TAG_INFO = { (byte) 24 };\r
82 \r
83         private byte[] buffer;\r
84 \r
85         public GetExtendedFieldCommand(Connection connection) {\r
86                 super(connection);\r
87         }\r
88 \r
89         public byte[] execute(Id id, byte[] fieldNumber) throws IOException, ProtocolException {\r
90 \r
91                 byte[] ret = null;\r
92 \r
93                 connection.write(GET_EXTENDED_FIELD);\r
94                 connection.write(id.get().getBytes());\r
95                 connection.write(fieldNumber);\r
96                 connection.flush();\r
97 \r
98                 buffer = new byte[2];\r
99                 int c = connection.read(buffer, 0, 2);\r
100                 if (c < 2) {\r
101                         throw getException_InvalidResponseLength(c, 2, 2);\r
102                 }\r
103 \r
104                 // Not found\r
105                 if (buffer[0] == (byte) 0xd0 && buffer[1] == (byte) 0xc3) {\r
106                         throw new ProtocolException("ID handle is not found!");\r
107                 } else\r
108                 // 1. Found\r
109                 if (buffer[0] == (byte) 0xdf && buffer[1] == (byte) 0xc3) {\r
110                         // 2. read NOF BYTES\r
111                         buffer = new byte[1];\r
112                         c = connection.read(buffer, 0, 1);\r
113                         int toRead = buffer[0];\r
114                         ret = new byte[toRead];\r
115                         connection.read(ret, 0, toRead);\r
116                 }\r
117                 return ret;\r
118         }\r
119 }\r