[Live-devel] Some modifications done on the library

David BERTRAND bidibulle at operamail.com
Wed Oct 4 12:34:49 PDT 2006


Hi Ross,

I had to modify slightly some classes of your latest build to be able to use inheritance for my project. The most difficult tasks were to inherit from MediaSession and from RTCPInstance. As the LGPL license requires 
it, I would like to publish my patches, so please find them here 
attached. It is, most of the time, just changing accessors (from 
"private" to "protected"). Of course, I would pleased if you could 
consider those patches. This would help me in always keeping the 
latest liveMedia library in my project and maybe help some other folks integrating liveMedia library in projects like mine. Of course, would you need more rationale about any of those changes, feel free to ask me.

David


-- 
_______________________________________________
Surf the Web in a faster, safer and easier way:
Download Opera 9 at http://www.opera.com

Powered by Outblaze
-------------- next part --------------
--- ./liveMedia/include/AMRAudioFileSink.hh	2006-10-04 16:39:19.000000000 +0200
+++ ./liveMedia/include/AMRAudioFileSink.hh.orig	2006-10-03 23:36:41.000000000 +0200
@@ -32,7 +32,7 @@
 				     Boolean oneFilePerFrame = False);
   // (See "FileSink.hh" for a description of these parameters.)
 
-protected:
+private:
   AMRAudioFileSink(UsageEnvironment& env, FILE* fid, unsigned bufferSize,
 		   char const* perFrameFileNamePrefix);
       // called only by createNew()
@@ -43,7 +43,7 @@
   virtual void afterGettingFrame1(unsigned frameSize,
 				  struct timeval presentationTime);
 
-protected:
+private:
   Boolean fHaveWrittenHeader;
 };
 
--- ./liveMedia/include/AMRAudioRTPSink.hh	2006-10-04 14:57:05.000000000 +0200
+++ ./liveMedia/include/AMRAudioRTPSink.hh.orig	2006-10-03 15:22:31.000000000 +0200
@@ -33,9 +33,6 @@
 				    Boolean sourceIsWideband = False,
 				    unsigned numChannelsInSource = 1);
 
-public:
-  Boolean sourceIsWideband() const { return fSourceIsWideband; }
-
 protected:
   AMRAudioRTPSink(UsageEnvironment& env, Groupsock* RTPgs,
 		  unsigned char rtpPayloadFormat,
--- ./liveMedia/include/FramedSource.hh	2006-10-04 14:58:26.000000000 +0200
+++ ./liveMedia/include/FramedSource.hh.orig	2006-10-03 15:22:51.000000000 +0200
@@ -95,7 +95,7 @@
   // redefined virtual functions:
   virtual Boolean isFramedSource() const;
 
-protected:
+private:
   afterGettingFunc* fAfterGettingFunc;
   void* fAfterGettingClientData;
   onCloseFunc* fOnCloseFunc;
--- ./liveMedia/include/MediaSession.hh	2006-10-04 14:52:53.000000000 +0200
+++ ./liveMedia/include/MediaSession.hh.orig	2006-10-03 15:21:32.000000000 +0200
@@ -67,7 +67,7 @@
 private: // redefined virtual functions
   virtual Boolean isMediaSession() const;
 
-protected:
+private:
   MediaSession(UsageEnvironment& env);
       // called only by createNew();
   virtual ~MediaSession();
@@ -87,7 +87,7 @@
   static unsigned guessRTPTimestampFrequency(char const* mediumName,
 					     char const* codecName);
 
-protected:
+private:
   friend class MediaSubsessionIterator;
   char* fCNAME; // used for RTCP
 
@@ -222,7 +222,7 @@
   unsigned fRealRuleNumber;
 #endif
 
-protected:
+private:
   friend class MediaSession;
   friend class MediaSubsessionIterator;
   MediaSubsession(MediaSession& parent);
@@ -240,7 +240,7 @@
   Boolean parseSDPAttribute_x_dimensions(char const* sdpLine);
   Boolean parseSDPAttribute_framerate(char const* sdpLine);
 
-protected:
+private:
   // Linkage fields:
   MediaSession& fParent;
   MediaSubsession* fNext;
--- ./liveMedia/include/MediaSink.hh	2006-10-04 15:37:35.000000000 +0200
+++ ./liveMedia/include/MediaSink.hh.orig	2006-10-03 23:27:27.000000000 +0200
@@ -39,8 +39,6 @@
   // Test for specific types of sink:
   virtual Boolean isRTPSink() const;
 
-  FramedSource* source() const {return fSource;}
-
 protected:
   MediaSink(UsageEnvironment& env); // abstract base class
   virtual ~MediaSink();
--- ./liveMedia/include/MPEG4ESVideoRTPSink.hh	2006-10-04 14:48:09.000000000 +0200
+++ ./liveMedia/include/MPEG4ESVideoRTPSink.hh.orig	2006-10-03 15:21:07.000000000 +0200
@@ -55,9 +55,8 @@
 
   virtual char const* auxSDPLine();
 
-protected:
-  Boolean fVOPIsPresent;
 private:
+  Boolean fVOPIsPresent;
   char* fAuxSDPLine;
 };
 
--- ./liveMedia/include/MPEG4VideoStreamDiscreteFramer.hh	2006-10-04 16:40:52.000000000 +0200
+++ ./liveMedia/include/MPEG4VideoStreamDiscreteFramer.hh.orig	2006-10-04 14:16:37.000000000 +0200
@@ -33,11 +33,10 @@
   static MPEG4VideoStreamDiscreteFramer*
   createNew(UsageEnvironment& env, FramedSource* inputSource);
   
-protected:
+private:
   MPEG4VideoStreamDiscreteFramer(UsageEnvironment& env,
 				 FramedSource* inputSource);
       // called only by createNew()
-
   virtual ~MPEG4VideoStreamDiscreteFramer();
 
 private:
@@ -57,20 +56,15 @@
   Boolean getNextFrameBit(u_int8_t& result);
   Boolean getNextFrameBits(unsigned numBits, u_int32_t& result);
     // Which are used by:
-
-protected:
   void analyzeVOLHeader();
 
 private:
   unsigned fNumBitsSeenSoFar; // used by the getNextFrameBit*() routines
-
-protected:
   u_int32_t vop_time_increment_resolution;
   unsigned fNumVTIRBits;
   // # of bits needed to count to "vop_time_increment_resolution"
   struct timeval fLastNonBFramePresentationTime;
   unsigned fLastNonBFrameVop_time_increment;
-
 };
 
 #endif
--- ./liveMedia/include/RTCP.hh	2006-10-04 15:31:56.000000000 +0200
+++ ./liveMedia/include/RTCP.hh.orig	2006-10-03 17:08:47.000000000 +0200
@@ -110,52 +110,51 @@
   void addReport();
   void addSR();
   void addRR();
-  virtual void enqueueCommonReportPrefix(unsigned char packetType, u_int32_t SSRC,
+      void enqueueCommonReportPrefix(unsigned char packetType, u_int32_t SSRC,
 				     unsigned numExtraWords = 0);
-  virtual void enqueueCommonReportSuffix();
+      void enqueueCommonReportSuffix();
+        void enqueueReportBlock(RTPReceptionStats* receptionStats);
   void addSDES();
   void addBYE();
 
   void sendBuiltPacket();
 
+  static void onExpire(RTCPInstance* instance);
   void onExpire1();
 
   static void incomingReportHandler(RTCPInstance* instance, int /*mask*/);
   void incomingReportHandler1();
+  void onReceive(int typeOfPacket, int totPacketSize, u_int32_t ssrc);
 
   void unsetSpecificRRHandler(netAddressBits fromAddress, Port fromPort);
 
-protected:
-  static void onExpire(RTCPInstance* instance);
-  void onReceive(int typeOfPacket, int totPacketSize, u_int32_t ssrc);
-  void enqueueReportBlock(RTPReceptionStats* receptionStats);
-
 private:
+  unsigned char* fInBuf;
+  OutPacketBuffer* fOutBuf;
+  RTPInterface fRTCPInterface;
   unsigned fTotSessionBW;
+  RTPSink* fSink;
+  RTPSource const* fSource;
+  Boolean fIsSSMSource;
+
+  SDESItem fCNAME;
   RTCPMemberDatabase* fKnownMembers;
   unsigned fOutgoingReportCount; // used for SSRC member aging
+
   double fAveRTCPSize;
   int fIsInitial;
   double fPrevReportTime;
+  double fNextReportTime;
   int fPrevNumMembers;
+
   int fLastSentSize;
   int fLastReceivedSize;
   u_int32_t fLastReceivedSSRC;
-  int fTypeOfPacket;
-  AddressPortLookupTable* fSpecificRRHandlerTable;
-
-protected:
-  unsigned char* fInBuf;
-  OutPacketBuffer* fOutBuf;
-  RTPInterface fRTCPInterface;
-  RTPSink* fSink;
-  RTPSource const* fSource;
-  Boolean fIsSSMSource;
-  SDESItem fCNAME;
-  double fNextReportTime;
   int fTypeOfEvent;
+  int fTypeOfPacket;
   Boolean fHaveJustSentPacket;
   unsigned fLastPacketSentSize;
+
   TaskFunc* fByeHandlerTask;
   void* fByeHandlerClientData;
   Boolean fByeHandleActiveParticipantsOnly;
@@ -163,9 +162,10 @@
   void* fSRHandlerClientData;
   TaskFunc* fRRHandlerTask;
   void* fRRHandlerClientData;
+  AddressPortLookupTable* fSpecificRRHandlerTable;
 
 public: // because this stuff is used by an external "C" function
-  virtual void schedule(double nextTime);
+  void schedule(double nextTime);
   void reschedule(double nextTime);
   void sendReport();
   void sendBYE();
--- ./liveMedia/include/RTPSource.hh	2006-10-04 15:29:04.000000000 +0200
+++ ./liveMedia/include/RTPSource.hh.orig	2006-10-03 15:46:20.000000000 +0200
@@ -144,21 +144,19 @@
 
   RTPReceptionStats* lookup(u_int32_t SSRC) const;
 
-protected: // constructor and destructor, called only by RTPSource:
+private: // constructor and destructor, called only by RTPSource:
   friend class RTPSource;
   RTPReceptionStatsDB(RTPSource& rtpSource);
   virtual ~RTPReceptionStatsDB();
 
-protected:
+private:
   void add(u_int32_t SSRC, RTPReceptionStats* stats);
 
-protected:
+private:
   friend class Iterator;
   RTPSource& fOurRTPSource;
-  unsigned fNumActiveSourcesSinceLastReset;
-
-private:
   HashTable* fTable;
+  unsigned fNumActiveSourcesSinceLastReset;
   unsigned fTotNumPacketsReceived; // for all SSRCs
 };
 
@@ -197,7 +195,7 @@
     return fTotalInterPacketGaps;
   }
 
-protected:
+private:
   // called only by RTPReceptionStatsDB:
   friend class RTPReceptionStatsDB;
   RTPReceptionStats(RTPSource& rtpSource, u_int32_t SSRC,
@@ -205,7 +203,6 @@
   RTPReceptionStats(RTPSource& rtpSource, u_int32_t SSRC);
   virtual ~RTPReceptionStats();
 
-private:
   void noteIncomingPacket(u_int16_t seqNum, u_int32_t rtpTimestamp,
 			  unsigned timestampFrequency,
 			  Boolean useForJitterCalculation,
@@ -220,33 +217,23 @@
       // resets periodic stats (called each time they're used to
       // generate a reception report)
 
-protected:
+private:
   RTPSource& fOurRTPSource;
   u_int32_t fSSRC;
   unsigned fNumPacketsReceivedSinceLastReset;
   unsigned fTotNumPacketsReceived;
-
-private:
   u_int32_t fTotBytesReceived_hi, fTotBytesReceived_lo;
   Boolean fHaveSeenInitialSequenceNumber;
-
-protected:
   unsigned fBaseExtSeqNumReceived;
   unsigned fLastResetExtSeqNumReceived;
   unsigned fHighestExtSeqNumReceived;
-
-private:
   int fLastTransit; // used in the jitter calculation
   u_int32_t fPreviousPacketRTPTimestamp;
-
-protected:
   double fJitter;
   // The following are recorded whenever we receive a RTCP SR for this SSRC:
   unsigned fLastReceivedSR_NTPmsw; // NTP timestamp (from SR), most-signif
   unsigned fLastReceivedSR_NTPlsw; // NTP timestamp (from SR), least-signif
   struct timeval fLastReceivedSR_time;
-
-private:
   struct timeval fLastPacketReceptionTime;
   unsigned fMinInterPacketGapUS, fMaxInterPacketGapUS;
   struct timeval fTotalInterPacketGaps;


More information about the live-devel mailing list