Updates also include: - Add APIs to query current Simulcrypt channel & stream status; - EMM format change (used only to carry fingerprinting and service blocking info); - Key fetcher example to use curl key fetcher.
272 lines
16 KiB
C++
272 lines
16 KiB
C++
////////////////////////////////////////////////////////////////////////////////
|
|
// Copyright 2019 Google LLC.
|
|
//
|
|
// This software is licensed under the terms defined in the Widevine Master
|
|
// License Agreement. For a copy of this agreement, please contact
|
|
// widevine-licensing@google.com.
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Example EMMG messages used in unit tests.
|
|
|
|
#ifndef MEDIA_CAS_PACKAGER_SDK_EXAMPLE_TEST_EMMG_MESSAGES_H_
|
|
#define MEDIA_CAS_PACKAGER_SDK_EXAMPLE_TEST_EMMG_MESSAGES_H_
|
|
|
|
namespace widevine {
|
|
namespace cas {
|
|
|
|
const char kTestEmmgTsPacket[] = {
|
|
'\x47', '\x5F', '\xFF', '\x10', '\x00', '\x82', '\x70', '\x61', '\x00',
|
|
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
|
|
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
|
|
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
|
|
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
|
|
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
|
|
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
|
|
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
|
|
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
|
|
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
|
|
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
|
|
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x83', '\x70', '\x61',
|
|
'\x01', '\x01', '\x01', '\x01', '\x01', '\x01', '\x01', '\x01', '\x01',
|
|
'\x01', '\x01', '\x01', '\x01', '\x01', '\x01', '\x01', '\x01', '\x01',
|
|
'\x01', '\x01', '\x01', '\x01', '\x01', '\x01', '\x01', '\x01', '\x01',
|
|
'\x01', '\x01', '\x01', '\x01', '\x01', '\x01', '\x01', '\x01', '\x01',
|
|
'\x01', '\x01', '\x01', '\x01', '\x01', '\x01', '\x01', '\x01', '\x01',
|
|
'\x01', '\x01', '\x01', '\x01', '\x01', '\x01', '\x01', '\x01', '\x01',
|
|
'\x01', '\x01', '\x01', '\x01', '\x01', '\x01', '\x01', '\x01', '\x01',
|
|
'\x01', '\x01', '\x01', '\x01', '\x01', '\x01', '\x01', '\x01', '\x01',
|
|
'\x01', '\x01', '\x01', '\x01', '\x01', '\x01', '\x01', '\x01'};
|
|
|
|
const char kTestEmmgChannelSetup[] = {
|
|
'\x02', // protocol_version
|
|
'\x00', '\x11', // message_type - Channel_setup
|
|
'\x00', '\x13', // message_length
|
|
'\x00', '\x01', // parameter_type - client_id
|
|
'\x00', '\x04', // parameter_length
|
|
'\x4a', '\xd4', '\x00', '\x00', // parameter_value
|
|
'\x00', '\x03', // parameter_type - data_channel_id
|
|
'\x00', '\x02', // parameter_length
|
|
'\x00', '\x01', // parameter_value
|
|
'\x00', '\x02', // parameter_type - section_TSpkt_flag
|
|
'\x00', '\x01', // parameter_length
|
|
'\x01' // parameter_value
|
|
};
|
|
|
|
const char kTestEmmgStreamSetupForPrivateData[] = {
|
|
'\x02', // protocol_version
|
|
'\x01', '\x11', // message_type - Stream_setup
|
|
'\x00', '\x1f', // message_length
|
|
'\x00', '\x01', // parameter_type - client_id
|
|
'\x00', '\x04', // parameter_length
|
|
'\x4a', '\xd4', '\x00', '\x00', // parameter_value
|
|
'\x00', '\x03', // parameter_type - data_channel_id
|
|
'\x00', '\x02', // parameter_length
|
|
'\x00', '\x01', // parameter_value
|
|
'\x00', '\x04', // parameter_type - data_stream_id
|
|
'\x00', '\x02', // parameter_length
|
|
'\x00', '\x01', // parameter_value
|
|
'\x00', '\x08', // parameter_type - data_id
|
|
'\x00', '\x02', // parameter_length
|
|
'\x00', '\x01', // parameter_value
|
|
'\x00', '\x07', // parameter_type - data_type
|
|
'\x00', '\x01', // parameter_length
|
|
'\x01' // parameter_value - private data
|
|
};
|
|
|
|
const char kTestEmmgStreamSetupForEmm[] = {
|
|
'\x02', // protocol_version
|
|
'\x01', '\x11', // message_type - Stream_setup
|
|
'\x00', '\x1f', // message_length
|
|
'\x00', '\x01', // parameter_type - client_id
|
|
'\x00', '\x04', // parameter_length
|
|
'\x4a', '\xd4', '\x00', '\x00', // parameter_value
|
|
'\x00', '\x03', // parameter_type - data_channel_id
|
|
'\x00', '\x02', // parameter_length
|
|
'\x00', '\x01', // parameter_value
|
|
'\x00', '\x04', // parameter_type - data_stream_id
|
|
'\x00', '\x02', // parameter_length
|
|
'\x00', '\x01', // parameter_value
|
|
'\x00', '\x08', // parameter_type - data_id
|
|
'\x00', '\x02', // parameter_length
|
|
'\x00', '\x01', // parameter_value
|
|
'\x00', '\x07', // parameter_type - data_type
|
|
'\x00', '\x01', // parameter_length
|
|
'\x00' // parameter_value - emm
|
|
};
|
|
|
|
const char kTestEmmgStreamBwRequest[] = {
|
|
'\x02', // protocol_version
|
|
'\x01', '\x17', // message_type - Stream_BW_request
|
|
'\x00', '\x1a', // message_length
|
|
'\x00', '\x01', // parameter_type - client_id
|
|
'\x00', '\x04', // parameter_length
|
|
'\x4a', '\xd4', '\x00', '\x00', // parameter_value
|
|
'\x00', '\x03', // parameter_type - data_channel_id
|
|
'\x00', '\x02', // parameter_length
|
|
'\x00', '\x01', // parameter_value
|
|
'\x00', '\x04', // parameter_type - data_stream_id
|
|
'\x00', '\x02', // parameter_length
|
|
'\x00', '\x01', // parameter_value
|
|
'\x00', '\x06', // parameter_type - bandwidth
|
|
'\x00', '\x02', // parameter_length
|
|
'\x00', '\x64' // parameter_value
|
|
};
|
|
|
|
const char kTestEmmgStreamBwAllocation[] = {
|
|
'\x02', // protocol_version
|
|
'\x01', '\x18', // message_type - Stream_BW_allocation
|
|
'\x00', '\x1a', // message_length
|
|
'\x00', '\x01', // parameter_type - client_id
|
|
'\x00', '\x04', // parameter_length
|
|
'\x4a', '\xd4', '\x00', '\x00', // parameter_value
|
|
'\x00', '\x03', // parameter_type - data_channel_id
|
|
'\x00', '\x02', // parameter_length
|
|
'\x00', '\x01', // parameter_value
|
|
'\x00', '\x04', // parameter_type - data_stream_id
|
|
'\x00', '\x02', // parameter_length
|
|
'\x00', '\x01', // parameter_value
|
|
'\x00', '\x06', // parameter_type - bandwidth
|
|
'\x00', '\x02', // parameter_length
|
|
'\x00', '\x32' // parameter_value (50 kbps)
|
|
};
|
|
|
|
const char kTestEmmgPrivateDataProvision[] = {
|
|
'\x02', // protocol_version
|
|
'\x02', '\x11', // message_type - Data_provision
|
|
'\x00', '\xda', // message_length
|
|
'\x00', '\x01', // parameter_type - client_id
|
|
'\x00', '\x04', // parameter_length
|
|
'\x4a', '\xd4', '\x00', '\x00', // parameter_value
|
|
'\x00', '\x03', // parameter_type - data_channel_id
|
|
'\x00', '\x02', // parameter_length
|
|
'\x00', '\x01', // parameter_value
|
|
'\x00', '\x04', // parameter_type - data_stream_id
|
|
'\x00', '\x02', // parameter_length
|
|
'\x00', '\x01', // parameter_value
|
|
'\x00', '\x08', // parameter_type - data_id
|
|
'\x00', '\x02', // parameter_length
|
|
'\x00', '\x01', // parameter_value
|
|
'\x00', '\x05', // parameter_type - datagram
|
|
'\x00', '\xbc', // parameter_length
|
|
'\x47', '\x40', '\x00', '\x10', '\x0a', '\x0d', '\x77', '\x69', '\x64',
|
|
'\x65', '\x76', '\x69', '\x6e', '\x65', '\x5f', '\x74', '\x65', '\x73',
|
|
'\x74', '\x12', '\x09', '\x43', '\x61', '\x73', '\x54', '\x73', '\x46',
|
|
'\x61', '\x6b', '\x65', '\x22', '\x0a', '\x66', '\x61', '\x6b', '\x65',
|
|
'\x47', '\x72', '\x6f', '\x75', '\x70', '\x31', '\x22', '\x0c', '\x66',
|
|
'\x61', '\x6b', '\x65', '\x47', '\x72', '\x6f', '\x75', '\x70', '\x49',
|
|
'\x64', '\x32', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
|
|
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
|
|
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
|
|
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
|
|
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
|
|
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
|
|
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
|
|
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
|
|
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
|
|
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
|
|
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
|
|
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
|
|
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
|
|
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
|
|
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00'};
|
|
|
|
const char kTestEmmgEmmDataProvision[] = {
|
|
'\x02', // protocol_version
|
|
'\x02', '\x11', // message_type - Data_provision
|
|
'\x01', '\x96', // message_length
|
|
'\x00', '\x01', // parameter_type - client_id
|
|
'\x00', '\x04', // parameter_length
|
|
'\x4a', '\xd4', '\x00', '\x00', // parameter_value
|
|
'\x00', '\x03', // parameter_type - data_channel_id
|
|
'\x00', '\x02', // parameter_length
|
|
'\x00', '\x01', // parameter_value
|
|
'\x00', '\x04', // parameter_type - data_stream_id
|
|
'\x00', '\x02', // parameter_length
|
|
'\x00', '\x01', // parameter_value
|
|
'\x00', '\x08', // parameter_type - data_id
|
|
'\x00', '\x02', // parameter_length
|
|
'\x00', '\x01', // parameter_value
|
|
'\x00', '\x05', // parameter_type - datagram
|
|
'\x01', '\x78', // parameter_length
|
|
// Start of the first TS packet (188 bytes).
|
|
'\x47', '\x40', '\x00', '\x10', // TS packet header (4 bytes).
|
|
'\x00', // Pointer field (1 byte).
|
|
'\x82', '\x70', '\xbc', // Section header (3 bytes).
|
|
// Start of Widevine EMM.
|
|
'\x0a', '\x71', '\x0a', '\x14', '\x0a', '\x03', '\x43', '\x48', '\x31',
|
|
'\x0a', '\x03', '\x43', '\x48', '\x32', '\x12', '\x08', '\x63', '\x6f',
|
|
'\x6e', '\x74', '\x72', '\x6f', '\x6c', '\x73', '\x0a', '\x16', '\x0a',
|
|
'\x03', '\x43', '\x48', '\x33', '\x12', '\x0f', '\x61', '\x6e', '\x6f',
|
|
'\x74', '\x68', '\x65', '\x72', '\x20', '\x63', '\x6f', '\x6e', '\x74',
|
|
'\x72', '\x6f', '\x6c', '\x12', '\x18', '\x0a', '\x03', '\x43', '\x48',
|
|
'\x31', '\x0a', '\x03', '\x43', '\x48', '\x32', '\x12', '\x06', '\x47',
|
|
'\x72', '\x6f', '\x75', '\x70', '\x31', '\x20', '\xd2', '\x85', '\xd8',
|
|
'\xcc', '\x04', '\x12', '\x21', '\x0a', '\x03', '\x43', '\x48', '\x33',
|
|
'\x12', '\x06', '\x47', '\x72', '\x6f', '\x75', '\x70', '\x32', '\x12',
|
|
'\x06', '\x47', '\x72', '\x6f', '\x75', '\x70', '\x33', '\x18', '\xd2',
|
|
'\x85', '\xd8', '\xcc', '\x04', '\x20', '\xd3', '\x85', '\xd8', '\xcc',
|
|
'\x04', '\x18', '\xfb', '\x83', '\xf7', '\xf9', '\x05', '\x12', '\x47',
|
|
'\x78', '\x78', '\x78', '\x78', '\x78', '\x78', '\x78', '\x78', '\x78',
|
|
'\x78', '\x78', '\x78', '\x78', '\x78', '\x78', '\x78', '\x78', '\x78',
|
|
'\x78', '\x78', '\x78', '\x78', '\x78', '\x78', '\x78', '\x78', '\x78',
|
|
'\x78', '\x78', '\x78', '\x78', '\x78', '\x78', '\x78', '\x78', '\x78',
|
|
'\x78', '\x78', '\x78', '\x78', '\x78', '\x78', '\x78', '\x78', '\x78',
|
|
'\x78', '\x78', '\x78', '\x78', '\x78', '\x78', '\x78', '\x78', '\x78',
|
|
'\x78', '\x78', '\x78', '\x78', '\x78', '\x78', '\x78', '\x78', '\x78',
|
|
// Start of the second TS packet (188 bytes).
|
|
'\x47', '\x00', '\x00', '\x11', // TS packet header (4 bytes).
|
|
// Continued Widevine EMM.
|
|
'\x78', '\x78', '\x78', '\x78', '\x78', '\x78', '\x78', '\x78', '\xff',
|
|
'\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff',
|
|
'\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff',
|
|
'\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff',
|
|
'\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff',
|
|
'\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff',
|
|
'\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff',
|
|
'\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff',
|
|
'\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff',
|
|
'\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff',
|
|
'\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff',
|
|
'\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff',
|
|
'\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff',
|
|
'\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff',
|
|
'\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff',
|
|
'\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff',
|
|
'\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff',
|
|
'\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff',
|
|
'\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff',
|
|
'\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff',
|
|
'\xff', '\xff', '\xff', '\xff'};
|
|
|
|
const char kTestEmmgStreamCloseRequest[] = {
|
|
'\x02', // protocol_version
|
|
'\x01', '\x14', // message_type - Stream_close_request
|
|
'\x00', '\x14', // message_length
|
|
'\x00', '\x01', // parameter_type - client_id
|
|
'\x00', '\x04', // parameter_length
|
|
'\x4a', '\xd4', '\x00', '\x00', // parameter_value
|
|
'\x00', '\x03', // parameter_type - data_channel_id
|
|
'\x00', '\x02', // parameter_length
|
|
'\x00', '\x01', // parameter_value
|
|
'\x00', '\x04', // parameter_type - data_stream_id
|
|
'\x00', '\x02', // parameter_length
|
|
'\x00', '\x01' // parameter_value
|
|
};
|
|
|
|
const char kTestEmmgChannelClose[] = {
|
|
'\x02', // protocol_version
|
|
'\x00', '\x14', // message_type - Channel_close
|
|
'\x00', '\x0e', // message_length
|
|
'\x00', '\x01', // parameter_type - client_id
|
|
'\x00', '\x04', // parameter_length
|
|
'\x4a', '\xd4', '\x00', '\x00', // parameter_value
|
|
'\x00', '\x03', // parameter_type - data_channel_id
|
|
'\x00', '\x02', // parameter_length
|
|
'\x00', '\x01' // parameter_value
|
|
};
|
|
|
|
} // namespace cas
|
|
} // namespace widevine
|
|
|
|
#endif // MEDIA_CAS_PACKAGER_SDK_EXAMPLE_TEST_EMMG_MESSAGES_H_
|