Protocol buffers 如何使用python ProtoBuf库使用pssh python脚本?

Protocol buffers 如何使用python ProtoBuf库使用pssh python脚本?,protocol-buffers,drm,widevine,shaka,eme,Protocol Buffers,Drm,Widevine,Shaka,Eme,在本文档中,我无法理解Python ProtoBuf库与使用pssh Python脚本的关系 如何在没有proto文件的情况下构建pssh.py脚本?您可以将构建脚本与shaka packager一起使用,也可以直接从中生成python protobuf文件 协议缓冲区很好地描述了如何使用protoc编译必要的python代码 如果您不想要或不需要任何其他shaka packager产品,但只想使用pssh.py,则可以修改此部分: # Append the local protobuf loc

在本文档中,我无法理解Python ProtoBuf库与使用pssh Python脚本的关系


如何在没有proto文件的情况下构建pssh.py脚本?

您可以将构建脚本与shaka packager一起使用,也可以直接从中生成python protobuf文件

协议缓冲区很好地描述了如何使用protoc编译必要的python代码

如果您不想要或不需要任何其他shaka packager产品,但只想使用pssh.py,则可以修改此部分:

# Append the local protobuf location.  Use a path relative to the tools/pssh
# folder where this file should be found.  This allows the file to be executed
# from any directory.
_pssh_dir = os.path.dirname(os.path.realpath(__file__))
sys.path.insert(0, os.path.join(_pssh_dir, '../../third_party/protobuf/python'))
# Import the widevine protobuf.  Use either Release or Debug.
_proto_path_format = os.path.join(
    _pssh_dir, '../../../out/%s/pyproto/packager/media/base')
if os.path.isdir(_proto_path_format % 'Release'):
  sys.path.insert(0, _proto_path_format % 'Release')
else:
  sys.path.insert(0, _proto_path_format % 'Debug')
try:
  import widevine_pssh_data_pb2  # pylint: disable=g-import-not-at-top
except ImportError:
  print >> sys.stderr, 'Cannot find proto file, make sure to build first'
  raise
只需保持导入widevine_pssh_data_pb2,并确保使用protoc生成的代码位于pssh.py文件的路径中。那么它应该能很好地工作


你打算用pssh.py做什么?

我正在用它来生成pssh框,谢谢你,我会试试这个。这太过分了,沙卡没有提供.proto文件compile@SuhaybKharabsheh它确实提供了.proto文件,我直接链接到它:注意,每个DRM系统的PSSH框是不同的,例如,PlayReady使用了一种完全不同的格式。很抱歉没有注意到你的话,它就像一个符咒,我应该从哪里获得公平游戏的pssh?@SuhaybKharabsheh公平游戏不支持DASH。所以无论如何都没有PSSH盒。但Bento4实际上支持HLS: