Attached is a quick hack on testMPEG2TransportStreamer.cpp to give it a
compile-time mode for raw UDP streaming instead of RTP.
Perhaps it would be useful to include this in the next version.
--- testMPEG2TransportStreamer.cpp.orig 2012-04-30 12:03:15.000000000 -0600
+++ testMPEG2TransportStreamer.cpp 2012-04-30 12:27:55.000000000 -0600
@@ -15,7 +15,7 @@
**********/
// Copyright (c) 1996-2012, Live Networks, Inc. All rights reserved
// A test program that reads a MPEG-2 Transport Stream file,
-// and streams it using RTP
+// and streams it using either RTP or raw UDP
// main program
#include "liveMedia.hh"
@@ -30,6 +30,9 @@
Boolean const isSSM = False;
#endif
+// Uncomment this to send TS file over raw UDP instead of remuxing it for RTP
+#define USE_RAW_UDP 1
+
// To set up an internal RTSP server, uncomment the following:
//#define IMPLEMENT_RTSP_SERVER 1
// (Note that this RTSP server works for multicast only)
@@ -41,7 +44,7 @@
UsageEnvironment* env;
char const* inputFileName = "test.ts";
FramedSource* videoSource;
-RTPSink* videoSink;
+MediaSink* videoSink;
void play(); // forward
@@ -50,7 +53,6 @@
TaskScheduler* scheduler = BasicTaskScheduler::createNew();
env = BasicUsageEnvironment::createNew(*scheduler);
- // Create 'groupsocks' for RTP and RTCP:
char const* destinationAddressStr
#ifdef USE_SSM
= "232.255.42.42";
@@ -61,12 +63,21 @@
// 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 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);
+ static const int basePortNum = 1234;
+
+#ifdef USE_RAW_UDP
+ // Create 'groupsock' for raw UDP, then bind a raw UDP sink to it
+ const Port udpPort(basePortNum);
+ Groupsock udpGroupsock(*env, destinationAddress, udpPort, ttl);
+ videoSink = BasicUDPSink::createNew(*env, &udpGroupsock);
+#else
+ // Create 'groupsocks' for RTP and RTCP:
+ const unsigned short rtpPortNum = basePortNum;
+ const unsigned short rtcpPortNum = basePortNum+1;
+
const Port rtpPort(rtpPortNum);
const Port rtcpPort(rtcpPortNum);
@@ -115,7 +126,8 @@
char* url = rtspServer->rtspURL(sms);
*env << "Play this stream using the URL \"" << url << "\"\n";
delete[] url;
-#endif
+#endif // defined(IMPLEMENT_RTSP_SERVER)
+#endif // defined(USE_RAW_UDP)
// Finally, start the streaming:
*env << "Beginning streaming...\n";
_______________________________________________
live-devel mailing list
live-devel@lists.live555.com
http://lists.live555.com/mailman/listinfo/live-devel