[Live-devel] Re : help -- Streaming RTP/JPEG Multicast

Armando Ko armandopoulos at yahoo.fr
Wed Feb 14 06:05:00 PST 2007


hi,

i try to stream jpeg image files as multicast to 239.255.42.42 but vlc can show the pictures in the report i can read this errors 

ps warning: found sync code
ps warning: garbage at input, trying to resync...

i don´t know what are missing in the streaming.

i think i don´t need "ByteStreamFileSource"  to open the file as a byte stream but open the file also stream like this

m_ImageSource = ImageSource::createNew(*m_Env, pFileName, timeToDisplay);

    if (m_ImageSource == NULL) {
        *m_Env << "Unable to open file \"" << pFileName
            << "\" as a byte-stream file source\n";
        return FALSE;
    }

    // Finally, start playing ---------------------------------
   *m_Env << "Beginning streaming image...\n";
    m_ImageSink->startPlaying(*m_ImageSource, OnEndShowImage, this);

thanks for a tips or ideas.
Armando



----- Message d'origine ----
De : Armando Ko <armandopoulos at yahoo.fr>
À : live-devel at ns.live555.com
Envoyé le : Mardi, 13 Février 2007, 16h51mn 36s
Objet : [Live-devel] help -- Streaming RTP/JPEG Multicast

hi Ross,

i try to stream jpeg Files as RTP Multicast with the live555. But  i can stream  the jpegfiles but the vlc cannot see them and with wireshark i can see the jpeg frames they are sending, also here is my test program for do it.

i would be very happy, if you can give me some tips or what is wrong in my code.

The ImageSource is a subclass of  JPEGVideoSource where i define this methodes
 
createNew(UsageEnvironment& env, char const* fileName, unsigned viewTime);
// redefined virtual functions:
    virtual void doGetNextFrame();
    virtual u_int8_t type();
    virtual u_int8_t qFactor();
    virtual u_int8_t width();
    virtual u_int8_t height();
    virtual u_int8_t const* quantizationTables(u_int8_t& precision, u_int16_t& length);

here is my testprogramm (see attachment)

 thanks

Armando





		 
Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! 
Profitez des connaissances, des opinions et des expériences des internautes sur Yahoo! Questions/Réponses.
UsageEnvironment* env;
char const* inputFileName = "test.jpeg";
ImageSource* ImageSource;
JPEGVideoRTPSink* ImageSink;

void play(); // forward

int main(int argc, char** argv) {

// Begin by setting up our usage environment:
    TaskScheduler* scheduler = BasicTaskScheduler::createNew();
     m_Env = BasicUsageEnvironment::createNew(*scheduler);

    // Create 'groupsocks' for RTP and RTCP:
    char* destinationAddressStr = "239.255.42.42";
    const unsigned short rtpPortNum = 1234;
    const unsigned short rtcpPortNum = rtpPortNum+1;
    const unsigned char ttl = 7; // low, in case routers don't admin scope
   
    struct in_addr destinationAddress;
    destinationAddress.s_addr = our_inet_addr(destinationAddressStr);
    const Port rtpPort(rtpPortNum);
    const Port rtcpPort(rtcpPortNum);
    Groupsock rtpGroupsock(*env, destinationAddress, rtpPort, ttl);
    Groupsock rtcpGroupsock(*env, destinationAddress, rtcpPort, ttl);
 
    ImageSink = JPEGVideoRTPSink::createNew(*m_Env, rtpGroupsock);

    // Create (and start) a 'RTCP instance' for this RTP sink:
      const unsigned estimatedSessionBandwidth = 5000; // in kbps; for RTCP b/w share
      const unsigned maxCNAMElen = 100;
      unsigned char CNAME[maxCNAMElen+1];
      gethostname((char*)CNAME, maxCNAMElen);
      CNAME[maxCNAMElen] = '\0'; // just in case


      RTCPInstance::createNew(*m_Env,m_rtcpGroupsock,
                              estimatedSessionBandwidth, CNAME,
                              ImageSink, NULL /* we're a server */,/*isSSM*/false);
                          
// 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(ImageSource);
  // Note that this also closes the input file that this source read from.
  play();
}

void play() {
    //----------- Create a framer for the image elementary Stream---------
    m_ImageSource = ImageSource::createNew(*m_Env, inputFileName, timeToDisplay); //timeToDisplay
    if (m_ImageSource == NULL) {
       *m_Env << "Unable to open file \"" << inputFileName
            << "\" as a byte-stream file source\n";
        return FALSE;
    }
    // Finally, start playing ---------------------------------
   *m_Env << "Beginning streaming image...\n";
     m_ImageSink->startPlaying(*m_ImageSource, afterPlaying, ImageSink);

}
_______________________________________________
live-devel mailing list
live-devel at lists.live555.com
http://lists.live555.com/mailman/listinfo/live-devel







	

	
		
___________________________________________________________________________ 
Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! 
Profitez des connaissances, des opinions et des expériences des internautes sur Yahoo! Questions/Réponses 
http://fr.answers.yahoo.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.live555.com/pipermail/live-devel/attachments/20070214/dcc76b90/attachment.html 


More information about the live-devel mailing list