<br><font size=2 face="sans-serif">hello,</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
I am a student engineer in France, in the DCNS society, and I wish stream
a video acquisition card : <br>
I am using the test program testMPEG1or2VideoStreamer, and have modifie
the adresse like indicated in the forum.</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
like this : <br>
********************************************************************************************************************</font><font size=3>
</font><font size=2 face="Courier New"><br>
This library is free software; you can redistribute it and/or modify it
under</font><font size=3> </font><font size=2 face="Courier New"><br>
the terms of the GNU Lesser General Public License as published by the</font><font size=3>
</font><font size=2 face="Courier New"><br>
Free Software Foundation; either version 2.1 of the License, or (at your</font><font size=3>
</font><font size=2 face="Courier New"><br>
option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.)</font><font size=3>
<br>
</font><font size=2 face="Courier New"><br>
This library is distributed in the hope that it will be useful, but WITHOUT</font><font size=3>
</font><font size=2 face="Courier New"><br>
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS</font><font size=3>
</font><font size=2 face="Courier New"><br>
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
for</font><font size=3> </font><font size=2 face="Courier New"><br>
more details.</font><font size=3> <br>
</font><font size=2 face="Courier New"><br>
You should have received a copy of the GNU Lesser General Public License</font><font size=3>
</font><font size=2 face="Courier New"><br>
along with this library; if not, write to the Free Software Foundation,
Inc.,</font><font size=3> </font><font size=2 face="Courier New"><br>
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</font><font size=3>
</font><font size=2 face="Courier New"><br>
**********/</font><font size=3> </font><font size=2 face="Courier New"><br>
// Copyright (c) 1996-2007, Live Networks, Inc. All rights reserved</font><font size=3>
</font><font size=2 face="Courier New"><br>
// A test program that reads a MPEG-1 or 2 Video Elementary Stream file,</font><font size=3>
</font><font size=2 face="Courier New"><br>
// and streams it using RTP</font><font size=3> </font><font size=2 face="Courier New"><br>
// main program</font><font size=3> <br>
</font><font size=2 face="Courier New"><br>
#include "liveMedia.hh"</font><font size=3> </font><font size=2 face="Courier New"><br>
#include "BasicUsageEnvironment.hh"</font><font size=3> </font><font size=2 face="Courier New"><br>
#include "GroupsockHelper.hh"</font><font size=3> <br>
</font><font size=2 face="Courier New"><br>
// Uncomment the following if the input file is a MPEG Program Stream</font><font size=3>
</font><font size=2 face="Courier New"><br>
// rather than a MPEG Video Elementary Stream</font><font size=3> </font><font size=2 face="Courier New"><br>
//#define SOURCE_IS_PROGRAM_STREAM 1</font><font size=3> <br>
</font><font size=2 face="Courier New"><br>
// To stream using "source-specific multicast" (SSM), uncomment
the following:</font><font size=3> </font><font size=2 face="Courier New"><br>
//#define USE_SSM 1</font><font size=3> </font><font size=2 face="Courier New"><br>
#ifdef USE_SSM</font><font size=3> </font><font size=2 face="Courier New"><br>
Boolean const isSSM = True;</font><font size=3> </font><font size=2 face="Courier New"><br>
#else</font><font size=3> </font><font size=2 face="Courier New"><br>
Boolean const isSSM = False;</font><font size=3> </font><font size=2 face="Courier New"><br>
#endif</font><font size=3> <br>
</font><font size=2 face="Courier New"><br>
// To set up an internal RTSP server, uncomment the following:</font><font size=3>
</font><font size=2 face="Courier New"><br>
//#define IMPLEMENT_RTSP_SERVER 1</font><font size=3> </font><font size=2 face="Courier New"><br>
// (Note that this RTSP server works for multicast only)</font><font size=3>
<br>
</font><font size=2 face="Courier New"><br>
// To stream *only* MPEG "I" frames (e.g., to reduce network
bandwidth),</font><font size=3> </font><font size=2 face="Courier New"><br>
// change the following "False" to "True":</font><font size=3>
</font><font size=2 face="Courier New"><br>
Boolean iFramesOnly = True;</font><font size=3> <br>
</font><font size=2 face="Courier New"><br>
UsageEnvironment* env;</font><font size=3> </font><font size=2 face="Courier New"><br>
char const* inputFileName = "/dev/video0";</font><font size=3>
</font><font size=2 face="Courier New"><br>
#ifdef SOURCE_IS_PROGRAM_STREAM</font><font size=3> </font><font size=2 face="Courier New"><br>
MPEG1or2Demux* mpegDemux;</font><font size=3> </font><font size=2 face="Courier New"><br>
#endif</font><font size=3> </font><font size=2 face="Courier New"><br>
MediaSource* videoSource;</font><font size=3> </font><font size=2 face="Courier New"><br>
RTPSink* videoSink;</font><font size=3> <br>
</font><font size=2 face="Courier New"><br>
void play(); // forward</font><font size=3> <br>
</font><font size=2 face="Courier New"><br>
int main(int argc, char** argv) {</font><font size=3> </font><font size=2 face="Courier New"><br>
// Begin by setting up our usage environment:</font><font size=3>
</font><font size=2 face="Courier New"><br>
TaskScheduler* scheduler = BasicTaskScheduler::createNew();</font><font size=3>
</font><font size=2 face="Courier New"><br>
env = BasicUsageEnvironment::createNew(*scheduler);</font><font size=3>
<br>
</font><font size=2 face="Courier New"><br>
// Create 'groupsocks' for RTP and RTCP:</font><font size=3> </font><font size=2 face="Courier New"><br>
char* destinationAddressStr</font><font size=3> </font><font size=2 face="Courier New"><br>
#ifdef USE_SSM</font><font size=3> </font><font size=2 face="Courier New"><br>
= "192.168.0.2";</font><font size=3> </font><font size=2 face="Courier New"><br>
#else</font><font size=3> </font><font size=2 face="Courier New"><br>
= "192.168.0.2";</font><font size=3> </font><font size=2 face="Courier New"><br>
// Note: This is a multicast address. If you wish to stream
using</font><font size=3> </font><font size=2 face="Courier New"><br>
// unicast instead, then replace this string with the unicast address</font><font size=3>
</font><font size=2 face="Courier New"><br>
// of the (single) destination. (You may also need to make
a similar</font><font size=3> </font><font size=2 face="Courier New"><br>
// change to the receiver program.)</font><font size=3> </font><font size=2 face="Courier New"><br>
#endif</font><font size=3> </font><font size=2 face="Courier New"><br>
const unsigned short rtpPortNum = 1234;</font><font size=3> </font><font size=2 face="Courier New"><br>
// const unsigned short rtpPortNum = 8888;</font><font size=3> </font><font size=2 face="Courier New"><br>
const unsigned short rtcpPortNum = rtpPortNum+1;</font><font size=3>
</font><font size=2 face="Courier New"><br>
const unsigned char ttl = 1; // low, in case routers don't admin
scope</font><font size=3> <br>
</font><font size=2 face="Courier New"><br>
struct in_addr destinationAddress;</font><font size=3> </font><font size=2 face="Courier New"><br>
destinationAddress.s_addr = our_inet_addr(destinationAddressStr);</font><font size=3>
</font><font size=2 face="Courier New"><br>
printf("inet ==%d\n",destinationAddress.s_addr);</font><font size=3>
</font><font size=2 face="Courier New"><br>
<br>
const Port rtpPort(rtpPortNum);</font><font size=3> <br>
</font><font size=2 face="Courier New"><br>
const Port rtcpPort(rtcpPortNum);</font><font size=3> <br>
</font><font size=2 face="Courier New"><br>
printf("debut\n");</font><font size=3> </font><font size=2 face="Courier New"><br>
Groupsock rtpGroupsock(*env, destinationAddress, rtpPort, ttl);</font><font size=3>
</font><font size=2 face="Courier New"><br>
// Groupsock rtcpGroupsock(*env, destinationAddress, rtcpPort, ttl);</font><font size=3>
<br>
</font><font size=2 face="Courier New"><br>
#ifdef USE_SSM</font><font size=3> </font><font size=2 face="Courier New"><br>
rtpGroupsock.multicastSendOnly();</font><font size=3> </font><font size=2 face="Courier New"><br>
rtcpGroupsock.multicastSendOnly();</font><font size=3> </font><font size=2 face="Courier New"><br>
#endif</font><font size=3> <br>
</font><font size=2 face="Courier New"><br>
// Create a 'MPEG Video RTP' sink from the RTP 'groupsock':</font><font size=3>
</font><font size=2 face="Courier New"><br>
videoSink = MPEG1or2VideoRTPSink::createNew(*env, &rtpGroupsock);</font><font size=3>
<br>
<br>
</font><font size=2 face="Courier New"><br>
// Finally, start the streaming:</font><font size=3> </font><font size=2 face="Courier New"><br>
*env << "Beginning streaming...\n";</font><font size=3>
</font><font size=2 face="Courier New"><br>
play();</font><font size=3> <br>
</font><font size=2 face="Courier New"><br>
env->taskScheduler().doEventLoop(); // does not return</font><font size=3>
<br>
</font><font size=2 face="Courier New"><br>
return 0; // only to prevent compiler warning</font><font size=3>
</font><font size=2 face="Courier New"><br>
}</font><font size=3> <br>
</font><font size=2 face="Courier New"><br>
void afterPlaying(void* /*clientData*/) {</font><font size=3> </font><font size=2 face="Courier New"><br>
*env << "...done reading from file\n";</font><font size=3>
<br>
</font><font size=2 face="Courier New"><br>
Medium::close(videoSource);</font><font size=3> </font><font size=2 face="Courier New"><br>
#ifdef SOURCE_IS_PROGRAM_STREAM</font><font size=3> </font><font size=2 face="Courier New"><br>
Medium::close(mpegDemux);</font><font size=3> </font><font size=2 face="Courier New"><br>
#endif</font><font size=3> </font><font size=2 face="Courier New"><br>
// Note that this also closes the input file that this source read
from.</font><font size=3> <br>
</font><font size=2 face="Courier New"><br>
play();</font><font size=3> </font><font size=2 face="Courier New"><br>
}</font><font size=3> <br>
</font><font size=2 face="Courier New"><br>
void play() {</font><font size=3> </font><font size=2 face="Courier New"><br>
// Open the input file as a 'byte-stream file source':</font><font size=3>
</font><font size=2 face="Courier New"><br>
ByteStreamFileSource* fileSource</font><font size=3> </font><font size=2 face="Courier New"><br>
= ByteStreamFileSource::createNew(*env, inputFileName);</font><font size=3>
</font><font size=2 face="Courier New"><br>
if (fileSource == NULL) {</font><font size=3> </font><font size=2 face="Courier New"><br>
*env << "Unable to open file \"" <<
inputFileName</font><font size=3> </font><font size=2 face="Courier New"><br>
<< "\" as a byte-stream file
source\n";</font><font size=3> </font><font size=2 face="Courier New"><br>
exit(1);</font><font size=3> </font><font size=2 face="Courier New"><br>
}</font><font size=3> </font><font size=2 face="Courier New"><br>
<br>
FramedSource* videoES;</font><font size=3> </font><font size=2 face="Courier New"><br>
#ifdef SOURCE_IS_PROGRAM_STREAM</font><font size=3> </font><font size=2 face="Courier New"><br>
// We must demultiplex a Video Elementary Stream from the input
source:</font><font size=3> </font><font size=2 face="Courier New"><br>
mpegDemux = MPEG1or2Demux::createNew(*env, fileSource);</font><font size=3>
</font><font size=2 face="Courier New"><br>
videoES = mpegDemux->newVideoStream();</font><font size=3> </font><font size=2 face="Courier New"><br>
#else</font><font size=3> </font><font size=2 face="Courier New"><br>
// The input source is assumed to already be a Video Elementary
Stream:</font><font size=3> </font><font size=2 face="Courier New"><br>
videoES = fileSource;</font><font size=3> </font><font size=2 face="Courier New"><br>
#endif</font><font size=3> <br>
</font><font size=2 face="Courier New"><br>
// Create a framer for the Video Elementary Stream:</font><font size=3>
</font><font size=2 face="Courier New"><br>
videoSource</font><font size=3> </font><font size=2 face="Courier New"><br>
= MPEG1or2VideoStreamFramer::createNew(*env, videoES, iFramesOnly);</font><font size=3>
<br>
</font><font size=2 face="Courier New"><br>
// Finally, start playing:</font><font size=3> </font><font size=2 face="Courier New"><br>
*env << "Beginning to read from file...\n";</font><font size=3>
</font><font size=2 face="Courier New"><br>
videoSink->startPlaying(*videoSource, afterPlaying, videoSink);</font><font size=3>
</font><font size=2 face="Courier New"><br>
}</font><font size=3> </font><font size=2 face="sans-serif"><br>
********************************************************************************************************************</font><font size=3>
<br>
<br>
</font><font size=2 face="sans-serif"><br>
I just want send the video via RTP, and i Have this error message : </font><font size=3><br>
</font><font size=2 face="sans-serif"><br>
*********************************************************************************</font><font size=3>
</font><font size=2 face="sans-serif"><br>
[root@audio_1 testProgs]# ./testMPEG1or2VideoStreamer</font><font size=3>
</font><font size=2 face="sans-serif"><br>
debut</font><font size=3> </font><font size=2 face="sans-serif"><br>
Unable to determine our source address: This computer has an invalid IP
address: 0x0</font><font size=3> </font><font size=2 face="sans-serif"><br>
Beginning streaming...</font><font size=3> </font><font size=2 face="sans-serif"><br>
Beginning to read from file...</font><font size=3> </font><font size=2 face="sans-serif"><br>
**********************************************************************************</font><font size=3>
<br>
</font><font size=2 face="sans-serif"><br>
I don't understand, because my IP adresse is correct, but i'm using
the same computer to stream and receive, <br>
I receive with VLC, and stream with this testprog.</font><font size=3>
<br>
</font><font size=2 face="sans-serif"><br>
What 's wrong ???</font><font size=3> </font><font size=2 face="sans-serif"><br>
Thank you.</font><font size=3> <br>
</font>
<br><font size=2 face="sans-serif">_________________________<br>
Julien Savarese
<br>
Apprenti ingénieur.
<br>
Division SIS/DPM/RMS/MIE.<br>
---------------------------------------------<br>
</font>Pensez a l'environnement : avez-vous besoin d'imprimer ce message ?
Think Environment : Do you need to print this message ?
Ce courrier électronique, et éventuellement ses pièces jointes, peuvent contenir des informations confidentielles et/ou personnelles et a été envoyé uniquement à l'usage de la personne ou de l'entité citée ci-dessus. Si vous receviez ce courrier électronique par erreur, merci de bien vouloir en avertir l'expéditeur immédiatement par la réponse en retour à ce courrier et effacer l'original et détruire toute copie enregistrée dans un ordinateur, ou imprimée ou encore sauvegardée sur un disque . Toute revue, retransmission ou toute autre forme d'utilisation de ce courrier électronique par toute autre personne que le destinataire prévue est strictement interdite.
L'internet ne permettant pas d'assurer l'intégrité de ce message, l'expéditeur décline toute responsabilité au cas où il aurait été intercepté ou modifié par quiconque.
This e-mail and possibly any attachment may contain confidential and/or privileged information and is intended only for the use of the individual or entity named above. If you have received it in error, please advise the sender immediately by reply e-mail and delete and destroy all copies including all copies stored in the recipient's computer, printed or saved to disk. . Any review , retransmission, or further use of this e-mail by by persons or entities other than the intended recipient is strictly prohibited. Because of the nature of the Internet the sender is not in a position to ensure the integrity of this message, therefore the sender disclaims any liability whatsoever, in the event of this message having been intercepted and/or altered.