コード例 #1
0
ファイル: rtp_send.c プロジェクト: freeloops/openDMD
void rtp_send(const char *sendfile,
        const char *clientIP, const int clientPort,
        const char *remoteIP, const int remotePort) {
    unsigned char buffer[SEND_LEN];
    unsigned int user_ts = 0;
    int readlen = 0;
    int sendlen = 0;

    rtp_send_init();
    RtpSession *rtpsession = rtp_send_createSession(
            clientIP, clientPort, remoteIP, remotePort);
    assert(rtpsession != NULL);

    assert(sendfile != NULL);
    FILE *fp = fopen(sendfile, "r");
    assert(fp != NULL);

    while ((readlen = fread(buffer,
                    sizeof(unsigned char), SEND_LEN, fp)) > 0) {
        sendlen = rtp_session_send_with_ts(rtpsession,
                buffer, readlen, user_ts);
        printf("read %d bytes, send %d bytes\n", readlen, sendlen);

        user_ts += VIDEO_TIME_STAMP_INC;
    }

    fclose(fp);

    rtp_session_destroy(rtpsession);
    rtp_send_release();
    ortp_global_stats_display();
}
コード例 #2
0
ファイル: rtp.c プロジェクト: labdong801/tcsip
int rtp_io_alloc(struct rtp **rp, fmt_t fmt)
{
    struct rtp *rtp;

    rtp = mem_zalloc(sizeof(struct rtp), destruct);
    if(!rtp)
        return -ENOMEM;

    rtp->fmt = fmt;
    rtp->send_h = rtp_send_func(fmt);
    rtp->sender = rtp_send_init(fmt);

    *rp = rtp;

    return 0;
}