[Live-devel] (no subject)

julien.savarese at dcnsgroup.com julien.savarese at dcnsgroup.com
Wed May 7 07:23:48 PDT 2008


hello, 

I am a student engineer in France, in the DCNS society, and I wish  stream 
a video acquisition card : 
I am using the test program testMPEG1or2VideoStreamer, and have modifie 
the adresse like indicated in the forum. 

like this : 
******************************************************************************************************************** 

This library is free software; you can redistribute it and/or modify it 
under 
the terms of the GNU Lesser General Public License as published by the 
Free Software Foundation; either version 2.1 of the License, or (at your 
option) any later version. (See <http://www.gnu.org/copyleft/lesser.html
>.) 

This library is distributed in the hope that it will be useful, but 
WITHOUT 
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
FITNESS 
FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for 
more details. 

You should have received a copy of the GNU Lesser General Public License 
along with this library; if not, write to the Free Software Foundation, 
Inc., 
59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
**********/ 
// Copyright (c) 1996-2007, Live Networks, Inc.  All rights reserved 
// A test program that reads a MPEG-1 or 2 Video Elementary Stream file, 
// and streams it using RTP 
// main program 

#include "liveMedia.hh" 
#include "BasicUsageEnvironment.hh" 
#include "GroupsockHelper.hh" 

// Uncomment the following if the input file is a MPEG Program Stream 
// rather than a MPEG Video Elementary Stream 
//#define SOURCE_IS_PROGRAM_STREAM 1 

// To stream using "source-specific multicast" (SSM), uncomment the 
following: 
//#define USE_SSM 1 
#ifdef USE_SSM 
Boolean const isSSM = True; 
#else 
Boolean const isSSM = False; 
#endif 

// To set up an internal RTSP server, uncomment the following: 
//#define IMPLEMENT_RTSP_SERVER 1 
// (Note that this RTSP server works for multicast only) 

// To stream *only* MPEG "I" frames (e.g., to reduce network bandwidth), 
// change the following "False" to "True": 
Boolean iFramesOnly = True; 

UsageEnvironment* env; 
char const* inputFileName = "/dev/video0"; 
#ifdef SOURCE_IS_PROGRAM_STREAM 
MPEG1or2Demux* mpegDemux; 
#endif 
MediaSource* videoSource; 
RTPSink* videoSink; 

void play(); // forward 

int main(int argc, char** argv) { 
  // Begin by setting up our usage environment: 
  TaskScheduler* scheduler = BasicTaskScheduler::createNew(); 
  env = BasicUsageEnvironment::createNew(*scheduler); 

  // Create 'groupsocks' for RTP and RTCP: 
  char* destinationAddressStr 
#ifdef USE_SSM 
    = "192.168.0.2"; 
#else 
    = "192.168.0.2"; 
  // Note: This is a multicast address.  If you wish to stream using 
  // unicast instead, then replace this string with the unicast address 
  // of the (single) destination.  (You may also need to make a similar 
  // change to the receiver program.) 
#endif 
  const unsigned short rtpPortNum = 1234; 
 // const unsigned short rtpPortNum = 8888; 
  const unsigned short rtcpPortNum = rtpPortNum+1; 
  const unsigned char ttl = 1; // low, in case routers don't admin scope 

  struct in_addr destinationAddress; 
  destinationAddress.s_addr = our_inet_addr(destinationAddressStr); 
  printf("inet ==%d\n",destinationAddress.s_addr); 
 
  const Port rtpPort(rtpPortNum); 

  const Port rtcpPort(rtcpPortNum); 

    printf("debut\n"); 
  Groupsock rtpGroupsock(*env, destinationAddress, rtpPort, ttl); 
 // Groupsock rtcpGroupsock(*env, destinationAddress, rtcpPort, ttl); 

#ifdef USE_SSM 
  rtpGroupsock.multicastSendOnly(); 
  rtcpGroupsock.multicastSendOnly(); 
#endif 

  // Create a 'MPEG Video RTP' sink from the RTP 'groupsock': 
  videoSink = MPEG1or2VideoRTPSink::createNew(*env, &rtpGroupsock); 


  // Finally, start the streaming: 
  *env << "Beginning streaming...\n"; 
  play(); 

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

  return 0; // only to prevent compiler warning 
} 

void afterPlaying(void* /*clientData*/) { 
  *env << "...done reading from file\n"; 

  Medium::close(videoSource); 
#ifdef SOURCE_IS_PROGRAM_STREAM 
  Medium::close(mpegDemux); 
#endif 
  // Note that this also closes the input file that this source read from. 


  play(); 
} 

void play() { 
  // Open the input file as a 'byte-stream file source': 
  ByteStreamFileSource* fileSource 
    = ByteStreamFileSource::createNew(*env, inputFileName); 
  if (fileSource == NULL) { 
    *env << "Unable to open file \"" << inputFileName 
         << "\" as a byte-stream file source\n"; 
    exit(1); 
  } 
 
  FramedSource* videoES; 
#ifdef SOURCE_IS_PROGRAM_STREAM 
  // We must demultiplex a Video Elementary Stream from the input source: 
  mpegDemux = MPEG1or2Demux::createNew(*env, fileSource); 
  videoES = mpegDemux->newVideoStream(); 
#else 
  // The input source is assumed to already be a Video Elementary Stream: 
  videoES = fileSource; 
#endif 

  // Create a framer for the Video Elementary Stream: 
  videoSource 
    = MPEG1or2VideoStreamFramer::createNew(*env, videoES, iFramesOnly); 

  // Finally, start playing: 
  *env << "Beginning to read from file...\n"; 
  videoSink->startPlaying(*videoSource, afterPlaying, videoSink); 
} 
******************************************************************************************************************** 



I just want send the video via RTP, and i Have this error message : 

********************************************************************************* 

[root at audio_1 testProgs]# ./testMPEG1or2VideoStreamer 
debut 
Unable to determine our source address: This computer has an invalid IP 
address: 0x0 
Beginning streaming... 
Beginning to read from file... 
********************************************************************************** 


I don't understand, because my IP adresse  is correct, but i'm using the 
same computer to stream and receive, 
I receive with VLC, and stream with this testprog. 

What 's wrong ??? 
Thank you. 

_________________________
     Julien Savarese 
     Apprenti ingénieur. 
     Division SIS/DPM/RMS/MIE.
---------------------------------------------

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.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20080507/817d0207/attachment-0001.html>


More information about the live-devel mailing list