Hello,<br>I'm a student and beginner with the live555 library.<br>I have been writing some simple test programs for handling rtsp streaming.<br>Now I'm trying take only videowidth,videoheight,fps and buffer from streaming.<br>
I'm make use of mplayer source code. But mplayer using demux_t class for handling buffer.<br>This is too complex for me.<br>What is the simply way for taking (videowidth,videoheight,fps and buffer) this data? Thanks.<br>
<br>Here source codes<br>
#include "rtspdene.h"<br>#include "BasicUsageEnvironment.hh"<br>#include "GroupsockHelper.hh"<br>#include <stdio.h><br><br>int rtspStreamOverTCP = 0;<br>char* network_username;<br>
char* network_password;<br><br><br>static char* openURL_rtsp(RTSPClient* client, char const* url) {<br> // If we were given a user name (and optional password), then use them: <br> if (network_username != NULL) {<br> char const* password = network_password == NULL ? "" : network_password;<br>
return client->describeWithPassword<div id="1f5g" class="ArwC7c ckChnd">(url, network_username, password);<br> } else {<br> return client->describeURL(url);<br> }<br>}<br><br>int main()<br>{<br> char const* url = "rtsp://<a href="http://192.168.2.200:554/" target="_blank">192.168.2.200:554</a>";<br>
Boolean success = False;<br> do {<br><br> TaskScheduler* scheduler = BasicTaskScheduler::createNew();<br> if (scheduler == NULL)<br> {<br> printf("BasicTaskScheduler::createNew hata");<br>
break;<br> }<br><br> UsageEnvironment* env = BasicUsageEnvironment::createNew(*scheduler);<br> if (env == NULL)<br> {<br> printf("BasicUsageEnvironment::createNew hata");<br>
break;<br> }<br><br> RTSPClient* rtspClient = NULL;<br><br> rtspClient = RTSPClient::createNew(*env, 1, "MRT");<br> if (rtspClient == NULL)<br> { printf("Failed to create RTSP client"); }<br>
<br> char* sdpDescription = NULL;<br> sdpDescription = openURL_rtsp(rtspClient,url);<br><br> if (sdpDescription == NULL) {<br> printf( "Failed to get a SDP description from URL \"%s\": %s\n", url, env->getResultMsg());<br>
break;<br> }<br><br> // Now that we have a SDP description, create a MediaSession from it:<br> MediaSession* mediaSession = MediaSession::createNew(*env, sdpDescription);<br> if (mediaSession == NULL) {<br>
printf("Failed to create mediaSession");<br> break;<br> }<br><br> int audiofound = 0;<br> // Create RTP receivers (sources) for each subsession:<br> MediaSubsessionIterator iter(*mediaSession);<br>
MediaSubsession* subsession;<br> unsigned desiredReceiveBufferSize;<br> while ((subsession = iter.next()) != NULL)<br> {<br> // Ignore any subsession that's not audio or video:<br>
if (strcmp(subsession->mediumName(), "audio") == 0) {<br> if (audiofound) {<br> printf("Additional subsession \"audio/%s\" skipped\n", subsession->codecName());<br>
continue;<br> }<br> desiredReceiveBufferSize = 100000;<br> } else if (strcmp(subsession->mediumName(), "video") == 0) {<br> desiredReceiveBufferSize = 2000000;<br>
} else {<br> continue;<br> }<br><br> if (!subsession->initiate()) {<br>
printf( "Failed to initiate \"%s/%s\" RTP subsession:
%s\n", subsession->mediumName(), subsession->codecName(),
env->getResultMsg());<br>
} else {<br>
printf( "Initiated \"%s/%s\" RTP subsession on port %d\n",
subsession->mediumName(), subsession->codecName(),
subsession->clientPortNum());<br><br> // Set the OS's socket receive buffer sufficiently large to avoid<br>
// incoming packets getting dropped between successive reads from this<br> // subsession's demuxer. Depending on the bitrate(s) that you expect,<br> // you may wish to tweak the "desiredReceiveBufferSize" values above.<br>
int rtpSocketNum = subsession->rtpSource()->RTPgs()->socketNum();<br> int receiveBufferSize = increaseReceiveBufferTo(*env, rtpSocketNum,desiredReceiveBufferSize);<br><br> printf("Increased %s socket receive buffer to %d bytes \n", subsession->mediumName(), receiveBufferSize);<br>
<br> if (rtspClient != NULL) {<br> // Issue a RTSP "SETUP" command on the chosen subsession:<br> if (!rtspClient->setupMediaSubsession(*subsession, False, rtspStreamOverTCP)) break;<br>
if (!strcmp(subsession->mediumName(), "audio"))<br> audiofound = 1;<br> }<br> }<br> }<br><br> if (rtspClient != NULL) {<br> // Issue a RTSP aggregate "PLAY" command on the whole session:<br>
if (!rtspClient->playMediaSession(*mediaSession)) {<br> printf( "playMediaSession hata");<br> break;<br> }<br> }<br><br> // Now that the session is ready to be read, do additional<br>
// MPlayer codec-specific initialization on each subsession:<br> iter.reset();<br> while ((subsession = iter.next()) != NULL) {<br> if (subsession->readSource() == NULL) continue; // not reading this<br>
<br> unsigned flags = 0;<br> if (strcmp(subsession->mediumName(), "audio") == 0) {<br> ???????<br> } else if (strcmp(subsession->mediumName(), "video") == 0) {<br>
???????<br> }<br><br> }<br> success = True;<br><br><br>
} while (0);<br><br> ???????<br><br> return 0;<br>}</div>