예제 #1
0
def _cenc_encryption_factory(cenc_protocols, cenc_widevine_template,
                             cenc_default_key_label,
                             cenc_default_key_policy_name,
                             cenc_key_to_track_mappings, cenc_clear_tracks,
                             cenc_play_ready_template,
                             cenc_play_ready_attributes):
    cenc_enabled_protocols = _build_enabled_protocols_object(cenc_protocols)

    cenc_play_ready_config = None
    if cenc_play_ready_template or cenc_play_ready_attributes:
        cenc_play_ready_config = StreamingPolicyPlayReadyConfiguration(
            custom_license_acquisition_url_template=cenc_play_ready_template,
            play_ready_custom_attributes=cenc_play_ready_attributes)

    cenc_widevine_config = None
    if cenc_widevine_template:
        cenc_widevine_config = StreamingPolicyWidevineConfiguration(
            custom_license_acquisition_url_template=cenc_widevine_template)

    key_to_track_mappings = _parse_key_to_track_mappings_json(
        cenc_key_to_track_mappings)
    cenc_content_keys = StreamingPolicyContentKeys(
        default_key=DefaultKey(label=cenc_default_key_label,
                               policy_name=cenc_default_key_policy_name),
        key_to_track_mappings=key_to_track_mappings)

    return CommonEncryptionCenc(
        enabled_protocols=cenc_enabled_protocols,
        clear_tracks=_parse_clear_tracks_json(cenc_clear_tracks),
        content_keys=cenc_content_keys,
        drm=CencDrmConfiguration(play_ready=cenc_play_ready_config,
                                 widevine=cenc_widevine_config))
예제 #2
0
def _envelope_encryption_factory(envelope_clear_tracks,
                                 envelope_default_key_label,
                                 envelope_default_key_policy_name,
                                 envelope_key_to_track_mappings,
                                 envelope_protocols,
                                 envelope_template):

    envelope_content_keys = StreamingPolicyContentKeys(
        default_key=DefaultKey(label=envelope_default_key_label,
                               policy_name=envelope_default_key_policy_name),
        key_to_track_mappings=_parse_key_to_track_mappings_json(envelope_key_to_track_mappings))

    envelope_encryption = EnvelopeEncryption(enabled_protocols=_build_enabled_protocols_object(envelope_protocols),
                                             clear_tracks=_parse_clear_tracks_json(envelope_clear_tracks),
                                             content_keys=envelope_content_keys,
                                             custom_key_acquisition_url_template=envelope_template)

    return envelope_encryption
예제 #3
0
def _cenc_encryption_factory(cenc_clear_tracks, cenc_default_key_label,
                             cenc_default_key_policy_name,
                             cenc_disable_play_ready, cenc_disable_widevine,
                             cenc_key_to_track_mappings,
                             cenc_play_ready_attributes,
                             cenc_play_ready_template, cenc_protocols,
                             cenc_widevine_template):
    cenc_enabled_protocols = _build_enabled_protocols_object(cenc_protocols)

    if cenc_disable_play_ready and cenc_disable_widevine:
        message = '--cenc-disable-play-ready and --cenc-disable-widevine cannot both be specified'
        raise ValueError(message)

    cenc_play_ready_config = None
    if not cenc_disable_play_ready:
        if cenc_play_ready_template or cenc_play_ready_attributes:
            cenc_play_ready_config = StreamingPolicyPlayReadyConfiguration(
                custom_license_acquisition_url_template=
                cenc_play_ready_template,
                play_ready_custom_attributes=cenc_play_ready_attributes)
        else:
            cenc_play_ready_config = StreamingPolicyPlayReadyConfiguration()

    cenc_widevine_config = None
    if not cenc_disable_widevine:
        if cenc_widevine_template:
            cenc_widevine_config = StreamingPolicyWidevineConfiguration(
                custom_license_acquisition_url_template=cenc_widevine_template)
        else:
            cenc_widevine_config = StreamingPolicyWidevineConfiguration()

    key_to_track_mappings = _parse_key_to_track_mappings_json(
        cenc_key_to_track_mappings)
    cenc_content_keys = StreamingPolicyContentKeys(
        default_key=DefaultKey(label=cenc_default_key_label,
                               policy_name=cenc_default_key_policy_name),
        key_to_track_mappings=key_to_track_mappings)

    return CommonEncryptionCenc(
        enabled_protocols=cenc_enabled_protocols,
        clear_tracks=_parse_clear_tracks_json(cenc_clear_tracks),
        content_keys=cenc_content_keys,
        drm=CencDrmConfiguration(play_ready=cenc_play_ready_config,
                                 widevine=cenc_widevine_config))
예제 #4
0
def _cbcs_encryption_factory(
        cbcs_clear_tracks, cbcs_default_key_label,
        cbcs_default_key_policy_name, cbcs_fair_play_template,
        cbcs_fair_play_allow_persistent_license, cbcs_key_to_track_mappings,
        cbcs_play_ready_template, cbcs_play_ready_attributes,
        cbcs_widevine_template, cbcs_protocols):
    cbcs_enabled_protocols = _build_enabled_protocols_object(cbcs_protocols)

    cbcs_play_ready_config = None
    if cbcs_play_ready_template or cbcs_play_ready_attributes:
        cbcs_play_ready_config = StreamingPolicyPlayReadyConfiguration(
            play_ready_custom_attributes=cbcs_play_ready_attributes,
            custom_license_acquisition_url_template=cbcs_play_ready_template)
    else:
        cbcs_play_ready_config = StreamingPolicyPlayReadyConfiguration()

    cbcs_widevine_config = None
    if cbcs_widevine_template:
        cbcs_widevine_config = StreamingPolicyWidevineConfiguration(
            custom_license_acquisition_url_template=cbcs_widevine_template)
    else:
        cbcs_widevine_config = StreamingPolicyWidevineConfiguration()

    cbcs_fair_play_config = None
    #    if not cbcs_disable_fair_play:
    if cbcs_fair_play_allow_persistent_license or cbcs_fair_play_template:
        cbcs_fair_play_config = StreamingPolicyFairPlayConfiguration(
            allow_persistent_license=cbcs_fair_play_allow_persistent_license,
            custom_license_acquisition_url_template=cbcs_fair_play_template)

    cbcs_content_keys = StreamingPolicyContentKeys(
        default_key=DefaultKey(label=cbcs_default_key_label,
                               policy_name=cbcs_default_key_policy_name),
        key_to_track_mappings=_parse_key_to_track_mappings_json(
            cbcs_key_to_track_mappings))

    return CommonEncryptionCbcs(
        enabled_protocols=cbcs_enabled_protocols,
        clear_tracks=_parse_clear_tracks_json(cbcs_clear_tracks),
        content_keys=cbcs_content_keys,
        drm=CbcsDrmConfiguration(play_ready=cbcs_play_ready_config,
                                 widevine=cbcs_widevine_config,
                                 fair_play=cbcs_fair_play_config))