protected TsCommand ChannelOp(string op, ChannelId?channelId, string?name, string?namePhonetic, string?topic, string?description, string?password, Codec?codec, int?codecQuality, int?codecLatencyFactor, bool?codecEncrypted, int?maxClients, int?maxFamilyClients, bool?maxClientsUnlimited, bool?maxFamilyClientsUnlimited, bool?maxFamilyClientsInherited, ChannelId?order, ChannelId?parent, ChannelType?type, TimeSpan?deleteDelay, int?neededTalkPower) => new TsCommand(op) { { "cid", channelId }, { "cpid", parent }, { "channel_name", name }, { "channel_name_phonetic", namePhonetic }, { "channel_topic", topic }, { "channel_description", description }, { "channel_password", GenPassword(password) }, { "channel_codec", (byte?)codec }, { "channel_codec_quality", codecQuality }, { "channel_codec_latency_factor", codecLatencyFactor }, { "channel_codec_is_unencrypted", !codecEncrypted }, { "channel_maxclients", maxClients }, { "channel_maxfamilyclients", maxFamilyClients }, { "channel_flag_maxclients_unlimited", maxClientsUnlimited }, { "channel_flag_maxfamilyclients_unlimited", maxFamilyClientsUnlimited }, { "channel_flag_maxfamilyclients_inherited", maxFamilyClientsInherited }, { "channel_order", order }, { "channel_flag_permanent", type == null ? (bool?)null : type == ChannelType.Permanent }, { "channel_flag_semi_permanent", type == null ? (bool?)null : type == ChannelType.SemiPermanent }, { "channel_delete_delay", (ulong?)deleteDelay?.TotalSeconds }, // TODO Check { "channel_needed_talk_power", neededTalkPower }, };
/// <summary> /// <see cref="avcodec_open2(AVCodecContext*, AVCodec*, AVDictionary**)"/> /// </summary> public void Open(Codec?codec = null, MediaDictionary?options = null) { AVDictionary *ptrDict = options; avcodec_open2(this, codec, &ptrDict).ThrowIfError(); options.Reset(ptrDict); }
public CmdR ChannelEdit(ChannelId channelId, string?name = null, string?namePhonetic = null, string?topic = null, string?description = null, string?password = null, Codec?codec = null, int?codecQuality = null, int?codecLatencyFactor = null, bool?codecEncrypted = null, int?maxClients = null, int?maxFamilyClients = null, bool?maxClientsUnlimited = null, bool?maxFamilyClientsUnlimited = null, bool?maxFamilyClientsInherited = null, ChannelId?order = null, ChannelType?type = null, TimeSpan?deleteDelay = null, int?neededTalkPower = null) => SendVoid(ChannelOp("channeledit", channelId, name, namePhonetic, topic, description, password, codec, codecQuality, codecLatencyFactor, codecEncrypted, maxClients, maxFamilyClients, maxClientsUnlimited, maxFamilyClientsUnlimited, maxFamilyClientsInherited, order, null, type, deleteDelay, neededTalkPower));
// Splitted base commands public override R <IChannelCreateResponse, CommandError> ChannelCreate(string name, string namePhonetic = null, string topic = null, string description = null, string password = null, Codec?codec = null, int?codecQuality = null, int?codecLatencyFactor = null, bool?codecEncrypted = null, int?maxClients = null, int?maxFamilyClients = null, bool?maxClientsUnlimited = null, bool?maxFamilyClientsUnlimited = null, bool?maxFamilyClientsInherited = null, ChannelId?order = null, ChannelId?parent = null, ChannelType?type = null, TimeSpan?deleteDelay = null, int?neededTalkPower = null) => Send <ChannelCreateResponse>(ChannelOp("channelcreate", null, name, namePhonetic, topic, description, password, codec, codecQuality, codecLatencyFactor, codecEncrypted, maxClients, maxFamilyClients, maxClientsUnlimited, maxFamilyClientsUnlimited, maxFamilyClientsInherited, order, parent, type, deleteDelay, neededTalkPower)) .WrapSingle() .WrapInterface <ChannelCreateResponse, IChannelCreateResponse>();
/// <summary> /// <see cref="avcodec_alloc_context3(AVCodec*)"/> /// </summary> public CodecContext(Codec?codec = null) { AVCodecContext *ptr = avcodec_alloc_context3(codec); if (ptr == null) { throw new FFmpegException($"Failed to create {nameof(AVCodecContext)} from codec {codec?.Id}"); } _nativePointer = (IntPtr)ptr; _isOwner = true; }
private ReadOnlySpan <byte> Compress(byte[] data, int count, Codec?codec) { switch (codec) { case null: case Codec.Null: return(data.AsSpan(0, count)); case Codec.Deflate: var deflatedResult = new MemoryStream(); using (var deflater = new DeflateStream(deflatedResult, CompressionMode.Compress, true)) { deflater.Write(data, 0, count); deflater.Flush(); } return(deflatedResult.GetBuffer().AsSpan(0, (int)deflatedResult.Position)); default: throw new NotSupportedException($"Codec: '{codec}' is not supported"); } }
/// <summary> /// <see cref="avformat_new_stream(AVFormatContext*, AVCodec*)"/> /// </summary> public MediaStream NewStream(Codec?codec = null) => new MediaStream(this, codec);
public abstract Task <R <IChannelCreateResponse, CommandError> > ChannelCreate(string name, string?namePhonetic = null, string?topic = null, string?description = null, string?password = null, Codec?codec = null, int?codecQuality = null, int?codecLatencyFactor = null, bool?codecEncrypted = null, int?maxClients = null, int?maxFamilyClients = null, bool?maxClientsUnlimited = null, bool?maxFamilyClientsUnlimited = null, bool?maxFamilyClientsInherited = null, ChannelId?order = null, ChannelId?parent = null, ChannelType?type = null, TimeSpan?deleteDelay = null, int?neededTalkPower = null);
/// <summary> /// <see cref="avformat_new_stream(AVFormatContext*, AVCodec*)"/> /// </summary> public MediaStream(FormatContext formatContext, Codec?codec = null) : this(avformat_new_stream(formatContext, codec)) { }