Skip to main content

pull and push stream

Project description

kanstream

kanstream 是一个媒体流处理库,提供创建流接收器和流发送器的功能。

安装

可以使用 pip 安装 kanstream

pip install kanstream

示例

  1. 使用 KanStream.create_stream 创建流接收器和流发送器
from kanstream import KanStream, StreamType

# 创建一个新的流接收器
receiver = KanStream.create_stream("127.0.0.1", 8080, "my_client_id", stream_type=StreamType.RECEIVER)
for frame in receiver.receive():
    # 处理帧

# 创建一个新的流发送器
sender = KanStream.create_stream("127.0.0.1", 8080, "my_client_id", stream_type=StreamType.SENDER)
sender.send(frame)
  1. 使用 KanStream.create_receiver 和 KanStream.create_sender 创建流接收器和流发送器
from kanstream import KanStream, StreamType

# 创建一个新的流接收器
receiver = KanStream.create_receiver("127.0.0.1", 8080, "my_client_id", codec_type=CodecType.H264)
for frame in receiver.receive():
    # 处理帧

# 创建一个新的流发送器
sender = KanStream.create_sender("127.0.0.1", 8080, "my_client_id", codec_type=CodecType.H264)
sender.send(frame)

API参考

KanStream

KanStream 类提供了创建流对象的功能。

create_stream(host, port, client_id, *, codec_type=CodecType.H264, stream_type) 创建一个新的流对象。

  • host (str): 服务器主机地址。
  • port (int): 服务器端口号。
  • client_id (str): 流的客户端 ID。
  • codec_type (CodecType): 流的编解码类型。
  • stream_type (StreamType): 流的类型 (RECEIVER 或 SENDER)。
  • 返回: 一个流对象 (StreamReceiver 或 StreamSender)。

create_receiver(host, port, client_id, *, codec_type=CodecType.H264) 创建一个新的接收器流对象。

  • host (str): 服务器主机地址。
  • port (int): 服务器端口号。
  • client_id (str): 流的客户端 ID。
  • codec_type (CodecType): 流的编解码类型。
  • 返回: 一个接收器流对象。

create_sender(host, port, client_id, codec_type=CodecType.H264) 创建一个新的发送器流对象。

  • host (str): 服务器主机地址。
  • port (int): 服务器端口号。
  • client_id (str): 流的客户端 ID。
  • codec_type (CodecType): 流的编解码类型。
  • 返回: 一个发送器流对象。

StreamType

StreamType 是一个枚举类,表示流的类型。

  • RECEIVER: 表示流是接收器。
  • SENDER: 表示流是发送器。

CodecType

CodecType CodecType 是一个枚举类,表示流的编解码类型。

  • H264: 表示流的编解码类型是 H.264。
  • VP9: 表示流的编解码类型是 VP9。

许可证

本项目基于 MIT 许可证。

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kanstream-2.0.2.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kanstream-2.0.2-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

Details for the file kanstream-2.0.2.tar.gz.

File metadata

  • Download URL: kanstream-2.0.2.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.10.13

File hashes

Hashes for kanstream-2.0.2.tar.gz
Algorithm Hash digest
SHA256 ea9b07652c3e8517c5319380435355e859d434cddbcd20cb2a7102f209f532c7
MD5 b74053f26821fe821569734934eb470e
BLAKE2b-256 75a49e0996ca7e24b5c97a5349df6dde3c77b10b3b82494ee080edf4ed585caf

See more details on using hashes here.

File details

Details for the file kanstream-2.0.2-py3-none-any.whl.

File metadata

  • Download URL: kanstream-2.0.2-py3-none-any.whl
  • Upload date:
  • Size: 11.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.10.13

File hashes

Hashes for kanstream-2.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ec32cd53fb44f4557c3aff4e7865aa621a9070dbb43a7349b45d6aefc45b2017
MD5 e88c47a06289d8fb0dd6968426408cff
BLAKE2b-256 b8c3b672608d31b2a4322b4ed7e3c39dabfbf161f21fdfafca20021a6a2159eb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page