当前位置: 首页>>代码示例>>C++>>正文


C++ SrsStream::write_4bytes方法代码示例

本文整理汇总了C++中SrsStream::write_4bytes方法的典型用法代码示例。如果您正苦于以下问题:C++ SrsStream::write_4bytes方法的具体用法?C++ SrsStream::write_4bytes怎么用?C++ SrsStream::write_4bytes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SrsStream的用法示例。


在下文中一共展示了SrsStream::write_4bytes方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: memcpy

int SrsHandshakeBytes::create_s0s1s2(const char* c1)
{
    int ret = ERROR_SUCCESS;
    
    if (s0s1s2) {
        return ret;
    }
    
    s0s1s2 = new char[3073];
    srs_random_generate(s0s1s2, 3073);
    
    // plain text required.
    SrsStream stream;
    if ((ret = stream.initialize(s0s1s2, 9)) != ERROR_SUCCESS) {
        return ret;
    }
    stream.write_1bytes(0x03);
    stream.write_4bytes(::time(NULL));
    // s2 time2 copy from c1
    if (c0c1) {
        stream.write_bytes(c0c1 + 1, 4);
    }
    
    // if c1 specified, copy c1 to s2.
    // @see: https://github.com/winlinvip/simple-rtmp-server/issues/46
    if (c1) {
        memcpy(s0s1s2 + 1537, c1, 1536);
    }
    
    return ret;
}
开发者ID:WilliamRen,项目名称:simple-rtmp-server,代码行数:31,代码来源:srs_protocol_rtmp.cpp

示例2:

 // read/write stream using SrsStream.
 void __srs_stream_write_4bytes(char* pp, int32_t value) 
 {
     static SrsStream stream;
     
     int ret = stream.initialize(pp, 4);
     srs_assert(ret == ERROR_SUCCESS);
     
     stream.write_4bytes(value);
 }
开发者ID:yejingyang,项目名称:simple-rtmp-server,代码行数:10,代码来源:srs_protocol_handshake.cpp

示例3: TEST

/**
* test the stream utility, write 34bytes
*/
VOID TEST(KernelStreamTest, StreamWrite4Bytes)
{
    SrsStream s;
    char data[1024];
    
    EXPECT_TRUE(ERROR_SUCCESS == s.initialize(data, 1024));
    
    s.write_4bytes(0x10111213);
    s.write_4bytes(0x14151617);
    s.write_4bytes(0x18192021);

    s.skip(-1 * s.pos());
    EXPECT_EQ(0x10, s.read_1bytes());
    s.skip(2);
    EXPECT_EQ(0x13, s.read_1bytes());
    s.skip(5);
    EXPECT_EQ(0x19, s.read_1bytes());
}
开发者ID:Benqing,项目名称:simple-rtmp-server,代码行数:21,代码来源:srs_utest_kernel.cpp

示例4:

int SrsHandshakeBytes::create_c0c1()
{
    int ret = ERROR_SUCCESS;
    
    if (c0c1) {
        return ret;
    }
    
    c0c1 = new char[1537];
    srs_random_generate(c0c1, 1537);
    
    // plain text required.
    static SrsStream stream;
    if ((ret = stream.initialize(c0c1, 9)) != ERROR_SUCCESS) {
        return ret;
    }
    stream.write_1bytes(0x03);
    stream.write_4bytes(::time(NULL));
    stream.write_4bytes(0x00);
    
    return ret;
}
开发者ID:WilliamRen,项目名称:simple-rtmp-server,代码行数:22,代码来源:srs_protocol_rtmp.cpp


注:本文中的SrsStream::write_4bytes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。