Move WV CAS Descriptor Generator to the media_cas_packager_sdk.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=219162536
This commit is contained in:
Widevine Buildbot
2018-10-29 22:08:44 +00:00
parent 15f3396146
commit 9e87e4963f
2 changed files with 75 additions and 0 deletions

Binary file not shown.

View File

@@ -0,0 +1,75 @@
////////////////////////////////////////////////////////////////////////////////
// Copyright 2018 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.
////////////////////////////////////////////////////////////////////////////////
#ifndef MEDIA_CAS_PACKAGER_SDK_PUBLIC_WV_CAS_CA_DESCRIPTOR_H_
#define MEDIA_CAS_PACKAGER_SDK_PUBLIC_WV_CAS_CA_DESCRIPTOR_H_
#include <stddef.h>
#include <string>
#include "media_cas_packager_sdk/public/wv_cas_status.h"
namespace widevine {
namespace cas {
// Simple CA Descriptor generator for Widevine CAS.
//
// The CA descriptor format is defined in ISO/IEC 13818-1:2015 (table 2-59):
// CA_descriptor() {
// descriptor_tag 8 uimsbf
// descriptor_length 8 uimsbf
// CA_system_id 16 uimsbf
// reserved 3 bslbf
// CA_PID 13 uimsbf
// for (i = 0; i < N; i++) {
// private_data_byte uimsbf
// }
// }
//
// Class is not thread safe.
class WvCasCaDescriptor {
public:
WvCasCaDescriptor() = default;
WvCasCaDescriptor(const WvCasCaDescriptor&) = delete;
WvCasCaDescriptor& operator=(const WvCasCaDescriptor&) = delete;
virtual ~WvCasCaDescriptor() = default;
// Generate a CA descriptor for the ECM stream for an encrypted program
// stream.
//
// Args:
// |ca_pid| the 13-bit PID of the ECMs
// |provider| provider name, put in private data for client to construct pssh
// |content_id| content ID, put in private data for client to construct pssh
// |serialized_ca_desc| a std::string object to receive the encoded descriptor.
//
// Notes:
// The descriptor generated by this call may be inserted into a CA Table
// section (for an EMM stream) or into a TS Program Map Table section (for an
// ECM stream). The descriptor will be 6 bytes plus any bytes added as
// (user-defined) private data.
virtual WvCasStatus GenerateCaDescriptor(uint16_t ca_pid,
const std::string& provider,
const std::string& content_id,
std::string* serialized_ca_desc) const;
// Return the base size (before private data is added) of the CA
// descriptor. The user can call this to plan the layout of the Table section
// where the descriptor will be added.
virtual size_t CaDescriptorBaseSize() const;
protected:
// Protected visibility to support unit testing.
virtual std::string GeneratePrivateData(const std::string& provider,
const std::string& content_id) const;
};
} // namespace cas
} // namespace widevine
#endif // MEDIA_CAS_PACKAGER_SDK_PUBLIC_WV_CAS_CA_DESCRIPTOR_H_