如何使用live555播放视频?

时间:2014-03-08 04:07:46

标签: c++ qt video-streaming live555

我使用C ++和Qt创建一个项目,将视频从KIT armTiny6410流式传输到笔记本电脑。我用live555来做。这是Thread to streaming文件。但是我不知道我需要包括什么因为当我编译时我得到了这些错误:

  

错误:未在此范围内声明'TaskScheduler'   错误:未在此范围内声明'scheduler'   错误:'BasicTaskScheduler'尚未声明   错误:未在此范围内声明'UsageEnvironment'   错误:'env'未在此范围内声明   错误:尚未声明'BasicUsageEnvironment'   错误:未在此范围内声明“UserAuthenticationDatabase”   错误:未在此范围内声明'authDB'   错误:未在此范围内声明“RTSPServer”   错误:'rtspServer'未在此范围内声明

void ThreadStream::run()
{
    // Begin by setting up our usage environment:
    TaskScheduler* scheduler = BasicTaskScheduler::createNew();
    UsageEnvironment* env = BasicUsageEnvironment::createNew(*scheduler);

    UserAuthenticationDatabase* authDB = NULL;
    #ifdef ACCESS_CONTROL
    // To implement client access control to the RTSP server, do the following:
    authDB = new UserAuthenticationDatabase;
    authDB->addUserRecord("username1", "password1"); // replace these with real strings
    // Repeat the above with each <username>, <password> that you wish to allow
    // access to the server.
    #endif

    // Create the RTSP server.  Try first with the default port number (554),
    // and then with the alternative port number (8888):
    RTSPServer* rtspServer;
    portNumBits rtspServerPortNum = 554;
    rtspServer = DynamicRTSPServer::createNew(*env, rtspServerPortNum, authDB);
    if (rtspServer == NULL) {
        rtspServerPortNum = 8888;
        rtspServer = DynamicRTSPServer::createNew(*env, rtspServerPortNum, authDB);
    }
    if (rtspServer == NULL) {
        QString msg = "Failed to create RTSP server";
        emit notifyMessage(msg);
        exit(1);
    }
    QString msge = "LIVE555 Media Server\n";
    char* urlPrefix = rtspServer->rtspURLPrefix();
    msge += "Play streams from this server using the URL\n\t"
        +  QString(urlPrefix) + "<filename>\nwhere <filename> is a file present in the current directory.\n"
        + "Each file's type is inferred from its name suffix:\n"
        + "\t\".264\" => a H.264 Video Elementary Stream file\n"
        + "\t\".aac\" => an AAC Audio (ADTS format) file\n"
        + "\t\".ac3\" => an AC-3 Audio file\n"
        + "\t\".amr\" => an AMR Audio file\n"
        + "\t\".dv\" => a DV Video file\n"
        + "\t\".m4e\" => a MPEG-4 Video Elementary Stream file\n"
        + "\t\".mkv\" => a Matroska audio+video+(optional)subtitles file\n"
        + "\t\".mp3\" => a MPEG-1 or 2 Audio file\n"
        + "\t\".mpg\" => a MPEG-1 or 2 Program Stream (audio+video) file\n"
        + "\t\".ts\" => a MPEG Transport Stream file\n"
        + "\t\t(a \".tsx\" index file - if present - provides server 'trick play' support)\n"
        + "\t\".wav\" => a WAV Audio file\n"
        + "\t\".webm\" => a WebM audio(Vorbis)+video(VP8) file\n";

    emit notifyMessage(msge);

    env->taskScheduler().doEventLoop(); // does not return
}

我的live555库:/ urs / lib / live 请帮我!非常感谢你!

1 个答案:

答案 0 :(得分:1)

您需要在文件夹 liveMedia / include BasicUsageEnvironment / include groupsock / include 文件夹中包含这三个文件源代码目录

#include <liveMedia.hh>
#include <BasicUsageEnvironment.hh>
#include <GroupsockHelper.hh>