【www.5929.com】从0基础入门全套教程,octoin平台充值USDT教程

www.5929.com 1

钱包得到找到USDT,点击小箭头,会产出充值按钮。中国团队注册中央www.34ev.com

mediastreamer使用教程

简介

放置指令是已经导入过的,你的机件可以平昔利用它们。
因而,不用像您协调的组件一样把它们当做指令导入进来。

www.5929.com 2

www.5929.com ,要是找不到USDT那么些币种,表达您没添加进来 

1.逐项函数功用简介

ms_filter_destroy 释放filter资源

ms_ticker_destroy释放ticker

声明:ticker为定时器线程,每隔10ms执行一遍

ms_filter_new创建filter,传进参数为filter的ID

ms_connection_helper_start获得filter链接先河地方

ms_connection_helper_link链接filter

ms_filter_link链接filter

ms_ticker_new创建ticker

ticker说明:

【www.5929.com】从0基础入门全套教程,octoin平台充值USDT教程。ticker是属于一个线程无法运转三个闭塞式的进度,比如socks的发送与接受,必须将
发送和接到放在filter线程里面。

ms_ticker_set_name【www.5929.com】从0基础入门全套教程,octoin平台充值USDT教程。设置ticker名称

ms_ticker_attach将ticker附加到线程中

ms_ticker_detach去掉ticker

ms_connection_helper_unlink去掉filter链接

ms_filter_unlink 去掉filter链接

ms_new filter数据结构成立

ms_free 数据结构数据释放

ms_queue_get(f->inpputs[0])获取filter数据

msgdsize得到filter里面数据长度

ms_queue_put(f->outputs[0],om)往filter里面塞数据

freemsg释放filter数据

ms_thread_join在filter里面创立线程

ms_filter_call_method往filter里面发送数据

ngIf

据悉一个尺码来控制彰显或隐藏一个元素, 可以行使 ngIf
指令。这些条件是由你传给指令的表达式的结果决定的

<div ngIf="false"></div> 
<div ngIf="a > b"></div> 
<div ngIf="str == 'yes'"></div> 
<div ngIf="myFunc()"></div> 

进入获取!!!!进来获取!!!!

添加USDT到Octoin平台教程

2.创建filter过程

ngSwitch

据悉一个加以的原则来渲染分歧的要素

// ngSwitchCase 指令描述已知结果;
// ngSwitchDefault 指令处理所有其他未知情况
// ngSwitchDefault 元素是可选的。如果我们不用它,
// 那么当 myVar 没有匹配到任何期望的值时就不会渲染任何东西
<div class="container" [ngSwitch]="myVar">
<div *ngSwitchCase="'A'">Var is A</div>
<div ngSwitchCase="'B'">Var is B</div>
<div ngSwitchDefault>Var is something else</div>
</div>

// 想要处理新值 C, 只需要插入一行
<div class="container" [ngSwitch]="myVar">
<div *ngSwitchCase="'A'">Var is A</div>
// 会渲染两次
<div *ngSwitchCase="'A'">Var is A</div>
<div ngSwitchCase="'B'">Var is B</div>
<div ngSwitchCase="'C'">Var is C</div>
<div *ngSwitchDefault>Var is something else</div>
</div>

www.5929.com 3

www.5929.com 4

2.1在Allfilters.h里面添加filter的ID

ngStyle

使用 ngStyle 指令,可以通过 Angular 表明式给一定的 DOM 元素设定 CSS
属性。

// 简单用法
<div [style.background-color]="'yellow'">
Uses fixed yellow background
</div>

<div [ngStyle]="{color: 'white', 'background-color': 'blue'}">
Uses fixed white text on blue background
</div>

对 background-color 使用了单引号,但却不曾对 color
使用。那是干吗吗?

因为 ngStyle 的参数是一个 JavaScript
对象,而color是一个官方的键,不需要引号。不过在 background-color
中,连字符是不允许出现在目的的键名当中的,除非它是一个字符串,
因而拔取了引号。

// 设置文字大小
//1. style.font-size.px
//2. style.font-size.em
//3. style.font-size.%
<div>

red text

</div>

www.5929.com 5

点击充值按钮,输入充值数额 

2.2在Alldescs.h里面添加filter结构体变量

ngClass

ngClass指令在HTML模板中用ngClass属性来代表,让你能动态设置和更改一个给定DOM元素的CSS类

.bordered {
border: 1px dashed black;
background-color: #eee;
}
// 简单用法
<div [ngClass]="{bordered: false}">This is never bordered</div>
<div [ngClass]="{bordered: true}">This is always bordered</div>

www.5929.com 6

2.3在落到实处filter的源文件里面添加相关头文件

#include "msfilter.h"
#include "msticker.h"

ngFor

重复一个加以的DOM元素(或一组DOM元素)
,每趟重复都会从数组中取一个不等的值。

this.cities = ['Miami', 'Sao Paulo', 'New York'];

<h4 class="ui horizontal divider header">
Simple list of strings
</h4>
<div class="ui list" *ngFor="let c of cities">
<div class="item">{{ c }}</div>
</div>

www.5929.com 7

运用ngFor指令的结果

// 根据每一行数据渲染出一个表格
this.people = [
    { name: 'Anderson', age: 35, city: 'Sao Paulo' },
    { name: 'John', age: 12, city: 'Miami' },
    { name: 'Peter', age: 22, city: 'New York' }
];

<h4 class="ui horizontal divider header">
    List of objects
</h4>
<table class="ui celled table">
    <thead>
        <tr>
            <th>Name</th>
            <th>Age</th>
            <th>City</th>
        </tr>
    </thead>
    <tr *ngFor="let p of people">
        <td>{{ p.name }}</td>
        <td>{{ p.age }}</td>
        <td>{{ p.city }}</td>
    </tr>
</table>

www.5929.com 8

渲染对象数组

// 使用嵌套数组
this.peopleByCity = [
    {   city: 'Miami',
        people: [
            { name: 'John', age: 12 },
            { name: 'Angel', age: 22 }
        ]
    },
    {   city: 'Sao Paulo',
        people: [
            { name: 'Anderson', age: 35 },
            { name: 'Felipe', age: 36 }
        ]
    }
]

<h4 class="ui horizontal divider header">
    Nested data
</h4>
<div ngFor="let item of peopleByCity">
    <h2 class="ui header">{{ item.city }}</h2>
    <table class="ui celled table">
        <thead>
            <tr>
                <th>Name</th>
                <th>Age</th>
            </tr>
        </thead>
        <tr ngFor="let p of item.people">
            <td>{{ p.name }}</td>
            <td>{{ p.age }}</td>
        </tr>
    </table>
</div>

www.5929.com 9

渲染嵌套数组

拿到索引

在迭代数组时,大家恐怕也要赢得每一项的目录。大家得以在ngFor命令的值中插入语法let
idx = index并用分号分隔开, 那样就足以博得索引了。

www.5929.com 10

动用索引

须要卓殊开销手续费,点击付款会跳转到支付页面 

2.4.一个业内的filter过程

#include "msfilter.h"
#include "msticker.h"

static void enc_init(MSFilter *f){

}

static void enc_uninit(MSFilter *f){

}

static void enc_preprocess(MSFilter *f)
{
}

static void enc_process(MSFilter *f){


}

static void enc_postprocess(MSFilter *f){
}

static MSFilterMethod enc_methods[]={
        {0,NULL}
};

MSFilterDesc ms_amr_enc_desc={
        MS_AMR_ENCODER_ID, //filter ID
        "amrEnc",  //filter名称
        "amr encoder",
        MS_FILTER_ENCODER,  //filter类型MS_FILTER_OTHER 其他,
                            //MS_FILTER_ENCODER 编码器,
                            //MS_FILTER_DECODER 解码器
        "amr",
        1,
        1,
        enc_init,   //初始化操作
        enc_preprocess,  //预初始化操作
        enc_process,   //处理过程
        enc_postprocess,  //预结束操作
        enc_uninit,  //结束操作
        enc_methods  //程序模块方法,用于参数传递
};


static void dec_init(MSFilter *f){

}

static void dec_uninit(MSFilter *f){

}

static void dec_preprocess(MSFilter *f){
}

static void dec_postprocess(MSFilter *f){
}

static void dec_process(MSFilter *f){

}

static MSFilterMethod dec_methods[]={
        {0,NULL}
};

MSFilterDesc ms_amr_dec_desc={
        MS_AMR_DECODER_ID,
        "amrDec",
        "amr decoder",
        MS_FILTER_DECODER,
        "amr",
        1,
        1,
        dec_init,
        dec_preprocess,
        dec_process,
        dec_postprocess,
        dec_uninit,
        dec_methods
};

MS_FILTER_DESC_EXPORT(ms_amr_dec_desc)
MS_FILTER_DESC_EXPORT(ms_amr_enc_desc)

ngNonBindable

绝不编译或者绑定页面中的某个特殊部分时, 要使用ngNodBindable指令。

<div class="ui list" *ngFor="let c of cities; let num = index">
<div class="item">{{ num+1 }} - {{ c }}</div>
</div>

template: `
<div class='ngNonBindableDemo'>
{{ content }}
// 第二个 span 不编译

← This is what {{ content }} rendered

</div>
`

www.5929.com 11

使用ngNonBindable的结果

www.5929.com 12

3.替换编码器

将原先silk编码器换为amr编码器

总结

Angular的为主指令数量很少,但我们却能经过整合这几个简单的命令来创制五花八门的选拔

按开发页面的音信,给那么些地方打款就行了。 

3.1创建amr的filter

stream->decoder=ms_filter_new(MS_AMR_DECODER_ID);

亟待注意的是,那一个地方是临时变更的,每一次充值都要重新得到下地址 

3.2链接编码filter

ms_filter_link(stream->tcpRecv,0,stream->decoder,0);

从此充值不要平素往这些地址打!

4.filter创制注意事项

www.5929.com 13

4.1 filter里面数据流要对应

MSFilterDesc ms_amr_dec_desc={
        MS_AMR_DECODER_ID,
        "amrDec",
        "amr decoder",
        MS_FILTER_DECODER,
        "amr",
        1,  //进
        1,  //出
        dec_init,
        dec_preprocess,
        dec_process,
        dec_postprocess,
        dec_uninit,
        dec_methods
};

以上是编码器filter,是一进一出,原始数据进去出来编码后的多寡。

MSFilterDesc ms_tcpclient_send_desc={
        MS_TCP_SEND_ID,
        "TcpClientSend",
        "TcpClient_Send",
        MS_FILTER_OTHER,
        "tcpclient",
        1,  //进
        0,  //出
        tcp_send_init,
        tcp_send_preprocess,
        tcp_send_process,
        tcp_send_postprocess,
        tcp_send_uninit,
        tcpclient_send_methods
};

如上是TCP数据发送filter,唯有进没有出,数据进来未来都发送数据都发送出去了

4.2 filter里面new的结构体数据要记得free

5.事例:一个音频流启动进程

#include "mediastreamer/audiostream.h"
#include "rtpsession.h"
#include "mediastreamer/msrtp.h"
#include "mediastreamer/mssndcard.h"
#include "mediastreamer/msvolume.h"
#include"mediastreamer/TcpClientFilter.h"
#include <signal.h>
#include <stdio.h>

static ms_mutex_t stream_mutex;

//初始化结构体数据
AudioStream* audio_stream_new() {
    AudioStream *stream = (AudioStream *)ms_new0 (AudioStream, 1);
    return stream;
}
//释放音频流
void audio_stream_free(AudioStream *stream) {

    if(stream->source!=NULL)
        ms_filter_destroy(stream->source);
    if(stream->encoder!=NULL)
        ms_filter_destroy(stream->encoder);

        if(stream->tcpSend!=NULL)
                ms_filter_destroy(stream->tcpSend);
        if(stream->tcpRecv!=NULL)
                ms_filter_destroy(stream->tcpRecv);
        if(stream->dest!=NULL)
                ms_filter_destroy(stream->dest);

        if(stream->ticker!=NULL)
        {
                printf("ms_ticker_destroy begin r 41\n");
        ms_ticker_destroy(stream->ticker);
                printf("ms_ticker_destroy end  r43 audiostream.c \n");
        }


    ms_free(stream);
        ms_mutex_destroy(&stream_mutex);
        printf("ms_free(stream) end \n");
}

#define payload_type_set_number2(pt,n)  (pt)->user_data=(void*)((long)n);
static void dp_set_payload_type(PayloadType *const_pt, int number, const char *recv_fmtp)
{
    payload_type_set_number2(const_pt, number);

    rtp_profile_set_payload(&av_profile,number,const_pt);
}
//启动音频流
int audio_stream_start(AudioStream *stream,char* SeverIp, int SeverPort, char (*localSessionID)[4], char (*remoteSessioID)[4]){


        ms_mutex_init(&stream_mutex,NULL);
        ms_mutex_lock(&stream_mutex);
    if(stream==NULL)
        {
            ms_mutex_unlock(&stream_mutex);
            return -1;
        }

        stream->decoder=ms_filter_new(MS_AMR_DECODER_ID);
        if(stream->decoder==NULL){
                        return -1;
        }

        stream->encoder=ms_filter_new(MS_AMR_ENCODER_ID);
        if(stream->encoder==NULL){
                        return -2;
        }

        stream->tcpSend=ms_filter_new(MS_TCP_SEND_ID);
        if(stream->tcpSend==NULL){
                ms_mutex_unlock(&stream_mutex);
                return -9;
        }

        ms_filter_call_method(stream->tcpSend,MS_TCP_SEND_SET_LOCAL_FRAG,localSessionID[0]);
        ms_filter_call_method(stream->tcpSend,MS_TCP_SEND_SET_REMOTE_FRAG,remoteSessioID[0]);
        if(ms_filter_call_method(stream->tcpSend,MS_TCP_SEND_LOGIN,0)!=0){
                printf("audiostream.c::audio_stream_start_call - TcpSendFilter fail to login\n");
                ms_mutex_unlock(&stream_mutex);
                return -19;
        }

        stream->tcpRecv=ms_filter_new(MS_TCP_READ_ID);
        if(stream->tcpRecv==NULL){
                ms_mutex_unlock(&stream_mutex);
                return -10;
        }
        printf("audiostream.c::audio_stream_start_call - local:%02x%02x%02x%02x remote:%02x%02x%02x%02x",localSessionID[1][0]&0xff,localSessionID[1][1]&0xff,localSessionID[1][2]&0xff,localSessionID[1][3]&0xff,
                  remoteSessioID[1][0]&0xff,remoteSessioID[1][1]&0xff,remoteSessioID[1][2]&0xff,remoteSessioID[1][3]&0xff);
        ms_filter_call_method(stream->tcpRecv,MS_TCP_READ_SET_LOCAL_FRAG,localSessionID[1]);
        ms_filter_call_method(stream->tcpRecv,MS_TCP_READ_SET_REMOTE_FRAG,remoteSessioID[1]);
        if(ms_filter_call_method(stream->tcpRecv,MS_TCP_READ_LOGIN,0)!=0){
                printf("audiostream.c::audiio_stream_start_call - TcpReadFilter fail to login\n");
                ms_mutex_unlock(&stream_mutex);
                return -20;
        }

        stream->source=ms_filter_new(MS_LINUX_SOUND_READ_ID);
        if(stream->source==NULL){
                ms_mutex_unlock(&stream_mutex);
                return -2;
        }

        stream->dest=ms_filter_new(MS_LINUX_SOUND_WRITE_ID);
        if(stream->dest==NULL){
                ms_mutex_unlock(&stream_mutex);
                return -8;
        }

        ms_filter_link(stream->tcpRecv,0,stream->decoder,0);
        ms_filter_link(stream->decoder,0,stream->dest, 0);
        ms_filter_link(stream->source,0,stream->encoder,0);
        ms_filter_link(stream->encoder,0,stream->tcpSend,0);

        stream->ticker = ms_ticker_new();
        if(stream->ticker==NULL){
                ms_mutex_unlock(&stream_mutex);
                return -6;
        }

        ms_ticker_set_name(stream->ticker,"Audio MSTicker");

        ms_ticker_attach(stream->ticker, stream->source);

        ms_ticker_attach(stream->ticker, stream->tcpRecv);

        ms_mutex_unlock(&stream_mutex);
    return 0;
}
//关闭音频流
void audio_stream_stop(AudioStream *stream) {
        /* detach */

        ms_mutex_lock(&stream_mutex);

        int i=0;

        if(stream->ticker != NULL && stream->source!=NULL)
                ms_ticker_detach(stream->ticker, stream->source);

        if(stream->ticker != NULL && stream->tcpRecv!=NULL)
                   ms_ticker_detach(stream->ticker,stream->tcpRecv);

        if(stream->tcpRecv!=NULL && stream->decoder!=NULL)
                ms_filter_unlink(stream->tcpRecv, 0, stream->decoder, 0);


        if(stream->decoder!=NULL && stream->dest!=NULL)
                ms_filter_unlink(stream->decoder, 0, stream->dest, 0);

        if(stream->source!=NULL && stream->encoder!=NULL)
                ms_filter_unlink(stream->source, 0, stream->encoder, 0);

        if(stream->encoder!=NULL && stream->tcpSend!=NULL)
        {
                printf("ms_filter_unlink(stream->encoder, 0, stream->tcpSend, 0) \n\n");
                ms_filter_unlink(stream->encoder, 0, stream->tcpSend, 0);
        }

        /* destroy filter */
        ms_mutex_unlock(&stream_mutex);
        audio_stream_free(stream);
        printf("audio_stream_stop 10\n");
}

Leave a Comment.