This file is indexed.

/usr/include/liveMedia/MediaSink.hh is in liblivemedia-dev 2016.02.09-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
/**********
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.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
**********/
// "liveMedia"
// Copyright (c) 1996-2016 Live Networks, Inc.  All rights reserved.
// Media Sinks
// C++ header

#ifndef _MEDIA_SINK_HH
#define _MEDIA_SINK_HH

#ifndef _FRAMED_SOURCE_HH
#include "FramedSource.hh"
#endif

class MediaSink: public Medium {
public:
  static Boolean lookupByName(UsageEnvironment& env, char const* sinkName,
			      MediaSink*& resultSink);

  typedef void (afterPlayingFunc)(void* clientData);
  Boolean startPlaying(MediaSource& source,
		       afterPlayingFunc* afterFunc,
		       void* afterClientData);
  virtual void stopPlaying();

  // Test for specific types of sink:
  virtual Boolean isRTPSink() const;

  FramedSource* source() const {return fSource;}

protected:
  MediaSink(UsageEnvironment& env); // abstract base class
  virtual ~MediaSink();

  virtual Boolean sourceIsCompatibleWithUs(MediaSource& source);
      // called by startPlaying()
  virtual Boolean continuePlaying() = 0;
      // called by startPlaying()

  static void onSourceClosure(void* clientData); // can be used in "getNextFrame()" calls
  void onSourceClosure();
      // should be called (on ourselves) by continuePlaying() when it
      // discovers that the source we're playing from has closed.

  FramedSource* fSource;

private:
  // redefined virtual functions:
  virtual Boolean isSink() const;

private:
  // The following fields are used when we're being played:
  afterPlayingFunc* fAfterFunc;
  void* fAfterClientData;
};

// A data structure that a sink may use for an output packet:
class OutPacketBuffer {
public:
  OutPacketBuffer(unsigned preferredPacketSize, unsigned maxPacketSize,
		  unsigned maxBufferSize = 0);
      // if "maxBufferSize" is >0, use it - instead of "maxSize" to compute the buffer size
  ~OutPacketBuffer();

  static unsigned maxSize;
  static void increaseMaxSizeTo(unsigned newMaxSize) { if (newMaxSize > OutPacketBuffer::maxSize) OutPacketBuffer::maxSize = newMaxSize; }

  unsigned char* curPtr() const {return &fBuf[fPacketStart + fCurOffset];}
  unsigned totalBytesAvailable() const {
    return fLimit - (fPacketStart + fCurOffset);
  }
  unsigned totalBufferSize() const { return fLimit; }
  unsigned char* packet() const {return &fBuf[fPacketStart];}
  unsigned curPacketSize() const {return fCurOffset;}

  void increment(unsigned numBytes) {fCurOffset += numBytes;}

  void enqueue(unsigned char const* from, unsigned numBytes);
  void enqueueWord(u_int32_t word);
  void insert(unsigned char const* from, unsigned numBytes, unsigned toPosition);
  void insertWord(u_int32_t word, unsigned toPosition);
  void extract(unsigned char* to, unsigned numBytes, unsigned fromPosition);
  u_int32_t extractWord(unsigned fromPosition);

  void skipBytes(unsigned numBytes);

  Boolean isPreferredSize() const {return fCurOffset >= fPreferred;}
  Boolean wouldOverflow(unsigned numBytes) const {
    return (fCurOffset+numBytes) > fMax;
  }
  unsigned numOverflowBytes(unsigned numBytes) const {
    return (fCurOffset+numBytes) - fMax;
  }
  Boolean isTooBigForAPacket(unsigned numBytes) const {
    return numBytes > fMax;
  }

  void setOverflowData(unsigned overflowDataOffset,
		       unsigned overflowDataSize,
		       struct timeval const& presentationTime,
		       unsigned durationInMicroseconds);
  unsigned overflowDataSize() const {return fOverflowDataSize;}
  struct timeval overflowPresentationTime() const {return fOverflowPresentationTime;}
  unsigned overflowDurationInMicroseconds() const {return fOverflowDurationInMicroseconds;}
  Boolean haveOverflowData() const {return fOverflowDataSize > 0;}
  void useOverflowData();

  void adjustPacketStart(unsigned numBytes);
  void resetPacketStart();
  void resetOffset() { fCurOffset = 0; }
  void resetOverflowData() { fOverflowDataOffset = fOverflowDataSize = 0; }

private:
  unsigned fPacketStart, fCurOffset, fPreferred, fMax, fLimit;
  unsigned char* fBuf;

  unsigned fOverflowDataOffset, fOverflowDataSize;
  struct timeval fOverflowPresentationTime;
  unsigned fOverflowDurationInMicroseconds;
};

#endif