Search is not available for this dataset
repo
stringlengths 2
152
⌀ | file
stringlengths 15
239
| code
stringlengths 0
58.4M
| file_length
int64 0
58.4M
| avg_line_length
float64 0
1.81M
| max_line_length
int64 0
12.7M
| extension_type
stringclasses 364
values |
---|---|---|---|---|---|---|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/helpers/Block.h
|
/*
* Block.h
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#ifndef __BLOCK_H__
#define __BLOCK_H__
#include "config.h"
namespace dash
{
namespace helpers
{
struct block_t
{
uint8_t *data;
size_t len;
float millisec;
size_t offset;
};
static inline block_t* AllocBlock (size_t len)
{
block_t *block = (block_t *)malloc(sizeof(block_t));
block->data = new uint8_t[len];
block->len = len;
block->millisec = 0;
block->offset = 0;
return block;
}
static inline void DeleteBlock (block_t *block)
{
if(block)
{
delete [] block->data;
free(block);
block = NULL;
}
}
static inline block_t* DuplicateBlock (block_t *block)
{
block_t *ret = AllocBlock(block->len);
ret->offset = block->offset;
memcpy(ret->data, block->data, ret->len);
return block;
}
}
}
#endif
| 1,525 | 24.433333 | 79 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/helpers/BlockStream.cpp
|
/*
* BlockStream.cpp
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#include "BlockStream.h"
#include <limits>
using namespace dash::helpers;
BlockStream::BlockStream () :
length (0)
{
}
BlockStream::~BlockStream ()
{
this->Clear();
}
void BlockStream::PopAndDeleteFront ()
{
if(this->blockqueue.empty())
return;
this->length -= this->blockqueue.front()->len;
DeleteBlock(this->blockqueue.front());
this->blockqueue.pop_front();
}
void BlockStream::PushBack (block_t *block)
{
this->length += block->len;
this->blockqueue.push_back(block);
}
void BlockStream::PushFront (block_t *block)
{
this->length += block->len;
this->blockqueue.push_front(block);
}
const block_t* BlockStream::GetBytes (uint32_t len)
{
/* Performance Intensive */
if(this->length < len)
return NULL;
block_t *block = AllocBlock(len);
this->BlockQueueGetBytes(block->data, block->len);
this->length -= len;
return block;
}
size_t BlockStream::GetBytes (uint8_t *data, size_t len)
{
/* Performance Intensive */
if(len > this->length)
len = (size_t) this->length;
this->BlockQueueGetBytes(data, len);
this->length -= len;
return len;
}
size_t BlockStream::PeekBytes (uint8_t *data, size_t len)
{
/* Performance Intensive */
if(len > this->length)
len = (size_t) this->length;
this->BlockQueuePeekBytes(data, len, 0);
return len;
}
size_t BlockStream::PeekBytes (uint8_t *data, size_t len, size_t offset)
{
/* Performance Intensive */
if(len > this->length)
len = (size_t) this->length;
if (offset + len > this->length)
len = (size_t) (this->length - offset);
this->BlockQueuePeekBytes(data, len, offset);
return len;
}
uint64_t BlockStream::Length () const
{
return this->length;
}
const block_t* BlockStream::GetFront ()
{
if(this->blockqueue.empty())
return NULL;
const block_t* ret = this->blockqueue.front();
this->length -= ret->len;
this->blockqueue.pop_front();
return ret;
}
const block_t* BlockStream::Front () const
{
if(this->blockqueue.empty())
return NULL;
return this->blockqueue.front();
}
bool BlockStream::BlockQueueGetBytes (uint8_t *data, uint32_t len)
{
uint32_t pos = 0;
block_t *block = NULL;
while(pos < len)
{
block = this->blockqueue.front();
if((len - pos) < (block->len))
{
memcpy(data + pos, block->data, len - pos);
this->blockqueue.pop_front();
block_t* newfront = AllocBlock(block->len - (len - pos));
memcpy(newfront->data, block->data + (len - pos), newfront->len);
DeleteBlock(block);
this->blockqueue.push_front(newfront);
return true;
}
else
{
memcpy(data + pos, block->data, block->len);
pos += block->len;
DeleteBlock(block);
this->blockqueue.pop_front();
}
}
return false;
}
bool BlockStream::BlockQueuePeekBytes (uint8_t *data, uint32_t len, size_t offset)
{
uint32_t pos = 0;
int cnt = 0;
const block_t *block = NULL;
while(pos < len)
{
block = this->blockqueue.at(cnt);
if((offset + len - pos) < (block->len))
{
memcpy(data + pos, block->data + offset, len - pos - offset);
return true;
}
else
{
memcpy(data + pos, block->data + offset, block->len - offset);
pos += block->len;
}
cnt++;
}
return false;
}
uint8_t BlockStream::ByteAt (uint64_t position) const
{
if(position > this->length)
return -1;
uint64_t pos = 0;
for(size_t i = 0; i < this->blockqueue.size(); i++)
{
const block_t *block = this->blockqueue.at(i);
if(pos + block->len > position)
return block->data[position - pos];
else
pos += block->len;
}
return -1;
}
const block_t* BlockStream::ToBlock ()
{
if(this->length > std::numeric_limits<size_t>::max())
return NULL;
return BlockStream::GetBytes((size_t)this->length);
}
void BlockStream::Clear ()
{
while(!this->blockqueue.empty())
{
DeleteBlock(this->blockqueue.front());
this->blockqueue.pop_front();
}
this->length = 0;
}
void BlockStream::EraseFront (uint64_t len)
{
if(len > this->length)
len = this->length;
uint64_t actLen = 0;
while(actLen < len)
{
if(this->blockqueue.size() == 0)
return;
block_t *front = this->blockqueue.front();
if((actLen + front->len) <= len)
{
this->length -= front->len;
actLen += front->len;
DeleteBlock(front);
this->blockqueue.pop_front();
}
else
{
uint32_t diff = (uint32_t) (len - actLen);
this->length -= diff;
actLen += diff;
block_t* newfront = AllocBlock(front->len - diff);
memcpy(newfront->data, front->data + diff, newfront->len);
DeleteBlock(front);
this->blockqueue.pop_front();
this->blockqueue.push_front(newfront);
}
}
}
BlockStream* BlockStream::GetBlocks (uint64_t len)
{
if(len > this->length)
return NULL;
BlockStream *blocks = new BlockStream();
uint64_t actLen = 0;
while(actLen < len)
{
block_t *front = this->blockqueue.front();
if((actLen + front->len) <= len)
{
this->length -= front->len;
actLen += front->len;
blocks->PushBack(front);
this->blockqueue.pop_front();
}
else
{
uint32_t diff = (uint32_t) (len - actLen);
this->length -= diff;
actLen += diff;
block_t *block = AllocBlock(diff);
block_t* newfront = AllocBlock(front->len - diff);
memcpy(block->data, front->data, diff);
blocks->PushBack(block);
memcpy(newfront->data, front->data+ diff, newfront->len);
DeleteBlock(front);
this->blockqueue.pop_front();
this->blockqueue.push_front(newfront);
}
}
return blocks;
}
| 7,146 | 23.644828 | 96 |
cpp
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/helpers/Path.cpp
|
/*
* Path.cpp
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#include "Path.h"
using namespace dash::helpers;
std::string Path::CombinePaths (const std::string &path1, const std::string &path2)
{
if(path1 == "")
return path2;
if(path2 == "")
return path1;
char path1Last = path1.at(path1.size() - 1);
char path2First = path2.at(0);
if(path1Last == '/' && path2First == '/')
return path1 + path2.substr(1, path2.size());
if(path1Last != '/' && path2First != '/')
return path1 + "/" + path2;
return path1 + path2;
}
std::string Path::GetDirectoryPath (const std::string &path)
{
int pos = path.find_last_of('/');
return path.substr(0, pos);
}
std::vector<std::string> Path::Split (const std::string &s, char delim)
{
std::stringstream ss(s);
std::string item;
std::vector<std::string> ret;
while(std::getline(ss, item, delim))
ret.push_back(item);
return ret;
}
bool Path::GetHostPortAndPath (const std::string &url, std::string &host, size_t &port, std::string& path)
{
std::string hostPort = "";
size_t found = 0;
size_t pathBegin = 0;
if (url.substr(0,7) == "http://" || url.substr(0,8) == "https://")
{
found = url.find("//");
pathBegin = url.find('/', found+2);
path = url.substr(pathBegin, std::string::npos);
hostPort = url.substr(found+2, pathBegin - (found+2));
found = hostPort.find(':');
if (found != std::string::npos)
{
port = strtoul(hostPort.substr(found+1, std::string::npos).c_str(), NULL, 10);
}
host = hostPort.substr(0, found);
return (host.size() > 0) && (path.size() > 0);
}
return false;
}
bool Path::GetStartAndEndBytes (const std::string &byteRange, size_t &startByte, size_t &endByte)
{
size_t found = 0;
found = byteRange.find('-');
if (found != std::string::npos && found < byteRange.size()-1 )
{
startByte = strtoul(byteRange.substr(0, found).c_str(), NULL, 10);
endByte = strtoul(byteRange.substr(found+1, std::string::npos).c_str(), NULL, 10);
return (startByte <= endByte);
}
return false;
}
| 2,711 | 29.818182 | 132 |
cpp
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/helpers/Path.h
|
/*
* Path.h
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#ifndef PATH_H_
#define PATH_H_
#include "config.h"
namespace dash
{
namespace helpers
{
class Path
{
public:
static std::string CombinePaths (const std::string &path1, const std::string &path2);
static std::string GetDirectoryPath (const std::string &path);
static std::vector<std::string> Split (const std::string &s, char delim);
static bool GetHostPortAndPath (const std::string &url, std::string &host, size_t &port, std::string& path);
static bool GetStartAndEndBytes (const std::string &byteRange, size_t &startByte, size_t &endByte);
};
}
}
#endif /* PATH_H_ */
| 1,216 | 35.878788 | 145 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/helpers/SyncedBlockStream.cpp
|
/*
* SyncedBlockStream.cpp
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#include "SyncedBlockStream.h"
using namespace dash::helpers;
SyncedBlockStream::SyncedBlockStream () :
eos (false)
{
InitializeConditionVariable (&this->full);
InitializeCriticalSection (&this->monitorMutex);
}
SyncedBlockStream::~SyncedBlockStream ()
{
DeleteConditionVariable(&this->full);
DeleteCriticalSection(&this->monitorMutex);
}
void SyncedBlockStream::PopAndDeleteFront ()
{
EnterCriticalSection(&this->monitorMutex);
BlockStream::PopAndDeleteFront();
LeaveCriticalSection(&this->monitorMutex);
}
void SyncedBlockStream::PushBack (block_t *block)
{
EnterCriticalSection(&this->monitorMutex);
BlockStream::PushBack(block);
WakeAllConditionVariable(&this->full);
LeaveCriticalSection(&this->monitorMutex);
}
void SyncedBlockStream::PushFront (block_t *block)
{
EnterCriticalSection(&this->monitorMutex);
BlockStream::PushFront(block);
WakeAllConditionVariable(&this->full);
LeaveCriticalSection(&this->monitorMutex);
}
const block_t* SyncedBlockStream::GetBytes (uint32_t len)
{
EnterCriticalSection(&this->monitorMutex);
while(this->length == 0 && !this->eos)
SleepConditionVariableCS(&this->full, &this->monitorMutex, INFINITE);
if(this->length == 0)
{
LeaveCriticalSection(&this->monitorMutex);
return NULL;
}
const block_t* block = BlockStream::GetBytes(len);
LeaveCriticalSection(&this->monitorMutex);
return block;
}
size_t SyncedBlockStream::GetBytes (uint8_t *data, size_t len)
{
EnterCriticalSection(&this->monitorMutex);
while(this->length == 0 && !this->eos)
SleepConditionVariableCS(&this->full, &this->monitorMutex, INFINITE);
if(this->length == 0)
{
LeaveCriticalSection(&this->monitorMutex);
return 0;
}
size_t ret = BlockStream::GetBytes(data, len);
LeaveCriticalSection(&this->monitorMutex);
return ret;
}
size_t SyncedBlockStream::PeekBytes (uint8_t *data, size_t len)
{
EnterCriticalSection(&this->monitorMutex);
while(this->length == 0 && !this->eos)
SleepConditionVariableCS(&this->full, &this->monitorMutex, INFINITE);
if(this->length == 0)
{
LeaveCriticalSection(&this->monitorMutex);
return 0;
}
size_t ret = BlockStream::PeekBytes(data, len);
LeaveCriticalSection(&this->monitorMutex);
return ret;
}
size_t SyncedBlockStream::PeekBytes (uint8_t *data, size_t len, size_t offset)
{
EnterCriticalSection(&this->monitorMutex);
while((this->length == 0 || offset >= this->length) && !this->eos)
SleepConditionVariableCS(&this->full, &this->monitorMutex, INFINITE);
if(this->length == 0 || offset >= this->length)
{
LeaveCriticalSection(&this->monitorMutex);
return 0;
}
size_t ret = BlockStream::PeekBytes(data, len, offset);
LeaveCriticalSection(&this->monitorMutex);
return ret;
}
uint64_t SyncedBlockStream::Length () const
{
EnterCriticalSection(&this->monitorMutex);
uint64_t len = BlockStream::Length();
LeaveCriticalSection(&this->monitorMutex);
return len;
}
const block_t* SyncedBlockStream::GetFront ()
{
EnterCriticalSection(&this->monitorMutex);
while(this->length == 0 && !this->eos)
SleepConditionVariableCS(&this->full, &this->monitorMutex, INFINITE);
if(this->length == 0)
{
LeaveCriticalSection(&this->monitorMutex);
return NULL;
}
const block_t* block = BlockStream::GetFront();
LeaveCriticalSection(&this->monitorMutex);
return block;
}
const block_t* SyncedBlockStream::Front () const
{
EnterCriticalSection(&this->monitorMutex);
while(this->length == 0 && !this->eos)
SleepConditionVariableCS(&this->full, &this->monitorMutex, INFINITE);
if(this->length == 0)
{
LeaveCriticalSection(&this->monitorMutex);
return NULL;
}
const block_t* block = BlockStream::Front();
LeaveCriticalSection(&this->monitorMutex);
return block;
}
uint8_t SyncedBlockStream::ByteAt (uint64_t position) const
{
EnterCriticalSection(&this->monitorMutex);
while(this->length < position && !this->eos)
SleepConditionVariableCS(&this->full, &this->monitorMutex, INFINITE);
if(this->length < position)
{
LeaveCriticalSection(&this->monitorMutex);
return 0;
}
uint8_t ret = BlockStream::ByteAt(position);
LeaveCriticalSection(&this->monitorMutex);
return ret;
}
const block_t* SyncedBlockStream::ToBlock ()
{
EnterCriticalSection(&this->monitorMutex);
while(this->length == 0 && !this->eos)
SleepConditionVariableCS(&this->full, &this->monitorMutex, INFINITE);
if(this->length == 0)
{
LeaveCriticalSection(&this->monitorMutex);
return NULL;
}
const block_t* block = BlockStream::ToBlock();
LeaveCriticalSection(&this->monitorMutex);
return block;
}
void SyncedBlockStream::Clear ()
{
EnterCriticalSection(&this->monitorMutex);
BlockStream::Clear();
LeaveCriticalSection(&this->monitorMutex);
}
void SyncedBlockStream::EraseFront (uint64_t len)
{
EnterCriticalSection(&this->monitorMutex);
BlockStream::EraseFront(len);
LeaveCriticalSection(&this->monitorMutex);
}
BlockStream* SyncedBlockStream::GetBlocks (uint64_t len)
{
EnterCriticalSection(&this->monitorMutex);
while(this->length == 0 && !this->eos)
SleepConditionVariableCS(&this->full, &this->monitorMutex, INFINITE);
if(this->length == 0)
{
LeaveCriticalSection(&this->monitorMutex);
return NULL;
}
BlockStream *stream = BlockStream::GetBlocks(len);
LeaveCriticalSection(&this->monitorMutex);
return stream;
}
void SyncedBlockStream::SetEOS (bool value)
{
EnterCriticalSection(&this->monitorMutex);
this->eos = value;
WakeAllConditionVariable(&this->full);
LeaveCriticalSection(&this->monitorMutex);
}
| 6,710 | 25.737052 | 96 |
cpp
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/helpers/String.h
|
/*
* String.h
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#ifndef STRING_H_
#define STRING_H_
#include "config.h"
namespace dash
{
namespace helpers
{
class String
{
public:
static void Split (const std::string &s, char delim, std::vector<std::string>& vector);
static void Split (const std::string &s, char delim, std::vector<uint32_t>& vector);
static bool ToBool (const std::string &s);
};
}
}
#endif /* STRING_H_ */
| 892 | 27.806452 | 105 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/metrics/TCPConnection.h
|
/*
* TCPConnection.h
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#ifndef TCPCONNECTION_H_
#define TCPCONNECTION_H_
#include "ITCPConnection.h"
namespace dash
{
namespace metrics
{
class TCPConnection : public ITCPConnection
{
public:
TCPConnection ();
virtual ~TCPConnection ();
uint32_t TCPId () const;
const std::string& DestinationAddress () const;
const std::string& ConnectionOpenedTime () const;
const std::string& ConnectionClosedTime () const;
uint64_t ConnectionTime () const;
void SetTCPId (uint32_t tcpId);
void SetDestinationAddress (const std::string& destAddress);
void SetConnectionOpenedTime (std::string tOpen);
void SetConnectionClosedTime (std::string tClose);
void SetConnectionTime (uint64_t tConnect);
private:
uint32_t tcpId;
std::string dest;
std::string tOpen;
std::string tClose;
uint64_t tConnect;
};
}
}
#endif /* TCPCONNECTION_H_ */
| 1,725 | 33.52 | 81 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/metrics/ThroughputMeasurement.cpp
|
/*
* ThroughputMeasurement.cpp
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#include "ThroughputMeasurement.h"
using namespace dash::metrics;
ThroughputMeasurement::ThroughputMeasurement ()
{
}
ThroughputMeasurement::~ThroughputMeasurement()
{
}
const std::string& ThroughputMeasurement::StartOfPeriod () const
{
return this->startOfPeriod;
}
void ThroughputMeasurement::SetStartOfPeriod (std::string start)
{
this->startOfPeriod = start;
}
uint64_t ThroughputMeasurement::DurationOfPeriod () const
{
return this->durationOfPeriod;
}
void ThroughputMeasurement::SetDurationOfPeriod (uint64_t duration)
{
this->durationOfPeriod = duration;
}
const std::vector<uint32_t>& ThroughputMeasurement::ReceivedBytesPerTrace () const
{
return this->receivedBytesPerTrace;
}
void ThroughputMeasurement::AddReceivedBytes (uint32_t numberOfBytes)
{
this->receivedBytesPerTrace.push_back(numberOfBytes);
}
| 1,444 | 29.744681 | 103 |
cpp
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/metrics/HTTPTransaction.cpp
|
/*
* HTTPTransaction.cpp
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#include "HTTPTransaction.h"
using namespace dash::metrics;
HTTPTransaction::HTTPTransaction () :
tcpId (0),
type (dash::metrics::Other),
responseCode (0),
interval (0),
url (""),
actualUrl (""),
range (""),
tRequest (""),
tResponse (""),
httpHeader ("")
{
}
HTTPTransaction::~HTTPTransaction()
{
for (size_t i = 0; i < trace.size(); i++)
delete trace.at(i);
}
uint32_t HTTPTransaction::TCPId () const
{
return this->tcpId;
}
void HTTPTransaction::SetTCPId (uint32_t tcpId)
{
this->tcpId = tcpId;
}
HTTPTransactionType HTTPTransaction::Type () const
{
return this->type;
}
void HTTPTransaction::SetType (HTTPTransactionType type)
{
this->type = type;
}
const std::string& HTTPTransaction::OriginalUrl () const
{
return this->url;
}
void HTTPTransaction::SetOriginalUrl (const std::string& origUrl)
{
this->url = origUrl;
}
const std::string& HTTPTransaction::ActualUrl () const
{
return this->actualUrl;
}
void HTTPTransaction::SetActualUrl (const std::string& actUrl)
{
this->actualUrl = actUrl;
}
const std::string& HTTPTransaction::Range () const
{
return this->range;
}
void HTTPTransaction::SetRange (const std::string& range)
{
this->range = range;
}
const std::string& HTTPTransaction::RequestSentTime () const
{
return this->tRequest;
}
void HTTPTransaction::SetRequestSentTime (std::string tRequest)
{
this->tRequest = tRequest;
}
const std::string& HTTPTransaction::ResponseReceivedTime () const
{
return this->tResponse;
}
void HTTPTransaction::SetResponseReceivedTime (std::string tResponse)
{
this->tResponse = tResponse;
}
uint16_t HTTPTransaction::ResponseCode () const
{
return this->responseCode;
}
void HTTPTransaction::SetResponseCode (uint16_t respCode)
{
this->responseCode = respCode;
}
uint64_t HTTPTransaction::Interval () const
{
return this->interval;
}
void HTTPTransaction::SetInterval (uint64_t interval)
{
this->interval = interval;
}
const std::vector<IThroughputMeasurement *>& HTTPTransaction::ThroughputTrace () const
{
return (std::vector<IThroughputMeasurement *> &) this->trace;
}
void HTTPTransaction::AddThroughputMeasurement (ThroughputMeasurement *throuputEntry)
{
this->trace.push_back(throuputEntry);
}
const std::string& HTTPTransaction::HTTPHeader () const
{
return this->httpHeader;
}
void HTTPTransaction::AddHTTPHeaderLine (std::string headerLine)
{
this->httpHeader.append(headerLine);
}
| 4,221 | 33.325203 | 130 |
cpp
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/metrics/HTTPTransaction.h
|
/*
* HTTPTransaction.h
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#ifndef HTTPTRANSACTION_H_
#define HTTPTRANSACTION_H_
#include "IHTTPTransaction.h"
#include "ThroughputMeasurement.h"
namespace dash
{
namespace metrics
{
class HTTPTransaction : public IHTTPTransaction
{
public:
HTTPTransaction ();
virtual ~HTTPTransaction ();
uint32_t TCPId () const;
HTTPTransactionType Type () const;
const std::string& OriginalUrl () const;
const std::string& ActualUrl () const;
const std::string& Range () const;
const std::string& RequestSentTime () const;
const std::string& ResponseReceivedTime () const;
uint16_t ResponseCode () const;
uint64_t Interval () const;
const std::vector<IThroughputMeasurement *>& ThroughputTrace () const;
const std::string& HTTPHeader () const;
void SetTCPId (uint32_t tcpId);
void SetType (HTTPTransactionType type);
void SetOriginalUrl (const std::string& origUrl);
void SetActualUrl (const std::string& actUrl);
void SetRange (const std::string& range);
void SetRequestSentTime (std::string tRequest);
void SetResponseReceivedTime (std::string tResponse);
void SetResponseCode (uint16_t respCode);
void SetInterval (uint64_t interval);
void AddThroughputMeasurement (ThroughputMeasurement *throuputEntry);
void AddHTTPHeaderLine (std::string headerLine);
private:
uint32_t tcpId;
HTTPTransactionType type;
std::string url;
std::string actualUrl;
std::string range;
std::string tRequest;
std::string tResponse;
uint16_t responseCode;
uint64_t interval;
std::vector<ThroughputMeasurement *> trace;
std::string httpHeader;
};
}
}
#endif /* HTTPTRANSACTION_H_ */
| 3,510 | 49.884058 | 97 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/metrics/ThroughputMeasurement.h
|
/*
* ThroughputMeasurement.h
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#ifndef THROUGHPUTMEASUREMENT_H_
#define THROUGHPUTMEASUREMENT_H_
#include "IThroughputMeasurement.h"
namespace dash
{
namespace metrics
{
class ThroughputMeasurement : public IThroughputMeasurement
{
public:
ThroughputMeasurement ();
virtual ~ThroughputMeasurement ();
const std::string& StartOfPeriod () const;
uint64_t DurationOfPeriod () const;
const std::vector<uint32_t>& ReceivedBytesPerTrace () const;
void SetStartOfPeriod (std::string startOfPeriod);
void SetDurationOfPeriod (uint64_t duration);
void AddReceivedBytes (uint32_t numberOfBytes);
private:
std::string startOfPeriod;
uint64_t durationOfPeriod;
std::vector<uint32_t> receivedBytesPerTrace;
};
}
}
#endif /* THROUGHPUTMEASUREMENT_H_ */
| 1,515 | 33.454545 | 81 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/metrics/TCPConnection.cpp
|
/*
* TCPConnection.cpp
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#include "TCPConnection.h"
using namespace dash::metrics;
TCPConnection::TCPConnection ()
{
}
TCPConnection::~TCPConnection()
{
}
uint32_t TCPConnection::TCPId () const
{
return this->tcpId;
}
void TCPConnection::SetTCPId (uint32_t tcpId)
{
this->tcpId = tcpId;
}
const std::string& TCPConnection::DestinationAddress () const
{
return this->dest;
}
void TCPConnection::SetDestinationAddress (const std::string& destAddress)
{
this->dest = destAddress;
}
const std::string& TCPConnection::ConnectionOpenedTime () const
{
return this->tOpen;
}
void TCPConnection::SetConnectionOpenedTime (std::string tOpen)
{
this->tOpen = tOpen;
}
const std::string& TCPConnection::ConnectionClosedTime () const
{
return this->tClose;
}
void TCPConnection::SetConnectionClosedTime (std::string tClose)
{
this->tClose = tClose;
}
uint64_t TCPConnection::ConnectionTime () const
{
return this->tConnect;
}
void TCPConnection::SetConnectionTime (uint64_t tConnect)
{
this->tConnect = tConnect;
}
| 1,629 | 24.873016 | 92 |
cpp
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/network/AbstractChunk.h
|
/*
* AbstractChunk.h
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#ifndef ABSTRACTCHUNK_H_
#define ABSTRACTCHUNK_H_
#include "config.h"
#include "IDownloadableChunk.h"
#include "DownloadStateManager.h"
#include "../helpers/SyncedBlockStream.h"
#include "../portable/Networking.h"
#include <curl/curl.h>
#include "../metrics/HTTPTransaction.h"
#include "../metrics/TCPConnection.h"
#include "../metrics/ThroughputMeasurement.h"
#include "../helpers/Time.h"
#include <chrono>
namespace dash
{
namespace network
{
class AbstractChunk : public virtual IDownloadableChunk
{
public:
AbstractChunk ();
virtual ~AbstractChunk ();
/*
* Pure virtual IChunk Interface
*/
virtual std::string& AbsoluteURI () = 0;
virtual std::string& Host () = 0;
virtual size_t Port () = 0;
virtual std::string& Path () = 0;
virtual std::string& Range () = 0;
virtual size_t StartByte () = 0;
virtual size_t EndByte () = 0;
virtual bool HasByteRange () = 0;
virtual dash::metrics::HTTPTransactionType GetType() = 0;
/*
* IDownloadableChunk Interface
*/
virtual bool StartDownload (IConnection *connection);
virtual bool StartDownload ();
virtual void AbortDownload ();
virtual int Read (uint8_t *data, size_t len);
virtual int Peek (uint8_t *data, size_t len);
virtual int Peek (uint8_t *data, size_t len, size_t offset);
virtual void AttachDownloadObserver (IDownloadObserver *observer);
virtual void DetachDownloadObserver (IDownloadObserver *observer);
/*
* Observer Notification
*/
void NotifyDownloadRateChanged (double bitrate);
void NotifyDownloadTimeChanged (double dnltime);
/*
* IDASHMetrics
*/
const std::vector<dash::metrics::ITCPConnection *>& GetTCPConnectionList () const;
const std::vector<dash::metrics::IHTTPTransaction *>& GetHTTPTransactionList () const;
private:
std::vector<IDownloadObserver *> observers;
THREAD_HANDLE dlThread;
IConnection *connection;
helpers::SyncedBlockStream blockStream;
CURL *curl;
CURLM *curlm;
CURLcode response;
uint64_t bytesDownloaded;
DownloadStateManager stateManager;
std::vector<dash::metrics::TCPConnection *> tcpConnections;
std::vector<dash::metrics::HTTPTransaction *> httpTransactions;
static uint32_t BLOCKSIZE;
static void* DownloadExternalConnection (void *chunk);
static void* DownloadInternalConnection (void *chunk);
static size_t CurlResponseCallback (void *contents, size_t size, size_t nmemb, void *userp);
static size_t CurlHeaderCallback (void *headerData, size_t size, size_t nmemb, void *userdata);
static size_t CurlDebugCallback (CURL *url, curl_infotype infoType, char * data, size_t length, void *userdata);
void HandleHeaderOutCallback ();
void HandleHeaderInCallback (std::string data);
};
}
}
#endif /* ABSTRACTCHUNK_H_ */
| 4,486 | 43.425743 | 140 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/network/DownloadStateManager.h
|
/*
* DownloadStateManager.h
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#ifndef DOWNLOADSTATEMANAGER_H_
#define DOWNLOADSTATEMANAGER_H_
#include "config.h"
#include "IDownloadObserver.h"
#include "../portable/MultiThreading.h"
namespace dash
{
namespace network
{
class DownloadStateManager
{
public:
DownloadStateManager ();
virtual ~DownloadStateManager ();
DownloadState State () const;
void WaitState (DownloadState state) const;
void CheckAndWait (DownloadState check, DownloadState wait) const;
void CheckAndSet (DownloadState check, DownloadState set);
void State (DownloadState state);
void Attach (IDownloadObserver *observer);
void Detach (IDownloadObserver *observer);
private:
DownloadState state;
mutable CRITICAL_SECTION stateLock;
mutable CONDITION_VARIABLE stateChanged;
std::vector<IDownloadObserver *> observers;
void Notify ();
};
}
}
#endif /* DOWNLOADSTATEMANAGER_H_ */
| 1,705 | 32.45098 | 96 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/network/AbstractChunk.cpp
|
/*
* AbstractChunk.cpp
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#include "AbstractChunk.h"
using namespace dash::network;
using namespace dash::helpers;
using namespace dash::metrics;
uint32_t AbstractChunk::BLOCKSIZE = 32768;
AbstractChunk::AbstractChunk () :
connection (NULL),
dlThread (NULL),
bytesDownloaded (0)
{
}
AbstractChunk::~AbstractChunk ()
{
this->AbortDownload();
DestroyThreadPortable(this->dlThread);
}
void AbstractChunk::AbortDownload ()
{
this->stateManager.CheckAndSet(IN_PROGRESS, REQUEST_ABORT);
this->stateManager.CheckAndWait(REQUEST_ABORT, ABORTED);
}
bool AbstractChunk::StartDownload ()
{
if(this->stateManager.State() != NOT_STARTED)
return false;
curl_global_init(CURL_GLOBAL_ALL);
this->curlm = curl_multi_init();
this->curl = curl_easy_init();
curl_easy_setopt(this->curl, CURLOPT_URL, this->AbsoluteURI().c_str());
curl_easy_setopt(this->curl, CURLOPT_WRITEFUNCTION, CurlResponseCallback);
curl_easy_setopt(this->curl, CURLOPT_WRITEDATA, (void *)this);
/* Debug Callback */
curl_easy_setopt(this->curl, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(this->curl, CURLOPT_DEBUGFUNCTION, CurlDebugCallback);
curl_easy_setopt(this->curl, CURLOPT_DEBUGDATA, (void *)this);
curl_easy_setopt(this->curl, CURLOPT_FAILONERROR, true);
if(this->HasByteRange())
curl_easy_setopt(this->curl, CURLOPT_RANGE, this->Range().c_str());
curl_multi_add_handle(this->curlm, this->curl);
this->dlThread = CreateThreadPortable (DownloadInternalConnection, this);
if(this->dlThread == NULL)
return false;
this->stateManager.State(IN_PROGRESS);
return true;
}
bool AbstractChunk::StartDownload (IConnection *connection)
{
if(this->stateManager.State() != NOT_STARTED)
return false;
this->connection = connection;
this->dlThread = CreateThreadPortable (DownloadExternalConnection, this);
if(this->dlThread == NULL)
return false;
this->stateManager.State(IN_PROGRESS);
return true;
}
int AbstractChunk::Read (uint8_t *data, size_t len)
{
return this->blockStream.GetBytes(data, len);
}
int AbstractChunk::Peek (uint8_t *data, size_t len)
{
return this->blockStream.PeekBytes(data, len);
}
int AbstractChunk::Peek (uint8_t *data, size_t len, size_t offset)
{
return this->blockStream.PeekBytes(data, len, offset);
}
void AbstractChunk::AttachDownloadObserver (IDownloadObserver *observer)
{
this->observers.push_back(observer);
this->stateManager.Attach(observer);
}
void AbstractChunk::DetachDownloadObserver (IDownloadObserver *observer)
{
uint32_t pos = -1;
for(size_t i = 0; i < this->observers.size(); i++)
if(this->observers.at(i) == observer)
pos = i;
if(pos != -1)
this->observers.erase(this->observers.begin() + pos);
this->stateManager.Detach(observer);
}
void* AbstractChunk::DownloadExternalConnection (void *abstractchunk)
{
AbstractChunk *chunk = (AbstractChunk *) abstractchunk;
block_t *block = AllocBlock(chunk->BLOCKSIZE);
int ret = 0;
int count = 0;
do
{
//TODO Start Read Here
//L("AbstractChunk::DownloadExternalConnection:\tCOUNT %i\n", count);
ret = chunk->connection->Read(block->data, block->len, chunk);
if(ret > 0)
{
block_t *streamblock = AllocBlock(ret);
memcpy(streamblock->data, block->data, ret);
chunk->blockStream.PushBack(streamblock);
chunk->bytesDownloaded += ret;
// chunk->NotifyDownloadRateChanged();
}
if(chunk->stateManager.State() == REQUEST_ABORT)
ret = 0;
count += ret;
}while(ret);
double speed = chunk->connection->GetAverageDownloadingSpeed();
double time = chunk->connection->GetDownloadingTime();
chunk->NotifyDownloadRateChanged(speed);
chunk->NotifyDownloadTimeChanged(time);
DeleteBlock(block);
if(chunk->stateManager.State() == REQUEST_ABORT)
chunk->stateManager.State(ABORTED);
else
chunk->stateManager.State(COMPLETED);
chunk->blockStream.SetEOS(true);
return NULL;
}
void* AbstractChunk::DownloadInternalConnection (void *abstractchunk)
{
AbstractChunk *chunk = (AbstractChunk *) abstractchunk;
//chunk->response = curl_easy_perform(chunk->curl);
int u =1;
while(chunk->stateManager.State() != REQUEST_ABORT && u)
{
curl_multi_perform(chunk->curlm, &u);
}
double speed;
double size;
double time;
curl_easy_getinfo(chunk->curl, CURLINFO_SPEED_DOWNLOAD,&speed);
curl_easy_getinfo(chunk->curl, CURLINFO_SIZE_DOWNLOAD, &size);
curl_easy_getinfo(chunk->curl, CURLINFO_TOTAL_TIME, &time);
//Speed is in Bps ==> *8 for the bps
speed = 8*speed;
//size = 8*size; //Uncomment for the size in bits.
chunk->NotifyDownloadRateChanged(speed);
chunk->NotifyDownloadTimeChanged(time);
curl_easy_cleanup(chunk->curl);
curl_global_cleanup();
curl_multi_cleanup(chunk->curlm);
if(chunk->stateManager.State() == REQUEST_ABORT)
{
chunk->stateManager.State(ABORTED);
}
else
{
chunk->stateManager.State(COMPLETED);
}
chunk->blockStream.SetEOS(true);
return NULL;
}
void AbstractChunk::NotifyDownloadRateChanged (double bitrate)
{
for(size_t i = 0; i < this->observers.size(); i++)
this->observers.at(i)->OnDownloadRateChanged((uint64_t)bitrate);
}
void AbstractChunk::NotifyDownloadTimeChanged (double dnltime)
{
for(size_t i = 0; i < this->observers.size(); i++)
this->observers.at(i)->OnDownloadTimeChanged(dnltime);
}
size_t AbstractChunk::CurlResponseCallback (void *contents, size_t size, size_t nmemb, void *userp)
{
size_t realsize = size * nmemb;
AbstractChunk *chunk = (AbstractChunk *)userp;
if(chunk->stateManager.State() == REQUEST_ABORT)
return 0;
block_t *block = AllocBlock(realsize);
memcpy(block->data, contents, realsize);
chunk->blockStream.PushBack(block);
chunk->bytesDownloaded += realsize;
// chunk->NotifyDownloadRateChanged();
return realsize;
}
size_t AbstractChunk::CurlDebugCallback (CURL *url, curl_infotype infoType, char * data, size_t length, void *userdata)
{
AbstractChunk *chunk = (AbstractChunk *)userdata;
switch (infoType) {
case CURLINFO_TEXT:
break;
case CURLINFO_HEADER_OUT:
chunk->HandleHeaderOutCallback();
break;
case CURLINFO_HEADER_IN:
chunk->HandleHeaderInCallback(std::string(data));
break;
case CURLINFO_DATA_IN:
break;
default:
return 0;
}
return 0;
}
void AbstractChunk::HandleHeaderOutCallback ()
{
HTTPTransaction *httpTransaction = new HTTPTransaction();
httpTransaction->SetOriginalUrl(this->AbsoluteURI());
httpTransaction->SetRange(this->Range());
httpTransaction->SetType(this->GetType());
httpTransaction->SetRequestSentTime(Time::GetCurrentUTCTimeStr());
this->httpTransactions.push_back(httpTransaction);
}
void AbstractChunk::HandleHeaderInCallback (std::string data)
{
HTTPTransaction *httpTransaction = this->httpTransactions.at(this->httpTransactions.size()-1);
if (data.substr(0,4) == "HTTP")
{
httpTransaction->SetResponseReceivedTime(Time::GetCurrentUTCTimeStr());
httpTransaction->SetResponseCode(strtoul(data.substr(9,3).c_str(), NULL, 10));
}
httpTransaction->AddHTTPHeaderLine(data);
}
const std::vector<ITCPConnection *>& AbstractChunk::GetTCPConnectionList () const
{
return (std::vector<ITCPConnection *> &) this->tcpConnections;
}
const std::vector<IHTTPTransaction *>& AbstractChunk::GetHTTPTransactionList () const
{
return (std::vector<IHTTPTransaction *> &) this->httpTransactions;
}
| 8,585 | 30.335766 | 131 |
cpp
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/network/DownloadStateManager.cpp
|
/*
* DownloadStateManager.cpp
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#include "DownloadStateManager.h"
using namespace dash::network;
DownloadStateManager::DownloadStateManager () :
state (NOT_STARTED)
{
InitializeConditionVariable (&this->stateChanged);
InitializeCriticalSection (&this->stateLock);
}
DownloadStateManager::~DownloadStateManager ()
{
DeleteConditionVariable (&this->stateChanged);
DeleteCriticalSection (&this->stateLock);
}
DownloadState DownloadStateManager::State () const
{
EnterCriticalSection(&this->stateLock);
DownloadState ret = this->state;
LeaveCriticalSection(&this->stateLock);
return ret;
}
void DownloadStateManager::State (DownloadState state)
{
EnterCriticalSection(&this->stateLock);
this->state = state;
this->Notify();
WakeAllConditionVariable(&this->stateChanged);
LeaveCriticalSection(&this->stateLock);
}
void DownloadStateManager::WaitState (DownloadState state) const
{
EnterCriticalSection(&this->stateLock);
while(this->state != state)
SleepConditionVariableCS(&this->stateChanged, &this->stateLock, INFINITE);
LeaveCriticalSection(&this->stateLock);
}
void DownloadStateManager::CheckAndWait (DownloadState check, DownloadState wait) const
{
EnterCriticalSection(&this->stateLock);
if(this->state == check)
while(this->state != wait)
SleepConditionVariableCS(&this->stateChanged, &this->stateLock, INFINITE);
LeaveCriticalSection(&this->stateLock);
}
void DownloadStateManager::Attach (IDownloadObserver *observer)
{
EnterCriticalSection(&this->stateLock);
this->observers.push_back(observer);
LeaveCriticalSection(&this->stateLock);
}
void DownloadStateManager::Detach (IDownloadObserver *observer)
{
EnterCriticalSection(&this->stateLock);
uint32_t pos = -1;
for(size_t i = 0; i < this->observers.size(); i++)
if(this->observers.at(i) == observer)
pos = i;
if(pos != -1)
this->observers.erase(this->observers.begin() + pos);
LeaveCriticalSection(&this->stateLock);
}
void DownloadStateManager::Notify ()
{
for(size_t i = 0; i < this->observers.size(); i++)
this->observers.at(i)->OnDownloadStateChanged(this->state);
}
void DownloadStateManager::CheckAndSet (DownloadState check, DownloadState set)
{
EnterCriticalSection(&this->stateLock);
if(this->state == check)
this->state = set;
LeaveCriticalSection(&this->stateLock);
}
| 3,028 | 28.990099 | 99 |
cpp
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/portable/Networking.h
|
#ifndef PORTABLE_NETWORKING_H_
#define PORTABLE_NETWORKING_H_
#if defined _WIN32 || defined _WIN64
#include <WinSock2.h>
#include <WS2tcpip.h>
#else
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/ip.h> /* superset of previous */
#include <netdb.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#define closesocket(socket) close(socket)
#define WSAStartup(wVersionRequested, lpWSAData) 0
#define WSACleanup() {}
typedef unsigned char WSADATA;
#endif
#endif // PORTABLE_NETWORKING_H_
| 525 | 17.785714 | 51 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/portable/MultiThreading.cpp
|
#include "MultiThreading.h"
THREAD_HANDLE CreateThreadPortable (void *(*start_routine) (void *), void *arg)
{
#if defined _WIN32 || defined _WIN64
return CreateThread (0, 0, (LPTHREAD_START_ROUTINE)start_routine, (LPVOID)arg, 0, 0);
#else
THREAD_HANDLE th = (THREAD_HANDLE)malloc(sizeof(pthread_t));
if (!th)
{
std::cerr << "Error allocating thread." << std::endl;
return NULL;
}
if(int err = pthread_create(th, NULL, start_routine, arg))
{
std::cerr << strerror(err) << std::endl;
return NULL;
}
return th;
#endif
}
void DestroyThreadPortable (THREAD_HANDLE th)
{
#if !defined _WIN32 && !defined _WIN64
if(th)
free(th);
#endif
}
/****************************************************************************
* Condition variables for Windows XP and older windows sytems
*****************************************************************************/
#if defined WINXPOROLDER
void InitCondition (condition_variable_t *cv)
{
InitializeCriticalSection(&cv->waitersCountLock);
cv->waitersCount = 0;
cv->waitGenerationCount = 0;
cv->releaseCount = 0;
cv->waitingEvent = CreateEvent (NULL, // no security
TRUE, // manual-reset
FALSE, // non-signaled initially
NULL); // unnamed
}
void WaitCondition (condition_variable_t *cv, CRITICAL_SECTION *externalMutex)
{
EnterCriticalSection(&cv->waitersCountLock);
cv->waitersCount++;
int currentGenerationCount = cv->waitGenerationCount;
LeaveCriticalSection(&cv->waitersCountLock);
LeaveCriticalSection(externalMutex);
bool isWaitDone = false;
while(!isWaitDone)
{
WaitForSingleObject (cv->waitingEvent, INFINITE);
EnterCriticalSection (&cv->waitersCountLock);
isWaitDone = (cv->releaseCount > 0 && cv->waitGenerationCount != currentGenerationCount);
LeaveCriticalSection (&cv->waitersCountLock);
}
EnterCriticalSection(externalMutex);
EnterCriticalSection(&cv->waitersCountLock);
cv->waitersCount--;
cv->releaseCount--;
bool isLastWaiter = (cv->releaseCount == 0);
LeaveCriticalSection(&cv->waitersCountLock);
if(isLastWaiter)
ResetEvent(cv->waitingEvent);
}
void SignalCondition (condition_variable_t *cv)
{
EnterCriticalSection(&cv->waitersCountLock);
if(cv->waitersCount > cv->releaseCount)
{
SetEvent(cv->waitingEvent);
cv->releaseCount++;
cv->waitGenerationCount++;
}
LeaveCriticalSection(&cv->waitersCountLock);
}
void BroadcastCondition (condition_variable_t *cv)
{
EnterCriticalSection(&cv->waitersCountLock);
if(cv->waitersCount > 0)
{
SetEvent(cv->waitingEvent);
cv->releaseCount = cv->waitersCount;
cv->waitGenerationCount++;
}
LeaveCriticalSection(&cv->waitersCountLock);
}
#endif
| 3,309 | 29.648148 | 101 |
cpp
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/portable/MultiThreading.h
|
#ifndef PORTABLE_MULTITHREADING_H_
#define PORTABLE_MULTITHREADING_H_
#if defined _WIN32 || defined _WIN64
#define _WINSOCKAPI_
#include <Windows.h>
#define DeleteConditionVariable(cond_p) {}
typedef HANDLE THREAD_HANDLE;
#if defined WINXPOROLDER
/****************************************************************************
* Variables
*****************************************************************************/
struct condition_variable_t
{
int waitersCount; // Count of the number of waiters.
CRITICAL_SECTION waitersCountLock; // Serialize access to <waitersCount>.
int releaseCount; // Number of threads to release via a <BroadcastCondition> or a <SignalCondition>.
int waitGenerationCount; // Keeps track of the current "generation" so that we don't allow one thread to steal all the "releases" from the broadcast.
HANDLE waitingEvent; // A manual-reset event that's used to block and release waiting threads.
};
/****************************************************************************
* Prototypes
*****************************************************************************/
void InitCondition (condition_variable_t *cv);
void WaitCondition (condition_variable_t *cv, CRITICAL_SECTION *externalMutex);
void SignalCondition (condition_variable_t *cv);
void BroadcastCondition (condition_variable_t *cv);
/****************************************************************************
* Defines
*****************************************************************************/
#define CONDITION_VARIABLE condition_variable_t
#define InitializeConditionVariable(cond_p) InitCondition(cond_p)
#define SleepConditionVariableCS(cond_p, mutex_p, infinite) WaitCondition(cond_p, mutex_p) // INFINITE should be handled mor properly
#define WakeConditionVariable(cond_p) SignalCondition(cond_p)
#define WakeAllConditionVariable(cond_p) BroadcastCondition(cond_p)
#endif
#else
#include <string.h>
#include <pthread.h>
#include <errno.h>
#include <stdlib.h>
#include <iostream>
#define CRITICAL_SECTION pthread_mutex_t
#define CONDITION_VARIABLE pthread_cond_t
#define InitializeCriticalSection(mutex_p) pthread_mutex_init(mutex_p, NULL)
#define DeleteCriticalSection(mutex_p) pthread_mutex_destroy(mutex_p)
#define EnterCriticalSection(mutex_p) pthread_mutex_lock(mutex_p)
#define LeaveCriticalSection(mutex_p) pthread_mutex_unlock(mutex_p)
#define InitializeConditionVariable(cond_p) pthread_cond_init(cond_p, NULL)
#define DeleteConditionVariable(cond_p) pthread_cond_destroy(cond_p)
#define SleepConditionVariableCS(cond_p, mutex_p, infinite) pthread_cond_wait(cond_p, mutex_p) // INFINITE should be handled mor properly
#define WakeConditionVariable(cond_p) pthread_cond_signal(cond_p)
#define WakeAllConditionVariable(cond_p) pthread_cond_broadcast(cond_p)
typedef pthread_t* THREAD_HANDLE;
#endif
THREAD_HANDLE CreateThreadPortable (void *(*start_routine) (void *), void *arg);
void DestroyThreadPortable (THREAD_HANDLE th);
#endif // PORTABLE_MULTITHREADING_H_
| 3,663 | 51.342857 | 180 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/mpd/Range.h
|
/*
* Range.h
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#ifndef RANGE_H_
#define RANGE_H_
#include "config.h"
#include "IRange.h"
namespace dash
{
namespace mpd
{
class Range : public IRange
{
public:
Range ();
virtual ~Range ();
const std::string& GetStarttime () const;
const std::string& GetDuration () const;
void SetStarttime (const std::string& start);
void SetDuration (const std::string& duration);
private:
std::string starttime;
std::string duration;
};
}
}
#endif /* RANGE_H_ */
| 1,090 | 24.372093 | 79 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/mpd/BaseUrl.cpp
|
/*
* BaseUrl.cpp
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#include "BaseUrl.h"
using namespace dash::mpd;
BaseUrl::BaseUrl () :
url(""),
serviceLocation(""),
byteRange("")
{
}
BaseUrl::~BaseUrl ()
{
}
const std::string& BaseUrl::GetUrl () const
{
return this->url;
}
void BaseUrl::SetUrl (const std::string& url)
{
this->url = url;
}
const std::string& BaseUrl::GetServiceLocation () const
{
return this->serviceLocation;
}
void BaseUrl::SetServiceLocation (const std::string& serviceLocation)
{
this->serviceLocation = serviceLocation;
}
const std::string& BaseUrl::GetByteRange () const
{
return this->byteRange;
}
void BaseUrl::SetByteRange (const std::string& byteRange)
{
this->byteRange = byteRange;
}
ISegment* BaseUrl::ToMediaSegment (const std::vector<IBaseUrl *>& baseurls) const
{
Segment *seg = new Segment();
if(seg->Init(baseurls, this->url, this->byteRange, dash::metrics::MediaSegment))
return seg;
delete(seg);
return NULL;
}
| 1,511 | 23.786885 | 95 |
cpp
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/mpd/BaseUrl.h
|
/*
* BaseUrl.h
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#ifndef BASEURL_H_
#define BASEURL_H_
#include "config.h"
#include "Segment.h"
#include "IBaseUrl.h"
#include "AbstractMPDElement.h"
namespace dash
{
namespace mpd
{
class BaseUrl : public IBaseUrl, public AbstractMPDElement
{
public:
BaseUrl ();
virtual ~BaseUrl();
const std::string& GetUrl () const;
const std::string& GetServiceLocation () const;
const std::string& GetByteRange () const;
void SetUrl (const std::string& url);
void SetServiceLocation (const std::string& serviceLocation);
void SetByteRange (const std::string& byteRange);
virtual ISegment* ToMediaSegment (const std::vector<IBaseUrl *>& baseurls) const;
private:
std::string url;
std::string serviceLocation;
std::string byteRange;
};
}
}
#endif /* BASEURL_H_ */
| 1,487 | 28.76 | 97 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/mpd/Period.cpp
|
/*
* Period.cpp
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#include "Period.h"
using namespace dash::mpd;
Period::Period () :
segmentBase(NULL),
segmentList(NULL),
segmentTemplate(NULL),
xlinkActuate("onRequest"),
xlinkHref(""),
id(""),
start(""),
duration(""),
isBitstreamSwitching(false)
{
}
Period::~Period ()
{
for(size_t i = 0; i < this->baseURLs.size(); i++)
delete(this->baseURLs.at(i));
for(size_t i = 0; i < this->adaptationSets.size(); i++)
delete(this->adaptationSets.at(i));
for(size_t i = 0; i < this->subsets.size(); i++)
delete(this->subsets.at(i));
delete(segmentBase);
delete(segmentList);
delete(segmentTemplate);
}
const std::vector<IBaseUrl *>& Period::GetBaseURLs () const
{
return (std::vector<IBaseUrl *> &) this->baseURLs;
}
void Period::AddBaseURL (BaseUrl *baseUrl)
{
this->baseURLs.push_back(baseUrl);
}
ISegmentBase* Period::GetSegmentBase () const
{
return this->segmentBase;
}
void Period::SetSegmentBase (SegmentBase *segmentBase)
{
this->segmentBase = segmentBase;
}
ISegmentList* Period::GetSegmentList () const
{
return this->segmentList;
}
void Period::SetSegmentList (SegmentList *segmentList)
{
this->segmentList = segmentList;
}
ISegmentTemplate* Period::GetSegmentTemplate () const
{
return this->segmentTemplate;
}
void Period::SetSegmentTemplate (SegmentTemplate *segmentTemplate)
{
this->segmentTemplate = segmentTemplate;
}
const std::vector<IAdaptationSet*>& Period::GetAdaptationSets () const
{
return (std::vector<IAdaptationSet*> &) this->adaptationSets;
}
void Period::AddAdaptationSet (AdaptationSet *adaptationSet)
{
if(adaptationSet != NULL)
this->adaptationSets.push_back(adaptationSet);
}
const std::vector<ISubset *>& Period::GetSubsets () const
{
return (std::vector<ISubset *> &) this->subsets;
}
void Period::AddSubset (Subset *subset)
{
this->subsets.push_back(subset);
}
const std::string& Period::GetXlinkHref () const
{
return this->xlinkHref;
}
void Period::SetXlinkHref (const std::string& xlinkHref)
{
this->xlinkHref = xlinkHref;
}
const std::string& Period::GetXlinkActuate () const
{
return this->xlinkActuate;
}
void Period::SetXlinkActuate (const std::string& xlinkActuate)
{
this->xlinkActuate = xlinkActuate;
}
const std::string& Period::GetId () const
{
return this->id;
}
void Period::SetId (const std::string& id)
{
this->id = id;
}
const std::string& Period::GetStart () const
{
return this->start;
}
void Period::SetStart (const std::string& start)
{
this->start = start;
}
const std::string& Period::GetDuration () const
{
return this->duration;
}
void Period::SetDuration (const std::string& duration)
{
this->duration = duration;
}
bool Period::GetBitstreamSwitching () const
{
return this->isBitstreamSwitching;
}
void Period::SetBitstreamSwitching (bool value)
{
this->isBitstreamSwitching = value;
}
| 4,195 | 29.405797 | 103 |
cpp
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/mpd/MPD.cpp
|
/*
* MPD.cpp
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#include "MPD.h"
using namespace dash::mpd;
using namespace dash::metrics;
MPD::MPD () :
id(""),
type("static"),
availabilityStarttime(""),
availabilityEndtime(""),
mediaPresentationDuration(""),
minimumUpdatePeriod(""),
minBufferTime(""),
timeShiftBufferDepth(""),
suggestedPresentationDelay(""),
maxSegmentDuration(""),
maxSubsegmentDuration("")
{
}
MPD::~MPD ()
{
for(size_t i = 0; i < this->programInformations.size(); i++)
delete(this->programInformations.at(i));
for(size_t i = 0; i < this->metrics.size(); i++)
delete(this->metrics.at(i));
for(size_t i = 0; i < this->periods.size(); i++)
delete(this->periods.at(i));
for(size_t i = 0; i < this->baseUrls.size(); i++)
delete(this->baseUrls.at(i));
}
const std::vector<IProgramInformation *>& MPD::GetProgramInformations () const
{
return (std::vector<IProgramInformation *> &) this->programInformations;
}
void MPD::AddProgramInformation (ProgramInformation *programInformation)
{
this->programInformations.push_back(programInformation);
}
const std::vector<IBaseUrl*>& MPD::GetBaseUrls () const
{
return (std::vector<IBaseUrl*> &) this->baseUrls;
}
void MPD::AddBaseUrl (BaseUrl *url)
{
this->baseUrls.push_back(url);
}
const std::vector<std::string>& MPD::GetLocations () const
{
return this->locations;
}
void MPD::AddLocation (const std::string& location)
{
this->locations.push_back(location);
}
const std::vector<IPeriod*>& MPD::GetPeriods () const
{
return (std::vector<IPeriod*> &) this->periods;
}
void MPD::AddPeriod (Period *period)
{
this->periods.push_back(period);
}
const std::vector<IMetrics *>& MPD::GetMetrics () const
{
return (std::vector<IMetrics *> &) this->metrics;
}
void MPD::AddMetrics (Metrics *metrics)
{
this->metrics.push_back(metrics);
}
const std::string& MPD::GetId () const
{
return this->id;
}
void MPD::SetId (const std::string& id)
{
this->id = id;
}
const std::vector<std::string>& MPD::GetProfiles () const
{
return this->profiles;
}
void MPD::SetProfiles (const std::string& profiles)
{
dash::helpers::String::Split(profiles, ',', this->profiles);
}
const std::string& MPD::GetType () const
{
return this->type;
}
void MPD::SetType (const std::string& type)
{
this->type = type;
}
const std::string& MPD::GetAvailabilityStarttime () const
{
return this->availabilityStarttime;
}
void MPD::SetAvailabilityStarttime (const std::string& availabilityStarttime)
{
this->availabilityStarttime = availabilityStarttime;
}
const std::string& MPD::GetAvailabilityEndtime () const
{
return this->availabilityEndtime;
}
void MPD::SetAvailabilityEndtime (const std::string& availabilityEndtime)
{
this->availabilityEndtime = availabilityEndtime;
}
const std::string& MPD::GetMediaPresentationDuration () const
{
return this->mediaPresentationDuration;
}
void MPD::SetMediaPresentationDuration (const std::string& mediaPresentationDuration)
{
this->mediaPresentationDuration = mediaPresentationDuration;
}
const std::string& MPD::GetMinimumUpdatePeriod () const
{
return this->minimumUpdatePeriod;
}
void MPD::SetMinimumUpdatePeriod (const std::string& minimumUpdatePeriod)
{
this->minimumUpdatePeriod = minimumUpdatePeriod;
}
const std::string& MPD::GetMinBufferTime () const
{
return this->minBufferTime;
}
void MPD::SetMinBufferTime (const std::string& minBufferTime)
{
this->minBufferTime = minBufferTime;
}
const std::string& MPD::GetTimeShiftBufferDepth () const
{
return this->timeShiftBufferDepth;
}
void MPD::SetTimeShiftBufferDepth (const std::string& timeShiftBufferDepth)
{
this->timeShiftBufferDepth = timeShiftBufferDepth;
}
const std::string& MPD::GetSuggestedPresentationDelay () const
{
return this->suggestedPresentationDelay;
}
void MPD::SetSuggestedPresentationDelay (const std::string& suggestedPresentationDelay)
{
this->suggestedPresentationDelay = suggestedPresentationDelay;
}
const std::string& MPD::GetMaxSegmentDuration () const
{
return this->maxSegmentDuration;
}
void MPD::SetMaxSegmentDuration (const std::string& maxSegmentDuration)
{
this->maxSegmentDuration = maxSegmentDuration;
}
const std::string& MPD::GetMaxSubsegmentDuration () const
{
return this->maxSubsegmentDuration;
}
void MPD::SetMaxSubsegmentDuration (const std::string& maxSubsegmentDuration)
{
this->maxSubsegmentDuration = maxSubsegmentDuration;
}
IBaseUrl* MPD::GetMPDPathBaseUrl () const
{
return this->mpdPathBaseUrl;
}
void MPD::SetMPDPathBaseUrl (BaseUrl *mpdPath)
{
this->mpdPathBaseUrl = mpdPath;
}
uint32_t MPD::GetFetchTime () const
{
return this->fetchTime;
}
void MPD::SetFetchTime (uint32_t fetchTimeInSec)
{
this->fetchTime = fetchTimeInSec;
}
const std::vector<ITCPConnection *>& MPD::GetTCPConnectionList () const
{
return (std::vector<ITCPConnection *> &) this->tcpConnections;
}
void MPD::AddTCPConnection (TCPConnection *tcpConn)
{
this->tcpConnections.push_back(tcpConn);
}
const std::vector<IHTTPTransaction *>& MPD::GetHTTPTransactionList () const
{
return (std::vector<IHTTPTransaction *> &) this->httpTransactions;
}
void MPD::AddHTTPTransaction (HTTPTransaction *httpTransAct)
{
this->httpTransactions.push_back(httpTransAct);
}
| 7,698 | 35.14554 | 131 |
cpp
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/mpd/Metrics.cpp
|
/*
* Metrics.cpp
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#include "../mpd/Metrics.h"
using namespace dash::mpd;
Metrics::Metrics () :
metrics("")
{
}
Metrics::~Metrics ()
{
for(size_t i = 0; i < this->reportings.size(); i++)
delete(this->reportings.at(i));
for(size_t i = 0; i < this->ranges.size(); i++)
delete(this->ranges.at(i));
}
const std::vector<IDescriptor *>& Metrics::GetReportings () const
{
return (std::vector<IDescriptor *> &)this->reportings;
}
void Metrics::AddReporting (Descriptor *reporting)
{
this->reportings.push_back(reporting);
}
const std::vector<IRange *>& Metrics::GetRanges () const
{
return (std::vector<IRange *> &)this->ranges;
}
void Metrics::AddRange (Range *range)
{
this->ranges.push_back(range);
}
const std::string& Metrics::GetMetrics () const
{
return this->metrics;
}
void Metrics::SetMetrics (const std::string& metrics)
{
this->metrics = metrics;
}
| 1,476 | 27.403846 | 88 |
cpp
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/mpd/Range.cpp
|
/*
* Range.cpp
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#include "Range.h"
using namespace dash::mpd;
Range::Range () :
starttime(""),
duration("")
{
}
Range::~Range ()
{
}
const std::string& Range::GetStarttime () const
{
return this->starttime;
}
void Range::SetStarttime (const std::string& starttime)
{
this->starttime = starttime;
}
const std::string& Range::GetDuration () const
{
return this->duration;
}
void Range::SetDuration (const std::string& duration)
{
this->duration = duration;
}
| 945 | 22.073171 | 79 |
cpp
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/mpd/AdaptationSet.h
|
/*
* AdaptationSet.h
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#ifndef ADAPTATIONSET_H_
#define ADAPTATIONSET_H_
#include "config.h"
#include "IAdaptationSet.h"
#include "RepresentationBase.h"
#include "BaseUrl.h"
#include "SegmentBase.h"
#include "SegmentList.h"
#include "SegmentTemplate.h"
#include "ContentComponent.h"
#include "Representation.h"
namespace dash
{
namespace mpd
{
class AdaptationSet : public IAdaptationSet, public RepresentationBase
{
public:
AdaptationSet ();
virtual ~AdaptationSet ();
const std::vector<IDescriptor *>& GetAccessibility () const;
const std::vector<IDescriptor *>& GetRole () const;
const std::vector<IDescriptor *>& GetRating () const;
const std::vector<IDescriptor *>& GetViewpoint () const;
const std::vector<IContentComponent *>& GetContentComponent () const;
const std::vector<IBaseUrl *>& GetBaseURLs () const;
ISegmentBase* GetSegmentBase () const;
ISegmentList* GetSegmentList () const;
ISegmentTemplate* GetSegmentTemplate () const;
const std::vector<IRepresentation *>& GetRepresentation () const;
const std::string& GetXlinkHref () const;
const std::string& GetXlinkActuate () const;
uint32_t GetId () const;
uint32_t GetGroup () const;
const std::string& GetLang () const;
const std::string& GetContentType () const;
const std::string& GetPar () const;
uint32_t GetMinBandwidth () const;
uint32_t GetMaxBandwidth () const;
uint32_t GetMinWidth () const;
uint32_t GetMaxWidth () const;
uint32_t GetMinHeight () const;
uint32_t GetMaxHeight () const;
const std::string& GetMinFramerate () const;
const std::string& GetMaxFramerate () const;
bool SegmentAlignmentIsBoolValue () const;
bool HasSegmentAlignment () const;
uint32_t GetSegmentAligment () const;
bool SubsegmentAlignmentIsBoolValue () const;
bool HasSubsegmentAlignment () const;
uint32_t GetSubsegmentAlignment () const;
uint8_t GetSubsegmentStartsWithSAP () const;
bool GetBitstreamSwitching () const;
void AddAccessibity (Descriptor *accessibility);
void AddRole (Descriptor *role);
void AddRating (Descriptor *rating);
void AddViewpoint (Descriptor *viewpoint);
void AddContentComponent (ContentComponent *contentComponent);
void AddBaseURL (BaseUrl *baseURL);
void SetSegmentBase (SegmentBase *segmentBase);
void SetSegmentList (SegmentList *segmentList);
void SetSegmentTemplate (SegmentTemplate *segmentTemplate);
void AddRepresentation (Representation* representation);
void SetXlinkHref (const std::string& xlinkHref);
void SetXlinkActuate (const std::string& xlinkActuate);
void SetId (uint32_t id);
void SetGroup (uint32_t group);
void SetLang (const std::string& lang);
void SetContentType (const std::string& contentType);
void SetPar (const std::string& par);
void SetMinBandwidth (uint32_t minBandwidth);
void SetMaxBandwidth (uint32_t maxBandwidth);
void SetMinWidth (uint32_t minWidth);
void SetMaxWidth (uint32_t maxWidth);
void SetMinHeight (uint32_t minHeight);
void SetMaxHeight (uint32_t maxHeight);
void SetMinFramerate (const std::string& minFramerate);
void SetMaxFramerate (const std::string& maxFramerate);
void SetSegmentAlignment (const std::string& segmentAlignment);
void SetSubsegmentAlignment (const std::string& subsegmentAlignment);
void SetSubsegmentStartsWithSAP (uint8_t subsegmentStartsWithSAP);
void SetBitstreamSwitching (bool value);
private:
std::vector<Descriptor *> accessibility;
std::vector<Descriptor *> role;
std::vector<Descriptor *> rating;
std::vector<Descriptor *> viewpoint;
std::vector<ContentComponent *> contentComponent;
std::vector<BaseUrl *> baseURLs;
SegmentBase *segmentBase;
SegmentList *segmentList;
SegmentTemplate *segmentTemplate;
std::vector<Representation *> representation;
std::string xlinkHref;
std::string xlinkActuate;
uint32_t id;
uint32_t group;
std::string lang;
std::string contentType;
std::string par;
uint32_t minBandwidth;
uint32_t maxBandwidth;
uint32_t minWidth;
uint32_t maxWidth;
uint32_t minHeight;
uint32_t maxHeight;
std::string minFramerate;
std::string maxFramerate;
bool segmentAlignmentIsBool;
bool subsegmentAlignmentIsBool;
bool usesSegmentAlignment;
bool usesSubsegmentAlignment;
uint32_t segmentAlignment;
uint32_t subsegmentAlignment;
uint8_t subsegmentStartsWithSAP;
bool isBitstreamSwitching;
};
}
}
#endif /* ADAPTATIONSET_H_ */
| 8,671 | 61.388489 | 98 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/mpd/Period.h
|
/*
* Period.h
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#ifndef PERIOD_H_
#define PERIOD_H_
#include "config.h"
#include "IPeriod.h"
#include "BaseUrl.h"
#include "AdaptationSet.h"
#include "Subset.h"
#include "SegmentBase.h"
#include "SegmentList.h"
#include "SegmentTemplate.h"
#include "AbstractMPDElement.h"
namespace dash
{
namespace mpd
{
class Period : public IPeriod, public AbstractMPDElement
{
public:
Period ();
virtual ~Period ();
const std::vector<IBaseUrl *>& GetBaseURLs () const;
ISegmentBase* GetSegmentBase () const;
ISegmentList* GetSegmentList () const;
ISegmentTemplate* GetSegmentTemplate () const;
const std::vector<IAdaptationSet *>& GetAdaptationSets () const;
const std::vector<ISubset *>& GetSubsets () const;
const std::string& GetXlinkHref () const;
const std::string& GetXlinkActuate () const;
const std::string& GetId () const;
const std::string& GetStart () const;
const std::string& GetDuration () const;
bool GetBitstreamSwitching () const;
void AddBaseURL (BaseUrl *baseURL);
void SetSegmentBase (SegmentBase *segmentBase);
void SetSegmentList (SegmentList *segmentList);
void SetSegmentTemplate (SegmentTemplate *segmentTemplate);
void AddAdaptationSet (AdaptationSet *AdaptationSet);
void AddSubset (Subset *subset);
void SetXlinkHref (const std::string& xlinkHref);
void SetXlinkActuate (const std::string& xlinkActuate);
void SetId (const std::string& id);
void SetStart (const std::string& start);
void SetDuration (const std::string& duration);
void SetBitstreamSwitching (bool value);
private:
std::vector<BaseUrl *> baseURLs;
SegmentBase *segmentBase;
SegmentList *segmentList;
SegmentTemplate *segmentTemplate;
std::vector<AdaptationSet *> adaptationSets;
std::vector<Subset *> subsets;
std::string xlinkHref;
std::string xlinkActuate;
std::string id;
std::string start;
std::string duration;
bool isBitstreamSwitching;
};
}
}
#endif /* PERIOD_H_ */
| 3,729 | 45.625 | 90 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/mpd/Representation.cpp
|
/*
* Representation.cpp
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#include "Representation.h"
using namespace dash::mpd;
Representation::Representation () :
segmentBase (NULL),
segmentList (NULL),
segmentTemplate (NULL),
id(""),
bandwidth (0),
qualityRanking (0)
{
}
Representation::~Representation ()
{
for(size_t i = 0; i < this->baseURLs.size(); i++)
delete(this->baseURLs.at(i));
for(size_t i = 0; i < this->subRepresentations.size(); i++)
delete(this->subRepresentations.at(i));
delete(this->segmentTemplate);
delete(this->segmentBase);
delete(this->segmentList);
this->segmentSizes.clear();
}
const std::vector<IBaseUrl *>& Representation::GetBaseURLs () const
{
return (std::vector<IBaseUrl *> &) this->baseURLs;
}
void Representation::AddBaseURL (BaseUrl *baseUrl)
{
this->baseURLs.push_back(baseUrl);
}
const std::vector<ISubRepresentation *>& Representation::GetSubRepresentations () const
{
return (std::vector<ISubRepresentation *> &) this->subRepresentations;
}
void Representation::AddSubRepresentation (SubRepresentation *subRepresentation)
{
this->subRepresentations.push_back(subRepresentation);
}
ISegmentBase* Representation::GetSegmentBase () const
{
return this->segmentBase;
}
void Representation::SetSegmentBase (SegmentBase *segmentBase)
{
this->segmentBase = segmentBase;
}
ISegmentList* Representation::GetSegmentList () const
{
return this->segmentList;
}
void Representation::SetSegmentList (SegmentList *segmentList)
{
this->segmentList = segmentList;
}
ISegmentTemplate* Representation::GetSegmentTemplate () const
{
return this->segmentTemplate;
}
void Representation::SetSegmentTemplate (SegmentTemplate *segmentTemplate)
{
this->segmentTemplate = segmentTemplate;
}
int Representation::GetSpecificSegmentSize (std::string id) const
{
if(this->segmentSizes.count(id) == 1)
return this->segmentSizes.at(id);
else
return 0;
}
std::map<std::string, int> Representation::GetSegmentSizes () const
{
return this->segmentSizes;
}
bool Representation::IsExtended () const
{
return !(this->segmentSizes.empty());
}
void Representation::SetSegmentSize (SegmentSize *segmentSize)
{
this->segmentSizes.emplace(segmentSize->GetID(), segmentSize->GetSize()*0.5); //ATTENTION: convertion from Bits to Bits per Second (here 2 sec. segments are used)
}
const std::string& Representation::GetId () const
{
return this->id;
}
void Representation::SetId (const std::string &id)
{
this->id = id;
}
uint32_t Representation::GetBandwidth () const
{
return this->bandwidth;
}
void Representation::SetBandwidth (uint32_t bandwidth)
{
this->bandwidth = bandwidth;
}
uint32_t Representation::GetQualityRanking () const
{
return this->qualityRanking;
}
void Representation::SetQualityRanking (uint32_t qualityRanking)
{
this->qualityRanking = qualityRanking;
}
const std::vector<std::string>& Representation::GetDependencyId () const
{
return this->dependencyId;
}
void Representation::SetDependencyId (const std::string &dependencyId)
{
dash::helpers::String::Split(dependencyId, ' ', this->dependencyId);
}
const std::vector<std::string>& Representation::GetMediaStreamStructureId () const
{
return this->mediaStreamStructureId;
}
void Representation::SetMediaStreamStructureId (const std::string& mediaStreamStructureId)
{
dash::helpers::String::Split(mediaStreamStructureId, ' ', this->mediaStreamStructureId);
}
| 4,999 | 35.49635 | 168 |
cpp
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/mpd/SegmentBase.h
|
/*
* SegmentBase.h
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#ifndef SEGMENTBASE_H_
#define SEGMENTBASE_H_
#include "config.h"
#include "ISegmentBase.h"
#include "URLType.h"
#include "AbstractMPDElement.h"
namespace dash
{
namespace mpd
{
class SegmentBase : public virtual ISegmentBase, public AbstractMPDElement
{
public:
SegmentBase ();
virtual ~SegmentBase ();
const IURLType* GetInitialization () const;
const IURLType* GetRepresentationIndex () const;
uint32_t GetTimescale () const;
uint32_t GetPresentationTimeOffset () const;
const std::string& GetIndexRange () const;
bool HasIndexRangeExact () const;
void SetInitialization (URLType *initialization);
void SetRepresentationIndex (URLType *representationIndex);
void SetTimescale (uint32_t timescale);
void SetPresentationTimeOffset (uint32_t presentationTimeOffset);
void SetIndexRange (const std::string& indexRange);
void SetIndexRangeExact (bool indexRangeExact);
protected:
URLType *initialization;
URLType *representationIndex;
uint32_t timescale;
uint32_t presentationTimeOffset;
std::string indexRange;
bool indexRangeExact;
};
}
}
#endif /* SEGMENTBASE_H_ */
| 2,102 | 35.894737 | 86 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/mpd/Metrics.h
|
/*
* Metrics.h
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#ifndef METRICS_H_
#define METRICS_H_
#include "config.h"
#include <string>
#include <vector>
#include "IMetrics.h"
#include "Descriptor.h"
#include "Range.h"
#include "AbstractMPDElement.h"
namespace dash
{
namespace mpd
{
class Metrics : public IMetrics, public AbstractMPDElement
{
public:
Metrics ();
virtual ~Metrics ();
const std::vector<IDescriptor *>& GetReportings () const;
const std::vector<IRange *>& GetRanges () const;
const std::string& GetMetrics () const;
void AddReporting (Descriptor *reporting);
void AddRange (Range *range);
void SetMetrics (const std::string& metrics);
private:
std::vector<Descriptor *> reportings;
std::vector<Range *> ranges;
std::string metrics;
};
}
}
#endif /* METRICS_H_ */
| 1,482 | 27.519231 | 79 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/mpd/SegmentBase.cpp
|
/*
* SegmentBase.cpp
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#include "SegmentBase.h"
using namespace dash::mpd;
SegmentBase::SegmentBase () :
initialization(NULL),
representationIndex(NULL),
timescale(1),
presentationTimeOffset(0),
indexRange(""),
indexRangeExact(false)
{
}
SegmentBase::~SegmentBase ()
{
delete(this->initialization);
delete(this->representationIndex);
}
const IURLType* SegmentBase::GetInitialization () const
{
return this->initialization;
}
void SegmentBase::SetInitialization (URLType *initialization)
{
this->initialization = initialization;
}
const IURLType* SegmentBase::GetRepresentationIndex () const
{
return this->representationIndex;
}
void SegmentBase::SetRepresentationIndex (URLType *representationIndex)
{
this->representationIndex = representationIndex;
}
uint32_t SegmentBase::GetTimescale () const
{
return this->timescale;
}
void SegmentBase::SetTimescale (uint32_t timescale)
{
this->timescale = timescale;
}
uint32_t SegmentBase::GetPresentationTimeOffset () const
{
return this->presentationTimeOffset;
}
void SegmentBase::SetPresentationTimeOffset (uint32_t presentationTimeOffset)
{
this->presentationTimeOffset = presentationTimeOffset;
}
const std::string& SegmentBase::GetIndexRange () const
{
return this->indexRange;
}
void SegmentBase::SetIndexRange (const std::string& indexRange)
{
this->indexRange = indexRange;
}
bool SegmentBase::HasIndexRangeExact () const
{
return this->indexRangeExact;
}
void SegmentBase::SetIndexRangeExact (bool indexRangeExact)
{
this->indexRangeExact = indexRangeExact;
}
| 2,326 | 28.455696 | 93 |
cpp
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/mpd/SegmentList.h
|
/*
* SegmentList.h
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#ifndef SEGMENTLIST_H_
#define SEGMENTLIST_H_
#include "config.h"
#include "ISegmentList.h"
#include "MultipleSegmentBase.h"
#include "SegmentURL.h"
namespace dash
{
namespace mpd
{
class SegmentList : public ISegmentList, public MultipleSegmentBase
{
public:
SegmentList ();
virtual ~SegmentList ();
const std::vector<ISegmentURL *>& GetSegmentURLs () const;
const std::string& GetXlinkHref () const;
const std::string& GetXlinkActuate () const;
void AddSegmentURL (SegmentURL *segmetURL);
void SetXlinkHref (const std::string& xlinkHref);
void SetXlinkActuate (const std::string& xlinkActuate);
private:
std::vector<SegmentURL *> segmentURLs;
std::string xlinkHref;
std::string xlinkActuate;
};
}
}
#endif /* SEGMENTLIST_H_ */
| 1,476 | 29.770833 | 79 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/mpd/Subset.cpp
|
/*
* Subset.cpp
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#include "Subset.h"
using namespace dash::mpd;
Subset::Subset ()
{
}
Subset::~Subset ()
{
}
const std::vector<uint32_t>& Subset::Contains () const
{
return this->subset;
}
void Subset::SetSubset (const std::string& subset)
{
dash::helpers::String::Split(subset, ' ', this->subset);
}
| 760 | 23.548387 | 79 |
cpp
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/mpd/RepresentationBase.h
|
/*
* RepresentationBase.h
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#ifndef REPRESENTATIONBASE_H_
#define REPRESENTATIONBASE_H_
#include "config.h"
#include "IRepresentationBase.h"
#include "Descriptor.h"
#include "../helpers/String.h"
#include "AbstractMPDElement.h"
namespace dash
{
namespace mpd
{
class RepresentationBase : public virtual IRepresentationBase, public AbstractMPDElement
{
public:
RepresentationBase ();
virtual ~RepresentationBase ();
const std::vector<IDescriptor *>& GetFramePacking () const;
const std::vector<IDescriptor *>& GetAudioChannelConfiguration () const;
const std::vector<IDescriptor *>& GetContentProtection () const;
const std::vector<std::string>& GetProfiles () const;
uint32_t GetWidth () const;
uint32_t GetHeight () const;
std::string GetSar () const;
std::string GetFrameRate () const;
std::string GetAudioSamplingRate () const;
std::string GetMimeType () const;
const std::vector<std::string>& GetSegmentProfiles () const;
const std::vector<std::string>& GetCodecs () const;
double GetMaximumSAPPeriod () const;
uint8_t GetStartWithSAP () const;
double GetMaxPlayoutRate () const;
bool HasCodingDependency () const;
std::string GetScanType () const;
void AddFramePacking (Descriptor *framePacking);
void AddAudioChannelConfiguration (Descriptor *audioChannelConfiguration);
void AddContentProtection (Descriptor *contentProtection);
void SetProfiles (const std::string& profiles);
void SetWidth (uint32_t width);
void SetHeight (uint32_t height);
void SetSar (const std::string& sar);
void SetFrameRate (const std::string& frameRate);
void SetAudioSamplingRate (const std::string& audioSamplingRate);
void SetMimeType (const std::string& mimeType);
void SetSegmentProfiles (const std::string& segmentProfiles);
void SetCodecs (const std::string& codecs);
void SetMaximumSAPPeriod (double maximumSAPPeroid);
void SetStartWithSAP (uint8_t startWithSAP);
void SetMaxPlayoutRate (double maxPlayoutRate);
void SetCodingDependency (bool codingDependency);
void SetScanType (const std::string& scanType);
protected:
std::vector<Descriptor *> framePacking;
std::vector<Descriptor *> audioChannelConfiguration;
std::vector<Descriptor *> contentProtection;
std::vector<std::string> profiles;
uint32_t width;
uint32_t height;
std::string sar;
std::string frameRate;
std::string audioSamplingRate;
std::string mimeType;
std::vector<std::string> segmentProfiles;
std::vector<std::string> codecs;
double maximumSAPPeriod;
uint8_t startWithSAP;
double maxPlayoutRate;
bool codingDependency;
std::string scanType;
};
}
}
#endif /* REPRESENTATIONBASE_H_ */
| 5,013 | 54.711111 | 96 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/mpd/SegmentTimeline.cpp
|
/*
* SegmentTimeline.cpp
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#include "SegmentTimeline.h"
using namespace dash::mpd;
SegmentTimeline::SegmentTimeline ()
{
}
SegmentTimeline::~SegmentTimeline ()
{
for (size_t i=0; i < this->timelines.size(); i++)
delete(this->timelines.at(i));
}
std::vector<ITimeline *>& SegmentTimeline::GetTimelines () const
{
return (std::vector<ITimeline*> &) this->timelines;
}
void SegmentTimeline::AddTimeline (Timeline *timeline)
{
this->timelines.push_back(timeline);
}
| 931 | 28.125 | 80 |
cpp
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/mpd/SubRepresentation.cpp
|
/*
* SubRepresentation.h
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#include "SubRepresentation.h"
using namespace dash::mpd;
SubRepresentation::SubRepresentation () :
level(0),
bandWidth(0)
{
}
SubRepresentation::~SubRepresentation ()
{
}
uint32_t SubRepresentation::GetLevel () const
{
return this->level;
}
void SubRepresentation::SetLevel (uint32_t level)
{
this->level = level;
}
const std::vector<uint32_t>& SubRepresentation::GetDependencyLevel () const
{
return this->dependencyLevel;
}
void SubRepresentation::SetDependencyLevel (const std::string& dependencyLevel)
{
dash::helpers::String::Split(dependencyLevel, ' ', this->dependencyLevel);
}
uint32_t SubRepresentation::GetBandWidth () const
{
return this->bandWidth;
}
void SubRepresentation::SetBandWidth (uint32_t bandWidth)
{
this->bandWidth = bandWidth;
}
const std::vector<std::string>& SubRepresentation::GetContentComponent () const
{
return this->contentComponent;
}
void SubRepresentation::SetContentComponent (const std::string& contentComponent)
{
dash::helpers::String::Split(contentComponent, ' ', this->contentComponent);
}
| 1,760 | 30.446429 | 109 |
cpp
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/mpd/RepresentationBase.cpp
|
/*
* RepresentationBase.cpp
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#include "RepresentationBase.h"
using namespace dash::mpd;
RepresentationBase::RepresentationBase () :
width(0),
height(0),
sar(""),
frameRate(""),
audioSamplingRate(""),
mimeType(""),
maximumSAPPeriod(0.0),
startWithSAP(0),
maxPlayoutRate(0.0),
codingDependency(false),
scanType("")
{
}
RepresentationBase::~RepresentationBase ()
{
for(size_t i = 0; i < this->framePacking.size(); i++)
delete(this->framePacking.at(i));
for(size_t i = 0; i < this->audioChannelConfiguration.size(); i++)
delete(this->audioChannelConfiguration.at(i));
for(size_t i = 0; i < this->contentProtection.size(); i++)
delete(this->contentProtection.at(i));
}
const std::vector<IDescriptor*>& RepresentationBase::GetFramePacking () const
{
return (std::vector<IDescriptor*> &) this->framePacking;
}
void RepresentationBase::AddFramePacking (Descriptor *framePacking)
{
this->framePacking.push_back(framePacking);
}
const std::vector<IDescriptor*>& RepresentationBase::GetAudioChannelConfiguration () const
{
return (std::vector<IDescriptor*> &) this->audioChannelConfiguration;
}
void RepresentationBase::AddAudioChannelConfiguration (Descriptor *audioChannelConfiguration)
{
this->audioChannelConfiguration.push_back(audioChannelConfiguration);
}
const std::vector<IDescriptor*>& RepresentationBase::GetContentProtection () const
{
return (std::vector<IDescriptor*> &) this->contentProtection;
}
void RepresentationBase::AddContentProtection (Descriptor *contentProtection)
{
this->contentProtection.push_back(contentProtection);
}
const std::vector<std::string>& RepresentationBase::GetProfiles () const
{
return this->profiles;
}
void RepresentationBase::SetProfiles (const std::string& profiles)
{
dash::helpers::String::Split(profiles, ',', this->profiles);
}
uint32_t RepresentationBase::GetWidth () const
{
return this->width;
}
void RepresentationBase::SetWidth (uint32_t width)
{
this->width = width;
}
uint32_t RepresentationBase::GetHeight () const
{
return this->height;
}
void RepresentationBase::SetHeight (uint32_t height)
{
this->height = height;
}
std::string RepresentationBase::GetSar () const
{
return this->sar;
}
void RepresentationBase::SetSar (const std::string& sar)
{
this->sar = sar;
}
std::string RepresentationBase::GetFrameRate () const
{
return this->frameRate;
}
void RepresentationBase::SetFrameRate (const std::string& frameRate)
{
this->frameRate = frameRate;
}
std::string RepresentationBase::GetAudioSamplingRate () const
{
return this->audioSamplingRate;
}
void RepresentationBase::SetAudioSamplingRate (const std::string& audioSamplingRate)
{
this->audioSamplingRate = audioSamplingRate;
}
std::string RepresentationBase::GetMimeType () const
{
return this->mimeType;
}
void RepresentationBase::SetMimeType (const std::string& mimeType)
{
this->mimeType = mimeType;
}
const std::vector<std::string>& RepresentationBase::GetSegmentProfiles () const
{
return this->segmentProfiles;
}
void RepresentationBase::SetSegmentProfiles (const std::string& segmentProfiles)
{
dash::helpers::String::Split(segmentProfiles, ',', this->segmentProfiles);
}
const std::vector<std::string>& RepresentationBase::GetCodecs () const
{
return this->codecs;
}
void RepresentationBase::SetCodecs (const std::string& codecs)
{
dash::helpers::String::Split(codecs, ',', this->codecs);
}
double RepresentationBase::GetMaximumSAPPeriod () const
{
return this->maximumSAPPeriod;
}
void RepresentationBase::SetMaximumSAPPeriod (double maximumSAPPeriod)
{
this->maximumSAPPeriod = maximumSAPPeriod;
}
uint8_t RepresentationBase::GetStartWithSAP () const
{
return this->startWithSAP;
}
void RepresentationBase::SetStartWithSAP (uint8_t startWithSAP)
{
this->startWithSAP = startWithSAP;
}
double RepresentationBase::GetMaxPlayoutRate () const
{
return this->maxPlayoutRate;
}
void RepresentationBase::SetMaxPlayoutRate (double maxPlayoutRate)
{
this->maxPlayoutRate = maxPlayoutRate;
}
bool RepresentationBase::HasCodingDependency () const
{
return this->codingDependency;
}
void RepresentationBase::SetCodingDependency (bool codingDependency)
{
this->codingDependency = codingDependency;
}
std::string RepresentationBase::GetScanType () const
{
return this->scanType;
}
void RepresentationBase::SetScanType (const std::string& scanType)
{
this->scanType = scanType;
}
| 6,488 | 35.869318 | 127 |
cpp
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/mpd/SegmentList.cpp
|
/*
* SegmentList.cpp
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#include "SegmentList.h"
using namespace dash::mpd;
SegmentList::SegmentList () :
xlinkHref(""),
xlinkActuate("onRequest")
{
}
SegmentList::~SegmentList ()
{
for (size_t i = 0; i < segmentURLs.size(); i++)
delete(this->segmentURLs.at(i));
}
const std::vector<ISegmentURL*>& SegmentList::GetSegmentURLs () const
{
return (std::vector<ISegmentURL*> &) this->segmentURLs;
}
void SegmentList::AddSegmentURL (SegmentURL *segmentURL)
{
this->segmentURLs.push_back(segmentURL);
}
const std::string& SegmentList::GetXlinkHref () const
{
return this->xlinkHref;
}
void SegmentList::SetXlinkHref (const std::string& xlinkHref)
{
this->xlinkHref = xlinkHref;
}
const std::string& SegmentList::GetXlinkActuate () const
{
return this->xlinkActuate;
}
void SegmentList::SetXlinkActuate (const std::string& xlinkActuate)
{
this->xlinkActuate = xlinkActuate;
}
| 1,491 | 28.254902 | 97 |
cpp
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/mpd/Segment.h
|
/*
* Segment.h
*****************************************************************************
* Copyright (C) 2013, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#ifndef SEGMENT_H_
#define SEGMENT_H_
#include "config.h"
#include "../network/AbstractChunk.h"
#include "../helpers/Path.h"
#include "ISegment.h"
#include "IBaseUrl.h"
#include "../metrics/HTTPTransaction.h"
namespace dash
{
namespace mpd
{
class Segment : public network::AbstractChunk, public virtual ISegment
{
public:
Segment ();
virtual ~Segment();
bool Init (const std::vector<IBaseUrl *>& baseurls, const std::string &uri,
const std::string &range, dash::metrics::HTTPTransactionType type);
std::string& AbsoluteURI ();
std::string& Host ();
size_t Port ();
std::string& Path ();
std::string& Range ();
size_t StartByte ();
size_t EndByte ();
bool HasByteRange ();
dash::metrics::HTTPTransactionType GetType ();
void AbsoluteURI (std::string uri);
void Host (std::string host);
void Port (size_t port);
void Path (std::string path);
void Range (std::string range);
void StartByte (size_t startByte);
void EndByte (size_t endByte);
void HasByteRange (bool hasByteRange);
void SetType (dash::metrics::HTTPTransactionType type);
private:
std::string absoluteuri;
std::string host;
size_t port;
std::string path;
std::string range;
size_t startByte;
size_t endByte;
bool hasByteRange;
dash::metrics::HTTPTransactionType type;
};
}
}
#endif /* SEGMENT_H_ */
| 2,997 | 41.828571 | 136 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/mpd/Timeline.h
|
/*
* Timeline.h
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#ifndef TIMELINE_H_
#define TIMELINE_H_
#include "config.h"
#include "ITimeline.h"
#include "AbstractMPDElement.h"
namespace dash
{
namespace mpd
{
class Timeline : public ITimeline, public AbstractMPDElement
{
public:
Timeline ();
virtual ~Timeline ();
uint32_t GetStartTime () const;
uint32_t GetDuration () const;
uint32_t GetRepeatCount () const;
void SetStartTime (uint32_t startTime);
void SetDuration (uint32_t duration);
void SetRepeatCount (uint32_t repeatCount);
private:
uint32_t startTime;
uint32_t duration;
uint32_t repeatCount;
};
}
}
#endif /* TIMELINE_H_ */
| 1,308 | 26.851064 | 79 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/mpd/SegmentURL.h
|
/*
* SegmentURL.h
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#ifndef SEGMENTURL_H_
#define SEGMENTURL_H_
#include "config.h"
#include "ISegmentURL.h"
#include "../helpers/Path.h"
#include "Segment.h"
#include "AbstractMPDElement.h"
namespace dash
{
namespace mpd
{
class SegmentURL : public ISegmentURL, public AbstractMPDElement
{
public:
SegmentURL ();
virtual ~SegmentURL();
const std::string& GetMediaURI () const;
const std::string& GetMediaRange () const;
const std::string& GetIndexURI () const;
const std::string& GetIndexRange () const;
ISegment* ToMediaSegment (const std::vector<IBaseUrl *>& baseurls) const;
ISegment* ToIndexSegment (const std::vector<IBaseUrl *>& baseurls) const;
void SetMediaURI (const std::string& mediaURI);
void SetMediaRange (const std::string& mediaRange);
void SetIndexURI (const std::string& indexURI);
void SetIndexRange (const std::string& indexRange);
private:
std::string mediaURI;
std::string mediaRange;
std::string indexURI;
std::string indexRange;
};
}
}
#endif /* SEGMENTURL_H_ */
| 1,796 | 32.277778 | 100 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/mpd/ContentComponent.h
|
/*
* ContentComponent.h
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#ifndef CONTENTCOMPONENT_H_
#define CONTENTCOMPONENT_H_
#include "config.h"
#include "IContentComponent.h"
#include "Descriptor.h"
#include "AbstractMPDElement.h"
namespace dash
{
namespace mpd
{
class ContentComponent : public IContentComponent, public AbstractMPDElement
{
public:
ContentComponent ();
virtual ~ContentComponent ();
const std::vector<IDescriptor *>& GetAccessibility () const;
const std::vector<IDescriptor *>& GetRole () const;
const std::vector<IDescriptor *>& GetRating () const;
const std::vector<IDescriptor *>& GetViewpoint () const;
uint32_t GetId () const;
const std::string& GetLang () const;
const std::string& GetContentType () const;
const std::string& GetPar () const;
void AddAccessibity (Descriptor *accessibility);
void AddRole (Descriptor *role);
void AddRating (Descriptor *rating);
void AddViewpoint (Descriptor *viewpoint);
void SetId (uint32_t id);
void SetLang (const std::string& lang);
void SetContentType (const std::string& contentType);
void SetPar (const std::string& par);
private:
std::vector<Descriptor *> accessibility;
std::vector<Descriptor *> role;
std::vector<Descriptor *> rating;
std::vector<Descriptor *> viewpoint;
uint32_t id;
std::string lang;
std::string contentType;
std::string par;
};
}
}
#endif /* CONTENTCOMPONENT_H_ */
| 2,530 | 39.174603 | 84 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/mpd/SegmentTemplate.cpp
|
/*
* SegmentTemplate.cpp
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#include "SegmentTemplate.h"
using namespace dash::mpd;
using namespace dash::metrics;
SegmentTemplate::SegmentTemplate () :
media(""),
index(""),
initialization(""),
bitstreamSwitching("")
{
}
SegmentTemplate::~SegmentTemplate ()
{
}
const std::string& SegmentTemplate::Getmedia () const
{
return this->media;
}
void SegmentTemplate::SetMedia (const std::string& media)
{
this->media = media;
}
const std::string& SegmentTemplate::Getindex () const
{
return this->index;
}
void SegmentTemplate::SetIndex (const std::string& index)
{
this->index = index;
}
const std::string& SegmentTemplate::Getinitialization () const
{
return this->initialization;
}
void SegmentTemplate::SetInitialization (const std::string& initialization)
{
this->initialization = initialization;
}
const std::string& SegmentTemplate::GetbitstreamSwitching () const
{
return this->bitstreamSwitching;
}
void SegmentTemplate::SetBitstreamSwitching (const std::string& bitstreamSwitching)
{
this->bitstreamSwitching = bitstreamSwitching;
}
ISegment* SegmentTemplate::ToInitializationSegment (const std::vector<IBaseUrl *>& baseurls, const std::string& representationID, uint32_t bandwidth) const
{
return ToSegment(this->initialization, baseurls, representationID, bandwidth, dash::metrics::InitializationSegment);
}
ISegment* SegmentTemplate::ToBitstreamSwitchingSegment (const std::vector<IBaseUrl *>& baseurls, const std::string& representationID, uint32_t bandwidth) const
{
return ToSegment(this->bitstreamSwitching, baseurls, representationID, bandwidth, dash::metrics::BitstreamSwitchingSegment);
}
ISegment* SegmentTemplate::GetMediaSegmentFromNumber (const std::vector<IBaseUrl *>& baseurls, const std::string& representationID, uint32_t bandwidth, uint32_t number) const
{
return ToSegment(this->media, baseurls, representationID, bandwidth, dash::metrics::MediaSegment, number);
}
ISegment* SegmentTemplate::GetIndexSegmentFromNumber (const std::vector<IBaseUrl *>& baseurls, const std::string& representationID, uint32_t bandwidth, uint32_t number) const
{
return ToSegment(this->index, baseurls, representationID, bandwidth, dash::metrics::IndexSegment, number);
}
ISegment* SegmentTemplate::GetMediaSegmentFromTime (const std::vector<IBaseUrl *>& baseurls, const std::string& representationID, uint32_t bandwidth, uint32_t time) const
{
return ToSegment(this->media, baseurls, representationID, bandwidth, dash::metrics::MediaSegment, 0, time);
}
ISegment* SegmentTemplate::GetIndexSegmentFromTime (const std::vector<IBaseUrl *>& baseurls, const std::string& representationID, uint32_t bandwidth, uint32_t time) const
{
return ToSegment(this->index, baseurls, representationID, bandwidth, dash::metrics::IndexSegment, 0, time);
}
std::string SegmentTemplate::ReplaceParameters (const std::string& uri, const std::string& representationID, uint32_t bandwidth, uint32_t number, uint32_t time) const
{
std::vector<std::string> chunks;
std::string replacedUri = "";
dash::helpers::String::Split(uri, '$', chunks);
if (chunks.size() > 1)
{
for(size_t i = 0; i < chunks.size(); i++)
{
if ( chunks.at(i) == "RepresentationID") {
chunks.at(i) = representationID;
continue;
}
if (chunks.at(i).find("Bandwidth") == 0)
{
FormatChunk(chunks.at(i), bandwidth);
continue;
}
if (chunks.at(i).find("Number") == 0)
{
FormatChunk(chunks.at(i), number);
continue;
}
if (chunks.at(i).find("Time") == 0)
{
FormatChunk(chunks.at(i), time);
continue;
}
}
for(size_t i = 0; i < chunks.size(); i++)
replacedUri += chunks.at(i);
return replacedUri;
}
else
{
replacedUri = uri;
return replacedUri;
}
}
void SegmentTemplate::FormatChunk (std::string& uri, uint32_t number) const
{
char formattedNumber [50];
size_t pos = 0;
std::string formatTag = "%01d";
if ( (pos = uri.find("%0")) != std::string::npos)
formatTag = uri.substr(pos).append("d");
sprintf(formattedNumber, formatTag.c_str(), number);
uri = formattedNumber;
}
ISegment* SegmentTemplate::ToSegment (const std::string& uri, const std::vector<IBaseUrl *>& baseurls, const std::string& representationID, uint32_t bandwidth, HTTPTransactionType type, uint32_t number, uint32_t time) const
{
Segment *seg = new Segment();
if(seg->Init(baseurls, ReplaceParameters(uri, representationID, bandwidth, number, time), "", type))
return seg;
delete(seg);
return NULL;
}
| 5,675 | 36.342105 | 254 |
cpp
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/mpd/SegmentTimeline.h
|
/*
* SegmentTimeline.h
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#ifndef SEGMENTTIMELINE_H_
#define SEGMENTTIMELINE_H_
#include "config.h"
#include "ISegmentTimeline.h"
#include "AbstractMPDElement.h"
#include "Timeline.h"
namespace dash
{
namespace mpd
{
class SegmentTimeline : public ISegmentTimeline, public AbstractMPDElement
{
public:
SegmentTimeline ();
virtual ~SegmentTimeline ();
std::vector<ITimeline *>& GetTimelines () const;
void AddTimeline (Timeline *timeline);
private:
std::vector<ITimeline *> timelines;
};
}
}
#endif /* SEGMENTTIMELINE_H_ */
| 1,130 | 26.585366 | 82 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/mpd/ProgramInformation.h
|
/*
* ProgramInformation.h
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#ifndef PROGRAMINFORMATION_H_
#define PROGRAMINFORMATION_H_
#include "config.h"
#include "IProgramInformation.h"
#include "AbstractMPDElement.h"
namespace dash
{
namespace mpd
{
class ProgramInformation : public IProgramInformation, public AbstractMPDElement
{
public:
ProgramInformation ();
virtual ~ProgramInformation ();
const std::string& GetTitle () const;
const std::string& GetSource () const;
const std::string& GetCopyright () const;
const std::string& GetLang () const;
const std::string& GetMoreInformationURL () const;
void SetTitle (const std::string& title);
void SetSource (const std::string& source);
void SetCopyright (const std::string& copyright);
void SetLang (const std::string& lang);
void SetMoreInformationURL (const std::string& moreInformationURL);
private:
std::string title;
std::string source;
std::string copyright;
std::string lang;
std::string moreInformationURL;
};
}
}
#endif /* PROGRAMINFORMATION_H_ */
| 1,866 | 34.226415 | 88 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/mpd/AdaptationSet.cpp
|
/*
* AdaptationSet.cpp
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#include "AdaptationSet.h"
#include <cstdlib>
using namespace dash::mpd;
AdaptationSet::AdaptationSet () :
segmentBase(NULL),
segmentList(NULL),
segmentTemplate(NULL),
xlinkHref(""),
xlinkActuate("onRequest"),
id(0),
lang(""),
contentType(""),
par(""),
minBandwidth(0),
maxBandwidth(0),
minWidth(0),
maxWidth(0),
minHeight(0),
maxHeight(0),
minFramerate(""),
maxFramerate(""),
segmentAlignmentIsBool(true),
subsegmentAlignmentIsBool(true),
usesSegmentAlignment(false),
usesSubsegmentAlignment(false),
segmentAlignment(0),
subsegmentAlignment(0),
isBitstreamSwitching(false)
{
}
AdaptationSet::~AdaptationSet ()
{
for(size_t i = 0; i < this->accessibility.size(); i++)
delete(this->accessibility.at(i));
for(size_t i = 0; i < this->role.size(); i++)
delete(this->role.at(i));
for(size_t i = 0; i < this->rating.size(); i++)
delete(this->rating.at(i));
for(size_t i = 0; i < this->viewpoint.size(); i++)
delete(this->viewpoint.at(i));
for(size_t i = 0; i < this->contentComponent.size(); i++)
delete(this->contentComponent.at(i));
for(size_t i = 0; i < this->baseURLs.size(); i++)
delete(this->baseURLs.at(i));
for(size_t i = 0; i < this->representation.size(); i++)
delete(this->representation.at(i));
delete(segmentBase);
delete(segmentList);
delete(segmentTemplate);
}
const std::vector<IDescriptor *>& AdaptationSet::GetAccessibility () const
{
return (std::vector<IDescriptor *> &) this->accessibility;
}
void AdaptationSet::AddAccessibity (Descriptor *accessibility)
{
this->accessibility.push_back(accessibility);
}
const std::vector<IDescriptor *>& AdaptationSet::GetRole () const
{
return (std::vector<IDescriptor *> &) this->role;
}
void AdaptationSet::AddRole (Descriptor *role)
{
this->role.push_back(role);
}
const std::vector<IDescriptor *>& AdaptationSet::GetRating () const
{
return (std::vector<IDescriptor *> &) this->rating;
}
void AdaptationSet::AddRating (Descriptor *rating)
{
this->rating.push_back(rating);
}
const std::vector<IDescriptor *>& AdaptationSet::GetViewpoint () const
{
return (std::vector<IDescriptor *> &) this->viewpoint;
}
void AdaptationSet::AddViewpoint (Descriptor *viewpoint)
{
this->viewpoint.push_back(viewpoint);
}
const std::vector<IContentComponent *>& AdaptationSet::GetContentComponent () const
{
return (std::vector<IContentComponent *> &) this->contentComponent;
}
void AdaptationSet::AddContentComponent (ContentComponent *contentComponent)
{
this->contentComponent.push_back(contentComponent);
}
const std::vector<IBaseUrl *>& AdaptationSet::GetBaseURLs () const
{
return (std::vector<IBaseUrl *> &) this->baseURLs;
}
void AdaptationSet::AddBaseURL (BaseUrl *baseUrl)
{
this->baseURLs.push_back(baseUrl);
}
ISegmentBase* AdaptationSet::GetSegmentBase () const
{
return this->segmentBase;
}
void AdaptationSet::SetSegmentBase (SegmentBase *segmentBase)
{
this->segmentBase = segmentBase;
}
ISegmentList* AdaptationSet::GetSegmentList () const
{
return this->segmentList;
}
void AdaptationSet::SetSegmentList (SegmentList *segmentList)
{
this->segmentList = segmentList;
}
ISegmentTemplate* AdaptationSet::GetSegmentTemplate () const
{
return this->segmentTemplate;
}
void AdaptationSet::SetSegmentTemplate (SegmentTemplate *segmentTemplate)
{
this->segmentTemplate = segmentTemplate;
}
const std::vector<IRepresentation *>& AdaptationSet::GetRepresentation () const
{
return (std::vector<IRepresentation *> &) this->representation;
}
void AdaptationSet::AddRepresentation (Representation *representation)
{
this->representation.push_back(representation);
}
const std::string& AdaptationSet::GetXlinkHref () const
{
return this->xlinkHref;
}
void AdaptationSet::SetXlinkHref (const std::string& xlinkHref)
{
this->xlinkHref = xlinkHref;
}
const std::string& AdaptationSet::GetXlinkActuate () const
{
return this->xlinkActuate;
}
void AdaptationSet::SetXlinkActuate (const std::string& xlinkActuate)
{
this->xlinkActuate = xlinkActuate;
}
uint32_t AdaptationSet::GetId () const
{
return this->id;
}
void AdaptationSet::SetId (uint32_t id)
{
this->id = id;
}
uint32_t AdaptationSet::GetGroup () const
{
return this->group;
}
void AdaptationSet::SetGroup (uint32_t group)
{
this->group = group;
}
const std::string& AdaptationSet::GetLang () const
{
return this->lang;
}
void AdaptationSet::SetLang (const std::string& lang)
{
this->lang = lang;
}
const std::string& AdaptationSet::GetContentType () const
{
return this->contentType;
}
void AdaptationSet::SetContentType (const std::string& contentType)
{
this->contentType = contentType;
}
const std::string& AdaptationSet::GetPar () const
{
return this->par;
}
void AdaptationSet::SetPar (const std::string& par)
{
this->par = par;
}
uint32_t AdaptationSet::GetMinBandwidth () const
{
return this->minBandwidth;
}
void AdaptationSet::SetMinBandwidth (uint32_t minBandwidth)
{
this->minBandwidth = minBandwidth;
}
uint32_t AdaptationSet::GetMaxBandwidth () const
{
return this->maxBandwidth;
}
void AdaptationSet::SetMaxBandwidth (uint32_t maxBandwidth)
{
this->maxBandwidth = maxBandwidth;
}
uint32_t AdaptationSet::GetMinWidth () const
{
return this->minWidth;
}
void AdaptationSet::SetMinWidth (uint32_t minWidth)
{
this->minWidth = minWidth;
}
uint32_t AdaptationSet::GetMaxWidth () const
{
return this->maxWidth;
}
void AdaptationSet::SetMaxWidth (uint32_t maxWidth)
{
this->maxWidth = maxWidth;
}
uint32_t AdaptationSet::GetMinHeight () const
{
return this->minHeight;
}
void AdaptationSet::SetMinHeight (uint32_t minHeight)
{
this->minHeight = minHeight;
}
uint32_t AdaptationSet::GetMaxHeight () const
{
return this->maxHeight;
}
void AdaptationSet::SetMaxHeight (uint32_t maxHeight)
{
this->maxHeight = maxHeight;
}
const std::string& AdaptationSet::GetMinFramerate () const
{
return this->minFramerate;
}
void AdaptationSet::SetMinFramerate (const std::string& minFramerate)
{
this->minFramerate = minFramerate;
}
const std::string& AdaptationSet::GetMaxFramerate () const
{
return this->maxFramerate;
}
void AdaptationSet::SetMaxFramerate (const std::string& maxFramerate)
{
this->maxFramerate = maxFramerate;
}
bool AdaptationSet::SegmentAlignmentIsBoolValue () const
{
return this->segmentAlignmentIsBool;
}
bool AdaptationSet::SubsegmentAlignmentIsBoolValue () const
{
return this->subsegmentAlignmentIsBool;
}
bool AdaptationSet::HasSegmentAlignment () const
{
return this->usesSegmentAlignment;
}
bool AdaptationSet::HasSubsegmentAlignment () const
{
return this->usesSubsegmentAlignment;
}
uint32_t AdaptationSet::GetSegmentAligment () const
{
return this->segmentAlignment;
}
void AdaptationSet::SetSegmentAlignment (const std::string& segmentAlignment)
{
if (segmentAlignment == "true" || segmentAlignment == "True" || segmentAlignment == "TRUE")
{
this->segmentAlignmentIsBool = true;
this->usesSegmentAlignment = true;
return;
}
if (segmentAlignment == "false" || segmentAlignment == "False" || segmentAlignment == "FALSE")
{
this->segmentAlignmentIsBool = true;
this->usesSegmentAlignment = false;
return;
}
this->segmentAlignmentIsBool = false;
this->segmentAlignment = strtoul(segmentAlignment.c_str(), NULL, 10);
}
void AdaptationSet::SetSubsegmentAlignment (const std::string& subsegmentAlignment)
{
if (subsegmentAlignment == "true" || subsegmentAlignment == "True" || subsegmentAlignment == "TRUE")
{
this->subsegmentAlignmentIsBool = true;
this->usesSubsegmentAlignment = true;
return;
}
if (subsegmentAlignment == "false" || subsegmentAlignment == "False" || subsegmentAlignment == "FALSE")
{
this->subsegmentAlignmentIsBool = true;
this->usesSubsegmentAlignment = false;
return;
}
this->subsegmentAlignmentIsBool = false;
this->subsegmentAlignment = strtoul(subsegmentAlignment.c_str(), NULL, 10);
}
uint32_t AdaptationSet::GetSubsegmentAlignment () const
{
return this->subsegmentAlignment;
}
uint8_t AdaptationSet::GetSubsegmentStartsWithSAP () const
{
return this->subsegmentStartsWithSAP;
}
void AdaptationSet::SetSubsegmentStartsWithSAP (uint8_t subsegmentStartsWithSAP)
{
this->subsegmentStartsWithSAP = subsegmentStartsWithSAP;
}
bool AdaptationSet::GetBitstreamSwitching () const
{
return this->isBitstreamSwitching;
}
void AdaptationSet::SetBitstreamSwitching (bool value)
{
this->isBitstreamSwitching = value;
}
| 12,404 | 35.061047 | 128 |
cpp
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/mpd/AbstractMPDElement.h
|
/*
* AbstractMPDElement.h
*****************************************************************************
* Copyright (C) 2013, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#ifndef ABSTRACTMPDELEMENT_H_
#define ABSTRACTMPDELEMENT_H_
#include "config.h"
#include "IMPDElement.h"
namespace dash
{
namespace mpd
{
class AbstractMPDElement : public virtual IMPDElement
{
public:
AbstractMPDElement ();
virtual ~AbstractMPDElement ();
virtual const std::vector<xml::INode *> GetAdditionalSubNodes () const;
virtual const std::map<std::string, std::string> GetRawAttributes () const;
virtual void AddAdditionalSubNode (xml::INode * node);
virtual void AddRawAttributes (std::map<std::string, std::string> attributes);
private:
std::vector<xml::INode *> additionalSubNodes;
std::map<std::string, std::string> rawAttributes;
};
}
}
#endif /* ABSTRACTMPDELEMENT_H_ */
| 1,453 | 33.619048 | 140 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/mpd/URLType.cpp
|
/*
* URLType.cpp
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#include "URLType.h"
using namespace dash::mpd;
using namespace dash::helpers;
using namespace dash::metrics;
URLType::URLType () :
sourceURL(""),
range("")
{
}
URLType::~URLType ()
{
}
const std::string& URLType::GetSourceURL () const
{
return this->sourceURL;
}
void URLType::SetSourceURL (const std::string& sourceURL)
{
this->sourceURL = sourceURL;
}
const std::string& URLType::GetRange () const
{
return this->range;
}
void URLType::SetRange (const std::string& range)
{
this->range = range;
}
void URLType::SetType (HTTPTransactionType type)
{
this->type = type;
}
ISegment* URLType::ToSegment (const std::vector<IBaseUrl *>& baseurls) const
{
Segment *seg = new Segment();
if(seg->Init(baseurls, this->sourceURL, this->range, this->type))
return seg;
delete(seg);
return NULL;
}
| 1,387 | 22.931034 | 91 |
cpp
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/mpd/MPD.h
|
/*
* MPD.h
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#ifndef MPD_H_
#define MPD_H_
#include "config.h"
#include "IMPD.h"
#include "ProgramInformation.h"
#include "BaseUrl.h"
#include "Period.h"
#include "Metrics.h"
#include "AbstractMPDElement.h"
#include "../metrics/HTTPTransaction.h"
#include "../metrics/TCPConnection.h"
namespace dash
{
namespace mpd
{
class MPD : public IMPD, public AbstractMPDElement
{
public:
MPD ();
virtual ~MPD();
const std::vector<IProgramInformation *>& GetProgramInformations () const;
const std::vector<IBaseUrl *>& GetBaseUrls () const;
const std::vector<std::string>& GetLocations () const;
const std::vector<IPeriod *>& GetPeriods () const;
const std::vector<IMetrics *>& GetMetrics () const;
const std::string& GetId () const;
const std::vector<std::string>& GetProfiles () const;
const std::string& GetType () const;
const std::string& GetAvailabilityStarttime () const;
const std::string& GetAvailabilityEndtime () const;
const std::string& GetMediaPresentationDuration () const;
const std::string& GetMinimumUpdatePeriod () const;
const std::string& GetMinBufferTime () const;
const std::string& GetTimeShiftBufferDepth () const;
const std::string& GetSuggestedPresentationDelay () const;
const std::string& GetMaxSegmentDuration () const;
const std::string& GetMaxSubsegmentDuration () const;
IBaseUrl* GetMPDPathBaseUrl () const;
uint32_t GetFetchTime () const;
const std::vector<dash::metrics::ITCPConnection *>& GetTCPConnectionList () const;
const std::vector<dash::metrics::IHTTPTransaction *>& GetHTTPTransactionList () const;
void AddTCPConnection (dash::metrics::TCPConnection *tcpConn);
void AddHTTPTransaction (dash::metrics::HTTPTransaction *httpTransAct);
void AddProgramInformation (ProgramInformation *programInformation);
void AddBaseUrl (BaseUrl *url);
void AddLocation (const std::string& location);
void AddPeriod (Period *period);
void AddMetrics (Metrics *metrics);
void SetId (const std::string& id);
void SetProfiles (const std::string& profiles);
void SetType (const std::string& type);
void SetAvailabilityStarttime (const std::string& availabilityStarttime);
void SetAvailabilityEndtime (const std::string& availabilityEndtime);
void SetMediaPresentationDuration (const std::string& mediaPresentationDuration);
void SetMinimumUpdatePeriod (const std::string& minimumUpdatePeriod);
void SetMinBufferTime (const std::string& minBufferTime);
void SetTimeShiftBufferDepth (const std::string& timeShiftBufferDepth);
void SetSuggestedPresentationDelay (const std::string& suggestedPresentationDelay);
void SetMaxSegmentDuration (const std::string& maxSegmentDuration);
void SetMaxSubsegmentDuration (const std::string& maxSubsegmentDuration);
void SetMPDPathBaseUrl (BaseUrl *path);
void SetFetchTime (uint32_t fetchTimeInSec);
private:
std::vector<ProgramInformation *> programInformations;
std::vector<BaseUrl *> baseUrls;
std::vector<std::string> locations;
std::vector<Period *> periods;
std::vector<Metrics *> metrics;
std::string id;
std::vector<std::string> profiles;
std::string type;
std::string availabilityStarttime;
std::string availabilityEndtime;
std::string mediaPresentationDuration;
std::string minimumUpdatePeriod;
std::string minBufferTime;
std::string timeShiftBufferDepth;
std::string suggestedPresentationDelay;
std::string maxSegmentDuration;
std::string maxSubsegmentDuration;
BaseUrl *mpdPathBaseUrl;
uint32_t fetchTime;
std::vector<dash::metrics::TCPConnection *> tcpConnections;
std::vector<dash::metrics::HTTPTransaction *> httpTransactions;
};
}
}
#endif /* MPD_H_ */
| 6,573 | 59.87037 | 143 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/mpd/SubRepresentation.h
|
/*
* SubRepresentation.h
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#ifndef SUBREPRESENTATION_H_
#define SUBREPRESENTATION_H_
#include "config.h"
#include "ISubRepresentation.h"
#include "Descriptor.h"
#include "RepresentationBase.h"
#include "../helpers/String.h"
namespace dash
{
namespace mpd
{
class SubRepresentation : public ISubRepresentation, public RepresentationBase
{
public:
SubRepresentation ();
virtual ~SubRepresentation ();
uint32_t GetLevel () const;
const std::vector<uint32_t>& GetDependencyLevel () const;
uint32_t GetBandWidth () const;
const std::vector<std::string>& GetContentComponent () const;
void SetLevel (uint32_t level);
void SetDependencyLevel (const std::string& dependencyLevel);
void SetBandWidth (uint32_t bandWidth);
void SetContentComponent (const std::string& contentComponent);
protected:
uint32_t level;
std::vector<uint32_t> dependencyLevel;
uint32_t bandWidth;
std::vector<std::string> contentComponent;
};
}
}
#endif /* SUBREPRESENTATION_H_ */
| 1,851 | 35.313725 | 90 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/mpd/SegmentTemplate.h
|
/*
* SegmentTemplate.h
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#ifndef SEGMENTTEMPLATE_H_
#define SEGMENTTEMPLATE_H_
#include "config.h"
#include "ISegmentTemplate.h"
#include "MultipleSegmentBase.h"
#include "../helpers/String.h"
namespace dash
{
namespace mpd
{
class SegmentTemplate : public ISegmentTemplate, public MultipleSegmentBase
{
public:
SegmentTemplate ();
virtual ~SegmentTemplate ();
const std::string& Getmedia () const;
const std::string& Getindex () const;
const std::string& Getinitialization () const;
const std::string& GetbitstreamSwitching () const;
ISegment* ToInitializationSegment (const std::vector<IBaseUrl *>& baseurls, const std::string& representationID, uint32_t bandwidth) const;
ISegment* ToBitstreamSwitchingSegment (const std::vector<IBaseUrl *>& baseurls, const std::string& representationID, uint32_t bandwidth) const;
ISegment* GetMediaSegmentFromNumber (const std::vector<IBaseUrl *>& baseurls, const std::string& representationID, uint32_t bandwidth, uint32_t number) const;
ISegment* GetIndexSegmentFromNumber (const std::vector<IBaseUrl *>& baseurls, const std::string& representationID, uint32_t bandwidth, uint32_t number) const;
ISegment* GetMediaSegmentFromTime (const std::vector<IBaseUrl *>& baseurls, const std::string& representationID, uint32_t bandwidth, uint32_t time) const;
ISegment* GetIndexSegmentFromTime (const std::vector<IBaseUrl *>& baseurls, const std::string& representationID, uint32_t bandwidth, uint32_t time) const;
void SetMedia (const std::string& media);
void SetIndex (const std::string& index);
void SetInitialization (const std::string& initialization);
void SetBitstreamSwitching (const std::string& bitstreamSwichting);
private:
std::string ReplaceParameters (const std::string& uri, const std::string& representationID, uint32_t bandwidth, uint32_t number, uint32_t time) const;
void FormatChunk (std::string& uri, uint32_t number) const;
ISegment* ToSegment (const std::string& uri, const std::vector<IBaseUrl *>& baseurls, const std::string& representationID, uint32_t bandwidth,
dash::metrics::HTTPTransactionType type, uint32_t number = 0, uint32_t time = 0) const;
std::string media;
std::string index;
std::string initialization;
std::string bitstreamSwitching;
};
}
}
#endif /* SEGMENTTEMPLATE_H_ */
| 3,360 | 53.209677 | 186 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/mpd/Segment.cpp
|
/*
* Segment.cpp
*****************************************************************************
* Copyright (C) 2013, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#include "Segment.h"
using namespace dash::mpd;
using namespace dash::helpers;
using namespace dash::metrics;
Segment::Segment () :
host(""),
port(0),
path(""),
startByte(0),
endByte(0),
hasByteRange(false)
{
}
Segment::~Segment ()
{
}
bool Segment::Init (const std::vector<IBaseUrl *>& baseurls, const std::string &uri, const std::string &range, HTTPTransactionType type)
{
std::string host = "";
size_t port = 80;
std::string path = "";
size_t startByte = 0;
size_t endByte = 0;
this->absoluteuri = "";
for(size_t i = 0; i < baseurls.size(); i++)
this->absoluteuri = Path::CombinePaths(this->absoluteuri, baseurls.at(i)->GetUrl());
this->absoluteuri = Path::CombinePaths(this->absoluteuri, uri);
if (uri != "" && dash::helpers::Path::GetHostPortAndPath(this->absoluteuri, host, port, path))
{
this->host = host;
this->port = port;
this->path = path;
if (range != "" && dash::helpers::Path::GetStartAndEndBytes(range, startByte, endByte))
{
this->range = range;
this->hasByteRange = true;
this->startByte = startByte;
this->endByte = endByte;
}
this->type = type;
return true;
}
return false;
}
std::string& Segment::AbsoluteURI ()
{
return this->absoluteuri;
}
std::string& Segment::Host ()
{
return this->host;
}
size_t Segment::Port ()
{
return this->port;
}
std::string& Segment::Path ()
{
return this->path;
}
std::string& Segment::Range ()
{
return this->range;
}
size_t Segment::StartByte ()
{
return this->startByte;
}
size_t Segment::EndByte ()
{
return this->endByte;
}
bool Segment::HasByteRange ()
{
return this->hasByteRange;
}
void Segment::AbsoluteURI (std::string uri)
{
this->absoluteuri = uri;
}
void Segment::Host (std::string host)
{
this->host = host;
}
void Segment::Port (size_t port)
{
this->port = port;
}
void Segment::Path (std::string path)
{
this->path = path;
}
void Segment::Range (std::string range)
{
this->range = range;
}
void Segment::StartByte (size_t startByte)
{
this->startByte = startByte;
}
void Segment::EndByte (size_t endByte)
{
this->endByte = endByte;
}
void Segment::HasByteRange (bool hasByteRange)
{
this->hasByteRange = hasByteRange;
}
HTTPTransactionType Segment::GetType ()
{
return this->type;
}
void Segment::SetType (HTTPTransactionType type)
{
this->type = type;
}
| 3,487 | 24.093525 | 165 |
cpp
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/mpd/MultipleSegmentBase.cpp
|
/*
* MultipleSegmentBase.cpp
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#include "MultipleSegmentBase.h"
using namespace dash::mpd;
MultipleSegmentBase::MultipleSegmentBase () :
bitstreamSwitching(NULL),
segmentTimeline(NULL),
duration(0),
startNumber(1)
{
}
MultipleSegmentBase::~MultipleSegmentBase ()
{
delete(this->segmentTimeline);
delete(this->bitstreamSwitching);
}
const ISegmentTimeline * MultipleSegmentBase::GetSegmentTimeline () const
{
return (ISegmentTimeline *) this->segmentTimeline;
}
void MultipleSegmentBase::SetSegmentTimeline (SegmentTimeline *segmentTimeline)
{
this->segmentTimeline = segmentTimeline;
}
const IURLType* MultipleSegmentBase::GetBitstreamSwitching () const
{
return this->bitstreamSwitching;
}
void MultipleSegmentBase::SetBitstreamSwitching (URLType *bitstreamSwitching)
{
this->bitstreamSwitching = bitstreamSwitching;
}
uint32_t MultipleSegmentBase::GetDuration () const
{
return this->duration;
}
void MultipleSegmentBase::SetDuration (uint32_t duration)
{
this->duration = duration;
}
uint32_t MultipleSegmentBase::GetStartNumber () const
{
return this->startNumber;
}
void MultipleSegmentBase::SetStartNumber (uint32_t startNumber)
{
this->startNumber = startNumber;
}
| 1,924 | 30.557377 | 106 |
cpp
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/mpd/SegmentURL.cpp
|
/*
* SegmentURL.cpp
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#include "SegmentURL.h"
using namespace dash::mpd;
using namespace dash::helpers;
SegmentURL::SegmentURL () :
mediaURI(""),
mediaRange(""),
indexURI(""),
indexRange("")
{
}
SegmentURL::~SegmentURL ()
{
}
const std::string& SegmentURL::GetMediaURI () const
{
return this->mediaURI;
}
void SegmentURL::SetMediaURI (const std::string& mediaURI)
{
this->mediaURI = mediaURI;
}
const std::string& SegmentURL::GetMediaRange () const
{
return this->mediaRange;
}
void SegmentURL::SetMediaRange (const std::string& mediaRange)
{
this->mediaRange = mediaRange;
}
const std::string& SegmentURL::GetIndexURI () const
{
return this->indexURI;
}
void SegmentURL::SetIndexURI (const std::string& indexURI)
{
this->indexURI = indexURI;
}
const std::string& SegmentURL::GetIndexRange () const
{
return this->indexRange;
}
void SegmentURL::SetIndexRange (const std::string& indexRange)
{
this->indexRange = indexRange;
}
ISegment* SegmentURL::ToMediaSegment (const std::vector<IBaseUrl *>& baseurls) const
{
Segment *seg = new Segment();
if(seg->Init(baseurls, this->mediaURI, this->mediaRange, dash::metrics::MediaSegment))
return seg;
delete(seg);
return NULL;
}
ISegment* SegmentURL::ToIndexSegment (const std::vector<IBaseUrl *>& baseurls) const
{
Segment *seg = new Segment();
if(seg->Init(baseurls, this->indexURI, this->indexRange, dash::metrics::IndexSegment))
return seg;
delete(seg);
return NULL;
}
| 2,089 | 24.487805 | 95 |
cpp
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/mpd/Descriptor.cpp
|
/*
* Descriptor.cpp
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#include "Descriptor.h"
using namespace dash::mpd;
Descriptor::Descriptor () :
schemeIdUri (""),
value ("")
{
}
Descriptor::~Descriptor ()
{
}
const std::string& Descriptor::GetSchemeIdUri () const
{
return this->schemeIdUri;
}
void Descriptor::SetSchemeIdUri (const std::string& schemeIdUri)
{
this->schemeIdUri = schemeIdUri;
}
const std::string& Descriptor::GetValue () const
{
return this->value;
}
void Descriptor::SetValue (const std::string& value)
{
this->value = value;
}
| 1,016 | 24.425 | 81 |
cpp
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/mpd/SegmentSize.cpp
|
/*
* SegmentSize.cpp
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#include "SegmentSize.h"
using namespace dash::mpd;
SegmentSize::SegmentSize () :
identifier(""),
scale(""),
size(0)
{
}
SegmentSize::~SegmentSize ()
{
}
const std::string& SegmentSize::GetID () const
{
return this->identifier;
}
void SegmentSize::SetID (const std::string& id)
{
this->identifier = id;
}
const std::string& SegmentSize::GetScale () const
{
return this->scale;
}
void SegmentSize::SetScale (const std::string& scale)
{
this->scale = scale;
}
const int SegmentSize::GetSize () const
{
return this->size;
}
void SegmentSize::SetSize (const int size) //directly converted to bits
{
if((this->scale).compare("Kbits") == 0)
this->size = size * 1000;
else if((this->scale).compare("Mbits") == 0)
this->size = size * 1000000;
else if((this->scale).compare("Gbits") == 0)
this->size = size * 1000000000;
else
this->size = size; //default: Bits
}
| 1,660 | 28.140351 | 112 |
cpp
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/mpd/Representation.h
|
/*
* Representation.h
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#ifndef REPRESENTATION_H_
#define REPRESENTATION_H_
#include "config.h"
#include "IRepresentation.h"
#include "SegmentTemplate.h"
#include "RepresentationBase.h"
#include "BaseUrl.h"
#include "SubRepresentation.h"
#include "SegmentBase.h"
#include "SegmentList.h"
#include "SegmentSize.h"
#include "../helpers/String.h"
#include <map>
namespace dash
{
namespace mpd
{
class Representation : public IRepresentation, public RepresentationBase
{
public:
Representation ();
virtual ~Representation ();
const std::vector<IBaseUrl *>& GetBaseURLs () const;
const std::vector<ISubRepresentation *>& GetSubRepresentations () const;
ISegmentBase* GetSegmentBase () const;
ISegmentList* GetSegmentList () const;
ISegmentTemplate* GetSegmentTemplate () const;
int GetSpecificSegmentSize (std::string id) const;
std::map<std::string, int> GetSegmentSizes () const;
bool IsExtended () const;
const std::string& GetId () const;
uint32_t GetBandwidth () const;
uint32_t GetQualityRanking () const;
const std::vector<std::string>& GetDependencyId () const;
const std::vector<std::string>& GetMediaStreamStructureId () const;
void AddBaseURL (BaseUrl *baseURL);
void AddSubRepresentation (SubRepresentation *subRepresentation);
void SetSegmentBase (SegmentBase *segmentBase);
void SetSegmentList (SegmentList *segmentList);
void SetSegmentTemplate (SegmentTemplate *segmentTemplate);
void SetSegmentSize (SegmentSize *segmentSize);
void SetId (const std::string &id);
void SetBandwidth (uint32_t bandwidth);
void SetQualityRanking (uint32_t qualityRanking);
void SetDependencyId (const std::string &dependencyId);
void SetMediaStreamStructureId (const std::string &mediaStreamStructureId);
private:
std::vector<BaseUrl *> baseURLs;
std::vector<SubRepresentation *> subRepresentations;
SegmentBase *segmentBase;
SegmentList *segmentList;
SegmentTemplate *segmentTemplate;
std::map<std::string, int> segmentSizes;
std::string id;
uint32_t bandwidth;
uint32_t qualityRanking;
std::vector<std::string> dependencyId;
std::vector<std::string> mediaStreamStructureId;
};
}
}
#endif /* REPRESENTATION_H_ */
| 4,027 | 47.53012 | 111 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/mpd/URLType.h
|
/*
* URLType.h
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#ifndef URLTYPE_H_
#define URLTYPE_H_
#include "config.h"
#include "IURLType.h"
#include "Segment.h"
#include "../helpers/Path.h"
#include "AbstractMPDElement.h"
namespace dash
{
namespace mpd
{
class URLType : public IURLType, public AbstractMPDElement
{
public:
URLType ();
virtual ~URLType ();
const std::string& GetSourceURL () const;
const std::string& GetRange () const;
ISegment* ToSegment (const std::vector<IBaseUrl *>& baseurls) const;
void SetSourceURL (const std::string& sourceURL);
void SetRange (const std::string& range);
void SetType (dash::metrics::HTTPTransactionType type);
private:
std::string sourceURL;
std::string range;
dash::metrics::HTTPTransactionType type;
};
}
}
#endif /* URLTYPE_H_ */
| 1,509 | 29.816327 | 100 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/mpd/ContentComponent.cpp
|
/*
* ContentComponent.cpp
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#include "ContentComponent.h"
using namespace dash::mpd;
ContentComponent::ContentComponent () :
id(0),
lang(""),
contentType(""),
par("")
{
}
ContentComponent::~ContentComponent ()
{
for(size_t i = 0; i < this->accessibility.size(); i++)
delete(this->accessibility.at(i));
for(size_t i = 0; i < this->role.size(); i++)
delete(this->role.at(i));
for(size_t i = 0; i < this->rating.size(); i++)
delete(this->rating.at(i));
for(size_t i = 0; i < this->viewpoint.size(); i++)
delete(this->viewpoint.at(i));
}
const std::vector<IDescriptor *>& ContentComponent::GetAccessibility () const
{
return (std::vector<IDescriptor *> &)this->accessibility;
}
void ContentComponent::AddAccessibity (Descriptor *accessibility)
{
this->accessibility.push_back(accessibility);
}
const std::vector<IDescriptor *>& ContentComponent::GetRole () const
{
return (std::vector<IDescriptor *> &)this->role;
}
void ContentComponent::AddRole (Descriptor *role)
{
this->role.push_back(role);
}
const std::vector<IDescriptor *>& ContentComponent::GetRating () const
{
return (std::vector<IDescriptor *> &)this->rating;
}
void ContentComponent::AddRating (Descriptor *rating)
{
this->rating.push_back(rating);
}
const std::vector<IDescriptor *>& ContentComponent::GetViewpoint () const
{
return (std::vector<IDescriptor *> &)this->viewpoint;
}
void ContentComponent::AddViewpoint (Descriptor *viewpoint)
{
this->viewpoint.push_back(viewpoint);
}
uint32_t ContentComponent::GetId () const
{
return this->id;
}
void ContentComponent::SetId (uint32_t id)
{
this->id = id;
}
const std::string& ContentComponent::GetLang () const
{
return this->lang;
}
void ContentComponent::SetLang (const std::string& lang)
{
this->lang = lang;
}
const std::string& ContentComponent::GetContentType () const
{
return this->contentType;
}
void ContentComponent::SetContentType (const std::string& contentType)
{
this->contentType = contentType;
}
const std::string& ContentComponent::GetPar () const
{
return this->par;
}
void ContentComponent::SetPar (const std::string& par)
{
this->par = par;
}
| 3,148 | 30.808081 | 104 |
cpp
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/mpd/Subset.h
|
/*
* Subset.h
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#ifndef SUBSET_H_
#define SUBSET_H_
#include "config.h"
#include "ISubset.h"
#include "../helpers/String.h"
#include "AbstractMPDElement.h"
namespace dash
{
namespace mpd
{
class Subset : public ISubset, public AbstractMPDElement
{
public:
Subset ();
virtual ~Subset ();
const std::vector<uint32_t>& Contains () const;
void SetSubset (const std::string& subset);
private:
std::vector<uint32_t> subset;
};
}
}
#endif /* SUBSET_H_ */
| 1,028 | 23.5 | 79 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/mpd/Timeline.cpp
|
/*
* Timeline.cpp
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#include "Timeline.h"
using namespace dash::mpd;
Timeline::Timeline () :
startTime(0),
duration(0),
repeatCount(0)
{
}
Timeline::~Timeline ()
{
}
uint32_t Timeline::GetStartTime () const
{
return this->startTime;
}
void Timeline::SetStartTime (uint32_t startTime)
{
this->startTime = startTime;
}
uint32_t Timeline::GetDuration () const
{
return this->duration;
}
void Timeline::SetDuration (uint32_t duration)
{
this->duration = duration;
}
uint32_t Timeline::GetRepeatCount () const
{
return this->repeatCount;
}
void Timeline::SetRepeatCount (uint32_t repeatCount)
{
this->repeatCount = repeatCount;
}
| 1,173 | 22.959184 | 79 |
cpp
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/mpd/MultipleSegmentBase.h
|
/*
* MultipleSegmentBase.h
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#ifndef MULTIPLESEGMENTBASE_H_
#define MULTIPLESEGMENTBASE_H_
#include "config.h"
#include "IMultipleSegmentBase.h"
#include "SegmentBase.h"
#include "SegmentTimeline.h"
#include "URLType.h"
namespace dash
{
namespace mpd
{
class MultipleSegmentBase : public virtual IMultipleSegmentBase, public SegmentBase
{
public:
MultipleSegmentBase ();
virtual ~MultipleSegmentBase ();
const ISegmentTimeline* GetSegmentTimeline () const;
const IURLType* GetBitstreamSwitching () const;
uint32_t GetDuration () const;
uint32_t GetStartNumber () const;
void SetSegmentTimeline (SegmentTimeline *segmentTimeline);
void SetBitstreamSwitching (URLType *bitstreamSwitching);
void SetDuration (uint32_t duration);
void SetStartNumber (uint32_t startNumber);
protected:
SegmentTimeline *segmentTimeline;
URLType *bitstreamSwitching;
uint32_t duration;
uint32_t startNumber;
};
}
}
#endif /* MULTIPLESEGMENTBASE_H_ */
| 1,905 | 35.653846 | 91 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/mpd/SegmentSize.h
|
/*
* SegmentSize.h
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#ifndef SEGMENTSIZE_H_
#define SEGMENTSIZE_H_
#include "config.h"
#include "../helpers/String.h"
namespace dash
{
namespace mpd
{
class SegmentSize
{
public:
SegmentSize ();
virtual ~SegmentSize ();
const std::string& GetID () const;
const std::string& GetScale () const;
const int GetSize () const;
void SetID (const std::string& id);
void SetScale (const std::string& scale);
//ATTENTION: Maximum value is 2147483647 Bits (2147483.6 Kbits, 2147.4 Mbits, 2.14 Gbits)
void SetSize (const int size);
private:
std::string identifier;
std::string scale;
int size;
};
}
}
#endif /* SEGMENTSIZE_H_ */
| 1,416 | 28.520833 | 105 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/mpd/AbstractMPDElement.cpp
|
/*
* AbstractMPDElement.cpp
*****************************************************************************
* Copyright (C) 2013, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#include "AbstractMPDElement.h"
using namespace dash::mpd;
using namespace dash::xml;
AbstractMPDElement::AbstractMPDElement ()
{
}
AbstractMPDElement::~AbstractMPDElement ()
{
for(size_t i = 0; i < this->additionalSubNodes.size(); i++)
delete(this->additionalSubNodes.at(i));
}
const std::vector<INode *> AbstractMPDElement::GetAdditionalSubNodes () const
{
return this->additionalSubNodes;
}
const std::map<std::string, std::string> AbstractMPDElement::GetRawAttributes () const
{
return this->rawAttributes;
}
void AbstractMPDElement::AddAdditionalSubNode (INode *node)
{
this->additionalSubNodes.push_back(node);
}
void AbstractMPDElement::AddRawAttributes (std::map<std::string, std::string> attributes)
{
this->rawAttributes = attributes;
}
| 1,346 | 31.853659 | 135 |
cpp
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/mpd/ProgramInformation.cpp
|
/*
* ProgramInformation.cpp
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#include "ProgramInformation.h"
using namespace dash::mpd;
ProgramInformation::ProgramInformation () :
title(""),
source(""),
copyright(""),
lang(""),
moreInformationURL("")
{
}
ProgramInformation::~ProgramInformation ()
{
}
const std::string& ProgramInformation::GetTitle () const
{
return this->title;
}
void ProgramInformation::SetTitle (const std::string& title)
{
this->title = title;
}
const std::string& ProgramInformation::GetSource () const
{
return this->source;
}
void ProgramInformation::SetSource (const std::string& source)
{
this->source = source;
}
const std::string& ProgramInformation::GetCopyright () const
{
return this->copyright;
}
void ProgramInformation::SetCopyright (const std::string& copyright)
{
this->copyright = copyright;
}
const std::string& ProgramInformation::GetLang () const
{
return this->lang;
}
void ProgramInformation::SetLang (const std::string& lang)
{
this->lang = lang;
}
const std::string& ProgramInformation::GetMoreInformationURL () const
{
return this->moreInformationURL;
}
void ProgramInformation::SetMoreInformationURL (const std::string& moreInfoURL)
{
this->moreInformationURL = moreInfoURL;
}
| 1,934 | 27.455882 | 96 |
cpp
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash/source/mpd/Descriptor.h
|
/*
* Descriptor.h
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#ifndef DESCRIPTOR_H_
#define DESCRIPTOR_H_
#include "config.h"
#include "IDescriptor.h"
#include "AbstractMPDElement.h"
namespace dash
{
namespace mpd
{
class Descriptor : public IDescriptor, public AbstractMPDElement
{
public:
Descriptor ();
virtual ~Descriptor ();
const std::string& GetSchemeIdUri () const;
const std::string& GetValue () const;
void SetValue (const std::string& value);
void SetSchemeIdUri (const std::string& schemeIdUri);
private:
std::string schemeIdUri;
std::string value;
};
}
}
#endif /* DESCRIPTOR_H_ */
| 1,202 | 26.340909 | 79 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash_memoryleak_test/libdash_memoryleak_test.cpp
|
/*
* libdash_memoryleak_test.cpp
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#include "libdash.h"
#include "IMPD.h"
#include "INode.h"
#include <iostream>
#include <fstream>
#include <Windows.h>
using namespace dash;
using namespace dash::network;
using namespace std;
using namespace dash::mpd;
void testleaks()
{
IDASHManager *manager = CreateDashManager();
IMPD *mpd = manager->Open("TestMPD.mpd");
if (mpd)
{
dash::xml::INode* inode = mpd->GetPeriods().at(0)->GetAdaptationSets().at(0)->GetSegmentTemplate()->GetSegmentTimeline()->GetAdditionalSubNodes().at(0);
std::map<std::string, std::string> rawAttr = mpd->GetPeriods().at(0)->GetAdaptationSets().at(0)->GetSegmentTemplate()->GetSegmentTimeline()->GetRawAttributes();
std::string nodeText = mpd->GetPeriods().at(0)->GetAdaptationSets().at(0)->GetAdditionalSubNodes().at(0)->GetName();
nodeText = mpd->GetPeriods().at(0)->GetAdaptationSets().at(0)->GetAdditionalSubNodes().at(0)->GetText();
nodeText = mpd->GetPeriods().at(0)->GetAdaptationSets().at(0)->GetContentProtection().at(0)->GetAdditionalSubNodes().at(1)->GetName();
nodeText = mpd->GetPeriods().at(0)->GetAdaptationSets().at(0)->GetContentProtection().at(0)->GetAdditionalSubNodes().at(1)->GetText();
rawAttr = mpd->GetPeriods().at(0)->GetAdaptationSets().at(0)->GetRawAttributes();
delete(mpd);
}
mpd = manager->Open("http://www-itec.uni-klu.ac.at/ftp/datasets/mmsys12/BigBuckBunny/MPDs/BigBuckBunnyNonSeg_2s_isoffmain_DIS_23009_1_v_2_1c2_2011_08_30.mpd");
std::string mediauri = mpd->GetPeriods().at(0)->GetAdaptationSets().at(0)->GetRepresentation().at(0)->GetSegmentList()->GetSegmentURLs().at(0)->GetMediaURI();
std::string mediarng = mpd->GetPeriods().at(0)->GetAdaptationSets().at(0)->GetRepresentation().at(0)->GetSegmentList()->GetSegmentURLs().at(0)->GetMediaRange();
std::vector<dash::mpd::IBaseUrl *> baseurls;
baseurls.push_back(mpd->GetBaseUrls().at(0));
dash::mpd::ISegment *seg = mpd->GetPeriods().at(0)->GetAdaptationSets().at(0)->GetRepresentation().at(0)->GetSegmentList()->GetSegmentURLs().at(0)->ToMediaSegment(baseurls);
seg->StartDownload();
delete(seg);
delete(mpd);
delete(manager);
}
int main()
{
testleaks();
_CrtDumpMemoryLeaks();
return 0;
}
| 2,796 | 39.536232 | 177 |
cpp
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash_networkpart_test/HTTPConnection.cpp
|
/*
* HTTPConnection.cpp
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#include "HTTPConnection.h"
using namespace libdashtest;
using namespace dash::network;
using namespace dash::metrics;
HTTPConnection::HTTPConnection () :
peekBufferLen (0),
contentLength (0),
isInit (false),
isScheduled (false)
{
this->peekBuffer = new uint8_t[PEEKBUFFER];
}
HTTPConnection::~HTTPConnection ()
{
delete[] this->peekBuffer;
this->CloseSocket();
}
double HTTPConnection::GetAverageDownloadingSpeed ()
{
//TODO implement if you feel like it....
return -1;
}
double HTTPConnection::GetDownloadingTime ()
{
//TODO implement if you feel like it....
return -1;
}
int HTTPConnection::Read (uint8_t *data, size_t len, IChunk *chunk)
{
if(this->peekBufferLen == 0)
{
int size = recv(this->httpSocket, (char *)data, len, 0);
if(size <= 0)
return 0;
return size;
}
memcpy(data, this->peekBuffer, this->peekBufferLen);
int ret = this->peekBufferLen;
this->peekBufferLen = 0;
return ret;
}
int HTTPConnection::Peek (uint8_t *data, size_t len, IChunk *chunk)
{
if(this->peekBufferLen == 0)
this->peekBufferLen = this->Read(this->peekBuffer, PEEKBUFFER, chunk);
int size = len > this->peekBufferLen ? this->peekBufferLen : len;
memcpy(data, this->peekBuffer, size);
return size;
}
std::string HTTPConnection::PrepareRequest (IChunk *chunk)
{
std::string request;
if(!chunk->HasByteRange())
{
request = "GET " + chunk->Path() + " HTTP/1.1" + "\r\n" +
"Host: " + chunk->Host() + "\r\n" +
"Connection: close\r\n\r\n";
}
else
{
std::stringstream req;
req << "GET " << chunk->Path() << " HTTP/1.1\r\n" <<
"Host: " << chunk->Host() << "\r\n" <<
"Range: bytes=" << chunk->StartByte() << "-" << chunk->EndByte() << "\r\n" <<
"Connection: close\r\n\r\n";
request = req.str();
}
return request;
}
bool HTTPConnection::Init (IChunk *chunk)
{
if(this->isInit)
return false;
if(!this->ConnectToHost(chunk->Host(), chunk->Port()))
return false;
this->isInit = true;
return this->isInit;
}
bool HTTPConnection::ParseHeader ()
{
std::string line = this->ReadLine();
if(line.size() == 0)
return false;
while(line.compare("\r\n"))
{
if(!line.compare(0, 14, "Content-Length"))
this->contentLength = atoi(line.substr(15,line.size()).c_str());
line = this->ReadLine();
if(line.size() == 0)
return false;
}
return true;
}
std::string HTTPConnection::ReadLine ()
{
std::stringstream ss;
char c[1];
int size = recv(this->httpSocket, c, 1, 0);
while(size > 0)
{
ss << c[0];
if(c[0] == '\n')
break;
size = recv(this->httpSocket, c, 1, 0);
}
if(size > 0)
return ss.str();
return "";
}
bool HTTPConnection::SendData (std::string data)
{
int size = send(this->httpSocket, data.c_str(), data.size(), 0);
if(size == -1)
return false;
if (size != data.length())
this->SendData(data.substr(size, data.size()));
return true;
}
void HTTPConnection::CloseSocket ()
{
closesocket(this->httpSocket);
WSACleanup();
}
bool HTTPConnection::ConnectToHost (std::string host, int port)
{
WSADATA info;
if(WSAStartup(MAKEWORD(2,0), &info))
return false;
this->httpSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
memset(&this->addr, 0, sizeof(this->addr));
this->hostent = gethostbyname(host.c_str());
this->addr.sin_family = AF_INET;
this->addr.sin_port = htons(port);
int result = 0;
char **p = this->hostent->h_addr_list;
do
{
if(*p == NULL)
return false;
addr.sin_addr.s_addr = *reinterpret_cast<unsigned long*>(*p);
result = connect(this->httpSocket, reinterpret_cast<sockaddr*>(&addr), sizeof(addr));
}while(result == 1);
return true;
}
bool HTTPConnection::Schedule (IChunk *chunk)
{
if(!this->isInit)
return false;
if(this->isScheduled)
return false;
if(this->SendData(this->PrepareRequest(chunk)))
{
this->isScheduled = this->ParseHeader();
return this->isScheduled;
}
return false;
}
const std::vector<ITCPConnection *>& HTTPConnection::GetTCPConnectionList () const
{
return tcpConnections;
}
const std::vector<IHTTPTransaction *>& HTTPConnection::GetHTTPTransactionList () const
{
return httpTransactions;
}
| 5,337 | 24.298578 | 110 |
cpp
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash_networkpart_test/TestChunk.cpp
|
/*
* TestChunk.cpp
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#include "TestChunk.h"
using namespace dash::network;
using namespace libdashtest;
TestChunk::TestChunk (std::string host, size_t port, std::string path, size_t startbyte, size_t endbyte, bool hasByteRange) :
host (host),
port (port),
path (path),
startbyte (startbyte),
endbyte (endbyte),
hasByteRange (hasByteRange)
{
}
TestChunk::~TestChunk ()
{
}
std::string& TestChunk::AbsoluteURI ()
{
return this->uri;
}
std::string& TestChunk::Host ()
{
return this->host;
}
size_t TestChunk::Port ()
{
return this->port;
}
std::string& TestChunk::Path ()
{
return this->path;
}
size_t TestChunk::StartByte ()
{
return this->startbyte;
}
size_t TestChunk::EndByte ()
{
return this->endbyte;
}
bool TestChunk::HasByteRange ()
{
return this->hasByteRange;
}
std::string& TestChunk::Range ()
{
return this->range;
}
dash::metrics::HTTPTransactionType TestChunk::GetType()
{
return dash::metrics::Other;
}
| 1,615 | 23.484848 | 132 |
cpp
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash_networkpart_test/PersistentHTTPConnection.h
|
/*
* PersistentHTTPConnection.h
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#ifndef PERSISTENTHTTPCONNECTION_H_
#define PERSISTENTHTTPCONNECTION_H_
#include "HTTPConnection.h"
#include "HTTPChunk.h"
#include "../libdash/source/portable/MultiThreading.h"
#include <queue>
#define RETRY 5
namespace libdashtest
{
class PersistentHTTPConnection : public HTTPConnection
{
public:
PersistentHTTPConnection ();
virtual ~PersistentHTTPConnection ();
virtual int Peek (uint8_t *data, size_t len, dash::network::IChunk *chunk);
virtual int Read (uint8_t *data, size_t len, dash::network::IChunk *chunk);
virtual bool Init (dash::network::IChunk *chunk);
virtual bool Schedule (dash::network::IChunk *chunk);
private:
std::queue<HTTPChunk *> chunkQueue;
std::string hostname;
CRITICAL_SECTION monitorMutex;
CONDITION_VARIABLE chunkFinished;
uint64_t bytesDownloadedChunk;
protected:
virtual std::string PrepareRequest (dash::network::IChunk *chunk);
bool InitChunk (dash::network::IChunk *chunk);
bool Reconnect (dash::network::IChunk *chunk);
};
}
#endif /* PERSISTENTHTTPCONNECTION_H_ */
| 1,793 | 34.88 | 98 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash_networkpart_test/HTTPChunk.h
|
/*
* HTTPChunk.h
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#ifndef HTTPCHUNK_H_
#define HTTPCHUNK_H_
#include "IChunk.h"
namespace libdashtest
{
class HTTPChunk
{
public:
HTTPChunk (dash::network::IChunk *chunk);
virtual ~HTTPChunk ();
dash::network::IChunk* Chunk ();
uint64_t ContentLength () const;
uint64_t BytesLeft () const;
uint64_t BytesRead () const;
bool HeaderParsed () const;
void HeaderParsed (bool value);
void ContentLength (uint64_t length);
void BytesRead (uint64_t bytes);
void AddBytesRead (uint64_t bytes);
private:
dash::network::IChunk *chunk;
uint64_t contentLength;
uint64_t bytesLeft;
uint64_t bytesRead;
bool isHeaderParsed;
};
}
#endif /* HTTPCHUNK_H_ */
| 1,488 | 31.369565 | 79 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash_networkpart_test/HTTPConnection.h
|
/*
* HTTPConnection.h
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#ifndef HTTPCONNECTION_H_
#define HTTPCONNECTION_H_
#include "../libdash/source/portable/Networking.h"
#include "IConnection.h"
#include <sstream>
#include <stdint.h>
#define PEEKBUFFER 4096
namespace libdashtest
{
class HTTPConnection : public dash::network::IConnection
{
public:
HTTPConnection ();
virtual ~HTTPConnection ();
virtual bool Init (dash::network::IChunk *chunk);
virtual int Read (uint8_t *data, size_t len, dash::network::IChunk *chunk);
virtual int Peek (uint8_t *data, size_t len, dash::network::IChunk *chunk);
virtual double GetAverageDownloadingSpeed();
virtual double GetDownloadingTime();
virtual bool Schedule (dash::network::IChunk *chunk);
virtual void CloseSocket ();
/*
* IDASHMetrics
*/
const std::vector<dash::metrics::ITCPConnection *>& GetTCPConnectionList () const;
const std::vector<dash::metrics::IHTTPTransaction *>& GetHTTPTransactionList () const;
protected:
int httpSocket;
struct sockaddr_in addr;
struct hostent *hostent;
uint8_t *peekBuffer;
size_t peekBufferLen;
int contentLength;
bool isInit;
bool isScheduled;
std::vector<dash::metrics::ITCPConnection *> tcpConnections;
std::vector<dash::metrics::IHTTPTransaction *> httpTransactions;
virtual std::string PrepareRequest (dash::network::IChunk *chunk);
virtual bool SendData (std::string data);
virtual bool ParseHeader ();
virtual std::string ReadLine ();
virtual bool ConnectToHost (std::string host, int port);
};
}
#endif /* HTTPCONNECTION_H_ */
| 2,472 | 35.910448 | 101 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash_networkpart_test/PersistentHTTPConnection.cpp
|
/*
* PersistentHTTPConnection.cpp
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#include "PersistentHTTPConnection.h"
using namespace libdashtest;
using namespace dash::network;
PersistentHTTPConnection::PersistentHTTPConnection () :
HTTPConnection ()
{
InitializeConditionVariable (&this->chunkFinished);
InitializeCriticalSection (&this->monitorMutex);
}
PersistentHTTPConnection::~PersistentHTTPConnection ()
{
DeleteConditionVariable(&this->chunkFinished);
DeleteCriticalSection(&this->monitorMutex);
}
int PersistentHTTPConnection::Peek (uint8_t *data, size_t len, IChunk *chunk)
{
EnterCriticalSection(&this->monitorMutex);
while(this->chunkQueue.front()->Chunk() != chunk && this->chunkQueue.size() > 0)
SleepConditionVariableCS(&this->chunkFinished, &this->monitorMutex, INFINITE);
HTTPChunk *front = this->chunkQueue.front();
if(this->chunkQueue.size() == 0)
{
LeaveCriticalSection(&this->monitorMutex);
return -1;
}
if(front->BytesLeft() == 0)
{
LeaveCriticalSection(&this->monitorMutex);
return 0;
}
if(front->HeaderParsed() == false)
{
this->ParseHeader();
front->HeaderParsed(true);
front->ContentLength(this->contentLength);
}
if(len > front->BytesLeft())
len = (size_t) front->BytesLeft();
size_t ret = HTTPConnection::Peek(data, len, chunk);
LeaveCriticalSection(&this->monitorMutex);
return ret;
}
int PersistentHTTPConnection::Read (uint8_t *data, size_t len, IChunk *chunk)
{
EnterCriticalSection(&this->monitorMutex);
while(this->chunkQueue.front()->Chunk() != chunk && this->chunkQueue.size() > 0)
SleepConditionVariableCS(&this->chunkFinished, &this->monitorMutex, INFINITE);
HTTPChunk *front = this->chunkQueue.front();
if(this->chunkQueue.size() == 0)
{
LeaveCriticalSection(&this->monitorMutex);
return -1;
}
if(front->HeaderParsed() == false)
{
this->ParseHeader();
front->HeaderParsed(true);
front->ContentLength(this->contentLength);
}
if(front->BytesLeft() == 0)
{
LeaveCriticalSection(&this->monitorMutex);
delete(front);
this->chunkQueue.pop();
WakeAllConditionVariable(&this->chunkFinished);
return 0;
}
if(len > front->BytesLeft())
len = (size_t) front->BytesLeft();
size_t ret = HTTPConnection::Read(data, len, chunk);
if(ret > 0)
front->AddBytesRead(ret);
LeaveCriticalSection(&this->monitorMutex);
return ret;
}
std::string PersistentHTTPConnection::PrepareRequest (IChunk *chunk)
{
std::string request;
if(!chunk->HasByteRange())
{
request = "GET " + chunk->Path() + " HTTP/1.1" + "\r\n" +
"Host: " + chunk->Host() + "\r\n\r\n";
}
else
{
std::stringstream req;
req << "GET " << chunk->Path() << " HTTP/1.1\r\n" <<
"Host: " << chunk->Host() << "\r\n" <<
"Range: bytes=" << chunk->StartByte() << "-" << chunk->EndByte() << "\r\n\r\n";
request = req.str();
}
return request;
}
bool PersistentHTTPConnection::Init (IChunk *chunk)
{
if(this->isInit && chunk->Host() != this->hostname)
return false;
if(this->isInit && chunk->Host() == this->hostname)
return true;
if(!this->ConnectToHost(chunk->Host(), chunk->Port()))
return false;
this->hostname = chunk->Host();
this->isInit = true;
return this->isInit;
}
bool PersistentHTTPConnection::Schedule (IChunk *chunk)
{
if(chunk->Host() != this->hostname)
return false;
if(!this->isInit)
return false;
if(this->SendData(this->PrepareRequest(chunk)))
{
this->chunkQueue.push(new HTTPChunk(chunk));
return true;
}
return false;
}
bool PersistentHTTPConnection::InitChunk (IChunk *chunk)
{
if(this->ParseHeader())
return true;
if(!this->Reconnect(chunk))
return false;
if(this->ParseHeader())
return true;
return false;
}
bool PersistentHTTPConnection::Reconnect (IChunk *chunk)
{
int retry = 0;
std::string request = this->PrepareRequest(chunk);
while(retry < RETRY)
{
if(this->ConnectToHost(chunk->Host(), chunk->Port()))
if(this->SendData(request))
return true;
retry++;
}
return false;
}
| 5,038 | 26.237838 | 106 |
cpp
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash_networkpart_test/TestChunk.h
|
/*
* TestChunk.h
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#ifndef TESTCHUNK_H_
#define TESTCHUNK_H_
#include "IChunk.h"
namespace libdashtest
{
class TestChunk : public dash::network::IChunk
{
public:
TestChunk (std::string host, size_t port, std::string path, size_t startbyte, size_t endbyte, bool hasByteRange);
virtual ~TestChunk ();
virtual std::string& AbsoluteURI ();
virtual std::string& Host ();
virtual size_t Port ();
virtual std::string& Path ();
virtual std::string& Range ();
virtual size_t StartByte ();
virtual size_t EndByte ();
virtual bool HasByteRange ();
virtual dash::metrics::HTTPTransactionType GetType();
private:
std::string uri;
std::string host;
size_t port;
std::string path;
std::string range;
size_t startbyte;
size_t endbyte;
bool hasByteRange;
};
}
#endif /* TESTCHUNK_H_ */
| 1,620 | 33.489362 | 135 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash_networkpart_test/HTTPChunk.cpp
|
/*
* HTTPChunk.cpp
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#include "HTTPChunk.h"
using namespace libdashtest;
using namespace dash::network;
HTTPChunk::HTTPChunk (IChunk *chunk) :
chunk (chunk),
contentLength (0),
isHeaderParsed (false),
bytesLeft (0),
bytesRead (0)
{
}
HTTPChunk::~HTTPChunk ()
{
}
IChunk* HTTPChunk::Chunk ()
{
return this->chunk;
}
uint64_t HTTPChunk::ContentLength () const
{
return this->contentLength;
}
bool HTTPChunk::HeaderParsed () const
{
return this->isHeaderParsed;
}
void HTTPChunk::HeaderParsed (bool value)
{
this->isHeaderParsed = value;
}
void HTTPChunk::ContentLength (uint64_t length)
{
this->contentLength = length;
this->bytesLeft = length;
}
void HTTPChunk::AddBytesRead (uint64_t bytes)
{
this->bytesRead += bytes;
this->bytesLeft -= bytes;
}
void HTTPChunk::BytesRead (uint64_t bytes)
{
this->bytesRead = bytes;
this->bytesLeft = this->contentLength - bytes;
}
uint64_t HTTPChunk::BytesRead () const
{
return this->bytesRead;
}
uint64_t HTTPChunk::BytesLeft () const
{
return this->bytesLeft;
}
| 1,662 | 23.455882 | 79 |
cpp
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libdash_networkpart_test/libdash_networkpart_test.cpp
|
/*
* libdash_networkpart_test.cpp
*****************************************************************************
* Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
*
* Email: [email protected]
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*****************************************************************************/
#include "libdash.h"
#include "TestChunk.h"
#include "PersistentHTTPConnection.h"
#include <iostream>
#include <fstream>
#if defined _WIN32 || defined _WIN64
#include <Windows.h>
#endif
using namespace dash;
using namespace dash::network;
using namespace libdashtest;
using namespace std;
void download(IConnection *connection, IChunk *chunk, ofstream *file)
{
int len = 32768;
uint8_t *p_data = new uint8_t[32768];
int ret = 0;
do
{
ret = connection->Read(p_data, len, chunk);
if(ret > 0)
file->write((char *)p_data, ret);
}while(ret > 0);
}
int main()
{
IDASHManager *manager = CreateDashManager();
HTTPConnection *httpconnection = new HTTPConnection();
TestChunk test1chunk("www-itec.uni-klu.ac.at", 80, "/~cmueller/libdashtest/network/test1.txt", 0, 0, false);
TestChunk test2chunk("www-itec.uni-klu.ac.at", 80, "/~cmueller/libdashtest/network/sintel_trailer-480p.mp4", 0, 0, false);
httpconnection->Init(&test1chunk);
httpconnection->Schedule(&test1chunk);
ofstream file;
std::cout << "*****************************************" << std::endl;
std::cout << "* Download files with external HTTP 1.0 *" << std::endl;
std::cout << "*****************************************" << std::endl;
std::cout << "Testing download of text file:\t";
file.open("test1_http_1_0.txt", ios::out | ios::binary);
download(httpconnection, &test1chunk, &file);
file.close();
std::cout << "finished!" << std::endl;
delete(httpconnection);
httpconnection = new HTTPConnection();
httpconnection->Init(&test2chunk);
httpconnection->Schedule(&test2chunk);
std::cout << "Testing download of video file:\t";
file.open("sintel_trailer-480p_http_1_0.mp4", ios::out | ios::binary);
download(httpconnection, &test2chunk, &file);
file.close();
std::cout << "finished!" << std::endl << std::endl;
std::cout << "*****************************************" << std::endl;
std::cout << "* Download files with external HTTP 1.1 *" << std::endl;
std::cout << "*****************************************" << std::endl;
std::cout << "Testing download of text file:\t";
PersistentHTTPConnection *peristenthttpconnection = new PersistentHTTPConnection();
peristenthttpconnection->Init(&test1chunk);
peristenthttpconnection->Schedule(&test1chunk);
file.open("test1_http_1_1.txt", ios::out | ios::binary);
download(peristenthttpconnection, &test1chunk, &file);
file.close();
std::cout << "finished!" << std::endl;
std::cout << "Testing download of video file:\t";
peristenthttpconnection->Schedule(&test2chunk);
file.open("sintel_trailer-480p_http_1_1.mp4", ios::out | ios::binary);
download(peristenthttpconnection, &test2chunk, &file);
file.close();
std::cout << "finished!" << std::endl << std::endl;
delete(peristenthttpconnection);
getchar();
}
| 3,413 | 34.195876 | 126 |
cpp
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/liblog/lib/log.h
|
#ifndef LOGDEFINITIONFILE__H
#define LOGDEFINITIONFILE__H
//#define LOG_BUILD
#include <stdio.h>
#include <pthread.h>
#include <errno.h>
#include <stdlib.h>
#include <iostream>
#include <unistd.h>
#include <chrono>
#include <ratio>
#ifdef LOG_BUILD
//Logging time is done here
//format of the logging would be: "[timestamp_since_start(in seconds)] logging message"
using duration_in_seconds = std::chrono::duration<double, std::ratio<1,1> >;
namespace sampleplayer
{
namespace log
{
extern std::chrono::time_point<std::chrono::system_clock> m_start_time;
extern int flushThreshold;
extern char *loggingBuffer;
extern int loggingPosition;
extern pthread_mutex_t logMutex;
extern pthread_cond_t loggingCond;
extern pthread_t * logTh;
extern const char* logFile;
extern void Init();
extern void Stop();
extern void* LogStart(void * data);
extern void Start(const char* data);
}
}
//We need this to flush the log after the video ends (or when the user stops the video)
#define FlushLog() do { sampleplayer::log::Stop(); \
pthread_join(*(sampleplayer::log::logTh), NULL); \
sampleplayer::log::Start(sampleplayer::log::logFile); \
} while(0)
#define L(...) do { double now = std::chrono::duration_cast<duration_in_seconds>(std::chrono::system_clock::now() - sampleplayer::log::m_start_time).count();\
pthread_mutex_lock(&(sampleplayer::log::logMutex)); \
sampleplayer::log::loggingPosition += sprintf(sampleplayer::log::loggingBuffer + sampleplayer::log::loggingPosition, "[%f]", now); \
sampleplayer::log::loggingPosition += sprintf(sampleplayer::log::loggingBuffer + sampleplayer::log::loggingPosition, __VA_ARGS__); \
pthread_cond_broadcast(&(sampleplayer::log::loggingCond)); \
pthread_mutex_unlock(&(sampleplayer::log::logMutex)); \
} while(0)
#else
#define FlushLog() do {} while(0)
#define L(...) do {} while(0)
#endif //LOG_BUILD
#endif //LOGDEFINITIONFILE__H
| 1,965 | 31.229508 | 159 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/liblog/lib/log.cpp
|
#ifndef LOGGINGTHREAD__H
#define LOGGINGTHREAD__H
#include "log.h"
#ifdef LOG_BUILD
namespace sampleplayer
{
namespace log
{
std::chrono::time_point<std::chrono::system_clock> m_start_time;
int flushThreshold;
char *loggingBuffer;
int loggingPosition;
pthread_mutex_t logMutex;
pthread_cond_t loggingCond;
static volatile bool isRunning;
pthread_t * logTh;
const char* logFile;
void Init()
{
loggingBuffer = (char *)calloc(4096,sizeof(char));
flushThreshold = 3000;
loggingPosition = 0;
pthread_mutex_init(&(logMutex),NULL);
pthread_cond_init(&(loggingCond), NULL);
isRunning = true;
m_start_time = std::chrono::system_clock::now();
}
void Start(const char* data)
{
Init();
logTh = (pthread_t*)malloc(sizeof(pthread_t));
if (!logTh)
{
std::cerr << "Error allocating thread." << std::endl;
logTh = NULL;
}
if(int err = pthread_create(logTh, NULL, sampleplayer::log::LogStart, (void *)data))
{
std::cerr << "Error creating the thread" << std::endl;
logTh = NULL;
}
}
void* LogStart(void * data)
{
logFile = (data == NULL) ? "log" : (char*) data;
while(isRunning)
{
pthread_mutex_lock(&(logMutex));
while(isRunning && loggingPosition < flushThreshold)
{
pthread_cond_wait(&(loggingCond), &(logMutex));
}
FILE *fp;
fp = fopen(logFile, "a");
fprintf(fp,"%s", loggingBuffer);
fclose(fp);
loggingPosition = 0;
pthread_mutex_unlock(&(logMutex));
}
}
void Stop()
{
isRunning = false;
pthread_cond_signal(&(loggingCond));
}
}
}
#else
namespace sampleplayer
{
namespace log
{
void Init() {}
void Start() {}
void* LogStart() {}
void Stop() {}
}
}
#endif //LOG_BUILD
#endif //LOGGINGTHREAD__H
| 1,768 | 19.102273 | 87 |
cpp
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/liblog/include/log/log.h
|
#ifndef LOGDEFINITIONFILE__H
#define LOGDEFINITIONFILE__H
//#define LOG_BUILD
#include <stdio.h>
#include <pthread.h>
#include <errno.h>
#include <stdlib.h>
#include <iostream>
#include <unistd.h>
#include <chrono>
#include <ratio>
#ifdef LOG_BUILD
//Logging time is done here
//format of the logging would be: "[timestamp_since_start(in seconds)] logging message"
using duration_in_seconds = std::chrono::duration<double, std::ratio<1,1> >;
namespace sampleplayer
{
namespace log
{
extern std::chrono::time_point<std::chrono::system_clock> m_start_time;
extern int flushThreshold;
extern char *loggingBuffer;
extern int loggingPosition;
extern pthread_mutex_t logMutex;
extern pthread_cond_t loggingCond;
extern pthread_t * logTh;
extern const char* logFile;
extern void Init();
extern void Stop();
extern void* LogStart(void * data);
extern void Start(const char* data);
}
}
//We need this to flush the log after the video ends (or when the user stops the video)
#define FlushLog() do { sampleplayer::log::Stop(); \
pthread_join(*(sampleplayer::log::logTh), NULL); \
sampleplayer::log::Start(sampleplayer::log::logFile); \
} while(0)
#define L(...) do { double now = std::chrono::duration_cast<duration_in_seconds>(std::chrono::system_clock::now() - sampleplayer::log::m_start_time).count();\
pthread_mutex_lock(&(sampleplayer::log::logMutex)); \
sampleplayer::log::loggingPosition += sprintf(sampleplayer::log::loggingBuffer + sampleplayer::log::loggingPosition, "%f\t", now); \
sampleplayer::log::loggingPosition += sprintf(sampleplayer::log::loggingBuffer + sampleplayer::log::loggingPosition, __VA_ARGS__); \
pthread_cond_broadcast(&(sampleplayer::log::loggingCond)); \
pthread_mutex_unlock(&(sampleplayer::log::logMutex)); \
} while(0)
#else
#ifndef DEBUG_BUILD
#define FlushLog() do {} while(0)
#define L(...) do {} while(0)
#else
#define FlushLog() do {} while(0)
#define L(...) do {printf(__VA_ARGS__); } while(0)
#endif //DEBUG_BUILD
#endif //LOG_BUILD
#endif //LOGDEFINITIONFILE__H
| 2,098 | 31.292308 | 159 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/zlib/include/zconf.h
|
/* zconf.h -- configuration of the zlib compression library
* Copyright (C) 1995-2005 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* @(#) $Id$ */
#ifndef ZCONF_H
#define ZCONF_H
/*
* If you *really* need a unique prefix for all types and library functions,
* compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
*/
#ifdef Z_PREFIX
# define deflateInit_ z_deflateInit_
# define deflate z_deflate
# define deflateEnd z_deflateEnd
# define inflateInit_ z_inflateInit_
# define inflate z_inflate
# define inflateEnd z_inflateEnd
# define deflateInit2_ z_deflateInit2_
# define deflateSetDictionary z_deflateSetDictionary
# define deflateCopy z_deflateCopy
# define deflateReset z_deflateReset
# define deflateParams z_deflateParams
# define deflateBound z_deflateBound
# define deflatePrime z_deflatePrime
# define inflateInit2_ z_inflateInit2_
# define inflateSetDictionary z_inflateSetDictionary
# define inflateSync z_inflateSync
# define inflateSyncPoint z_inflateSyncPoint
# define inflateCopy z_inflateCopy
# define inflateReset z_inflateReset
# define inflateBack z_inflateBack
# define inflateBackEnd z_inflateBackEnd
# define compress z_compress
# define compress2 z_compress2
# define compressBound z_compressBound
# define uncompress z_uncompress
# define adler32 z_adler32
# define crc32 z_crc32
# define get_crc_table z_get_crc_table
# define zError z_zError
# define alloc_func z_alloc_func
# define free_func z_free_func
# define in_func z_in_func
# define out_func z_out_func
# define Byte z_Byte
# define uInt z_uInt
# define uLong z_uLong
# define Bytef z_Bytef
# define charf z_charf
# define intf z_intf
# define uIntf z_uIntf
# define uLongf z_uLongf
# define voidpf z_voidpf
# define voidp z_voidp
#endif
#if defined(__MSDOS__) && !defined(MSDOS)
# define MSDOS
#endif
#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
# define OS2
#endif
#if defined(_WINDOWS) && !defined(WINDOWS)
# define WINDOWS
#endif
#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)
# ifndef WIN32
# define WIN32
# endif
#endif
#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
# ifndef SYS16BIT
# define SYS16BIT
# endif
# endif
#endif
/*
* Compile with -DMAXSEG_64K if the alloc function cannot allocate more
* than 64k bytes at a time (needed on systems with 16-bit int).
*/
#ifdef SYS16BIT
# define MAXSEG_64K
#endif
#ifdef MSDOS
# define UNALIGNED_OK
#endif
#ifdef __STDC_VERSION__
# ifndef STDC
# define STDC
# endif
# if __STDC_VERSION__ >= 199901L
# ifndef STDC99
# define STDC99
# endif
# endif
#endif
#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
# define STDC
#endif
#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
# define STDC
#endif
#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
# define STDC
#endif
#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
# define STDC
#endif
#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */
# define STDC
#endif
#ifndef STDC
# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
# define const /* note: need a more gentle solution here */
# endif
#endif
/* Some Mac compilers merge all .h files incorrectly: */
#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
# define NO_DUMMY_DECL
#endif
/* Maximum value for memLevel in deflateInit2 */
#ifndef MAX_MEM_LEVEL
# ifdef MAXSEG_64K
# define MAX_MEM_LEVEL 8
# else
# define MAX_MEM_LEVEL 9
# endif
#endif
/* Maximum value for windowBits in deflateInit2 and inflateInit2.
* WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
* created by gzip. (Files created by minigzip can still be extracted by
* gzip.)
*/
#ifndef MAX_WBITS
# define MAX_WBITS 15 /* 32K LZ77 window */
#endif
/* The memory requirements for deflate are (in bytes):
(1 << (windowBits+2)) + (1 << (memLevel+9))
that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
plus a few kilobytes for small objects. For example, if you want to reduce
the default memory requirements from 256K to 128K, compile with
make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
Of course this will generally degrade compression (there's no free lunch).
The memory requirements for inflate are (in bytes) 1 << windowBits
that is, 32K for windowBits=15 (default value) plus a few kilobytes
for small objects.
*/
/* Type declarations */
#ifndef OF /* function prototypes */
# ifdef STDC
# define OF(args) args
# else
# define OF(args) ()
# endif
#endif
/* The following definitions for FAR are needed only for MSDOS mixed
* model programming (small or medium model with some far allocations).
* This was tested only with MSC; for other MSDOS compilers you may have
* to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
* just define FAR to be empty.
*/
#ifdef SYS16BIT
# if defined(M_I86SM) || defined(M_I86MM)
/* MSC small or medium model */
# define SMALL_MEDIUM
# ifdef _MSC_VER
# define FAR _far
# else
# define FAR far
# endif
# endif
# if (defined(__SMALL__) || defined(__MEDIUM__))
/* Turbo C small or medium model */
# define SMALL_MEDIUM
# ifdef __BORLANDC__
# define FAR _far
# else
# define FAR far
# endif
# endif
#endif
#if defined(WINDOWS) || defined(WIN32)
/* If building or using zlib as a DLL, define ZLIB_DLL.
* This is not mandatory, but it offers a little performance increase.
*/
# ifdef ZLIB_DLL
# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
# ifdef ZLIB_INTERNAL
# define ZEXTERN extern __declspec(dllexport)
# else
# define ZEXTERN extern __declspec(dllimport)
# endif
# endif
# endif /* ZLIB_DLL */
/* If building or using zlib with the WINAPI/WINAPIV calling convention,
* define ZLIB_WINAPI.
* Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
*/
# ifdef ZLIB_WINAPI
# ifdef FAR
# undef FAR
# endif
# include <windows.h>
/* No need for _export, use ZLIB.DEF instead. */
/* For complete Windows compatibility, use WINAPI, not __stdcall. */
# define ZEXPORT WINAPI
# ifdef WIN32
# define ZEXPORTVA WINAPIV
# else
# define ZEXPORTVA FAR CDECL
# endif
# endif
#endif
#if defined (__BEOS__)
# ifdef ZLIB_DLL
# ifdef ZLIB_INTERNAL
# define ZEXPORT __declspec(dllexport)
# define ZEXPORTVA __declspec(dllexport)
# else
# define ZEXPORT __declspec(dllimport)
# define ZEXPORTVA __declspec(dllimport)
# endif
# endif
#endif
#ifndef ZEXTERN
# define ZEXTERN extern
#endif
#ifndef ZEXPORT
# define ZEXPORT
#endif
#ifndef ZEXPORTVA
# define ZEXPORTVA
#endif
#ifndef FAR
# define FAR
#endif
#if !defined(__MACTYPES__)
typedef unsigned char Byte; /* 8 bits */
#endif
typedef unsigned int uInt; /* 16 bits or more */
typedef unsigned long uLong; /* 32 bits or more */
#ifdef SMALL_MEDIUM
/* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
# define Bytef Byte FAR
#else
typedef Byte FAR Bytef;
#endif
typedef char FAR charf;
typedef int FAR intf;
typedef uInt FAR uIntf;
typedef uLong FAR uLongf;
#ifdef STDC
typedef void const *voidpc;
typedef void FAR *voidpf;
typedef void *voidp;
#else
typedef Byte const *voidpc;
typedef Byte FAR *voidpf;
typedef Byte *voidp;
#endif
#if 1 /* HAVE_UNISTD_H -- this line is updated by ./configure */
# include <sys/types.h> /* for off_t */
# include <unistd.h> /* for SEEK_* and off_t */
# ifdef VMS
# include <unixio.h> /* for off_t */
# endif
# define z_off_t off_t
#endif
#ifndef SEEK_SET
# define SEEK_SET 0 /* Seek from beginning of file. */
# define SEEK_CUR 1 /* Seek from current position. */
# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
#endif
#ifndef z_off_t
# define z_off_t long
#endif
#if defined(__OS400__)
# define NO_vsnprintf
#endif
#if defined(__MVS__)
# define NO_vsnprintf
# ifdef FAR
# undef FAR
# endif
#endif
/* MVS linker does not support external names larger than 8 bytes */
#if defined(__MVS__)
# pragma map(deflateInit_,"DEIN")
# pragma map(deflateInit2_,"DEIN2")
# pragma map(deflateEnd,"DEEND")
# pragma map(deflateBound,"DEBND")
# pragma map(inflateInit_,"ININ")
# pragma map(inflateInit2_,"ININ2")
# pragma map(inflateEnd,"INEND")
# pragma map(inflateSync,"INSY")
# pragma map(inflateSetDictionary,"INSEDI")
# pragma map(compressBound,"CMBND")
# pragma map(inflate_table,"INTABL")
# pragma map(inflate_fast,"INFA")
# pragma map(inflate_copyright,"INCOPY")
#endif
#endif /* ZCONF_H */
| 9,544 | 27.663664 | 78 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/zlib/include/zlib.h
|
/* zlib.h -- interface of the 'zlib' general purpose compression library
version 1.2.3, July 18th, 2005
Copyright (C) 1995-2005 Jean-loup Gailly and Mark Adler
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Jean-loup Gailly Mark Adler
[email protected] [email protected]
The data format used by the zlib library is described by RFCs (Request for
Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt
(zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
*/
#ifndef ZLIB_H
#define ZLIB_H
#include "zconf.h"
#ifdef __cplusplus
extern "C" {
#endif
#define ZLIB_VERSION "1.2.3"
#define ZLIB_VERNUM 0x1230
/*
The 'zlib' compression library provides in-memory compression and
decompression functions, including integrity checks of the uncompressed
data. This version of the library supports only one compression method
(deflation) but other algorithms will be added later and will have the same
stream interface.
Compression can be done in a single step if the buffers are large
enough (for example if an input file is mmap'ed), or can be done by
repeated calls of the compression function. In the latter case, the
application must provide more input and/or consume the output
(providing more output space) before each call.
The compressed data format used by default by the in-memory functions is
the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped
around a deflate stream, which is itself documented in RFC 1951.
The library also supports reading and writing files in gzip (.gz) format
with an interface similar to that of stdio using the functions that start
with "gz". The gzip format is different from the zlib format. gzip is a
gzip wrapper, documented in RFC 1952, wrapped around a deflate stream.
This library can optionally read and write gzip streams in memory as well.
The zlib format was designed to be compact and fast for use in memory
and on communications channels. The gzip format was designed for single-
file compression on file systems, has a larger header than zlib to maintain
directory information, and uses a different, slower check method than zlib.
The library does not install any signal handler. The decoder checks
the consistency of the compressed data, so the library should never
crash even in case of corrupted input.
*/
typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size));
typedef void (*free_func) OF((voidpf opaque, voidpf address));
struct internal_state;
typedef struct z_stream_s {
Bytef *next_in; /* next input byte */
uInt avail_in; /* number of bytes available at next_in */
uLong total_in; /* total nb of input bytes read so far */
Bytef *next_out; /* next output byte should be put there */
uInt avail_out; /* remaining free space at next_out */
uLong total_out; /* total nb of bytes output so far */
char *msg; /* last error message, NULL if no error */
struct internal_state FAR *state; /* not visible by applications */
alloc_func zalloc; /* used to allocate the internal state */
free_func zfree; /* used to free the internal state */
voidpf opaque; /* private data object passed to zalloc and zfree */
int data_type; /* best guess about the data type: binary or text */
uLong adler; /* adler32 value of the uncompressed data */
uLong reserved; /* reserved for future use */
} z_stream;
typedef z_stream FAR *z_streamp;
/*
gzip header information passed to and from zlib routines. See RFC 1952
for more details on the meanings of these fields.
*/
typedef struct gz_header_s {
int text; /* true if compressed data believed to be text */
uLong time; /* modification time */
int xflags; /* extra flags (not used when writing a gzip file) */
int os; /* operating system */
Bytef *extra; /* pointer to extra field or Z_NULL if none */
uInt extra_len; /* extra field length (valid if extra != Z_NULL) */
uInt extra_max; /* space at extra (only when reading header) */
Bytef *name; /* pointer to zero-terminated file name or Z_NULL */
uInt name_max; /* space at name (only when reading header) */
Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */
uInt comm_max; /* space at comment (only when reading header) */
int hcrc; /* true if there was or will be a header crc */
int done; /* true when done reading gzip header (not used
when writing a gzip file) */
} gz_header;
typedef gz_header FAR *gz_headerp;
/*
The application must update next_in and avail_in when avail_in has
dropped to zero. It must update next_out and avail_out when avail_out
has dropped to zero. The application must initialize zalloc, zfree and
opaque before calling the init function. All other fields are set by the
compression library and must not be updated by the application.
The opaque value provided by the application will be passed as the first
parameter for calls of zalloc and zfree. This can be useful for custom
memory management. The compression library attaches no meaning to the
opaque value.
zalloc must return Z_NULL if there is not enough memory for the object.
If zlib is used in a multi-threaded application, zalloc and zfree must be
thread safe.
On 16-bit systems, the functions zalloc and zfree must be able to allocate
exactly 65536 bytes, but will not be required to allocate more than this
if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS,
pointers returned by zalloc for objects of exactly 65536 bytes *must*
have their offset normalized to zero. The default allocation function
provided by this library ensures this (see zutil.c). To reduce memory
requirements and avoid any allocation of 64K objects, at the expense of
compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h).
The fields total_in and total_out can be used for statistics or
progress reports. After compression, total_in holds the total size of
the uncompressed data and may be saved for use in the decompressor
(particularly if the decompressor wants to decompress everything in
a single step).
*/
/* constants */
#define Z_NO_FLUSH 0
#define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */
#define Z_SYNC_FLUSH 2
#define Z_FULL_FLUSH 3
#define Z_FINISH 4
#define Z_BLOCK 5
/* Allowed flush values; see deflate() and inflate() below for details */
#define Z_OK 0
#define Z_STREAM_END 1
#define Z_NEED_DICT 2
#define Z_ERRNO (-1)
#define Z_STREAM_ERROR (-2)
#define Z_DATA_ERROR (-3)
#define Z_MEM_ERROR (-4)
#define Z_BUF_ERROR (-5)
#define Z_VERSION_ERROR (-6)
/* Return codes for the compression/decompression functions. Negative
* values are errors, positive values are used for special but normal events.
*/
#define Z_NO_COMPRESSION 0
#define Z_BEST_SPEED 1
#define Z_BEST_COMPRESSION 9
#define Z_DEFAULT_COMPRESSION (-1)
/* compression levels */
#define Z_FILTERED 1
#define Z_HUFFMAN_ONLY 2
#define Z_RLE 3
#define Z_FIXED 4
#define Z_DEFAULT_STRATEGY 0
/* compression strategy; see deflateInit2() below for details */
#define Z_BINARY 0
#define Z_TEXT 1
#define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */
#define Z_UNKNOWN 2
/* Possible values of the data_type field (though see inflate()) */
#define Z_DEFLATED 8
/* The deflate compression method (the only one supported in this version) */
#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */
#define zlib_version zlibVersion()
/* for compatibility with versions < 1.0.2 */
/* basic functions */
ZEXTERN const char * ZEXPORT zlibVersion OF((void));
/* The application can compare zlibVersion and ZLIB_VERSION for consistency.
If the first character differs, the library code actually used is
not compatible with the zlib.h header file used by the application.
This check is automatically made by deflateInit and inflateInit.
*/
/*
ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level));
Initializes the internal stream state for compression. The fields
zalloc, zfree and opaque must be initialized before by the caller.
If zalloc and zfree are set to Z_NULL, deflateInit updates them to
use default allocation functions.
The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:
1 gives best speed, 9 gives best compression, 0 gives no compression at
all (the input data is simply copied a block at a time).
Z_DEFAULT_COMPRESSION requests a default compromise between speed and
compression (currently equivalent to level 6).
deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not
enough memory, Z_STREAM_ERROR if level is not a valid compression level,
Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible
with the version assumed by the caller (ZLIB_VERSION).
msg is set to null if there is no error message. deflateInit does not
perform any compression: this will be done by deflate().
*/
ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
/*
deflate compresses as much data as possible, and stops when the input
buffer becomes empty or the output buffer becomes full. It may introduce some
output latency (reading input without producing any output) except when
forced to flush.
The detailed semantics are as follows. deflate performs one or both of the
following actions:
- Compress more input starting at next_in and update next_in and avail_in
accordingly. If not all input can be processed (because there is not
enough room in the output buffer), next_in and avail_in are updated and
processing will resume at this point for the next call of deflate().
- Provide more output starting at next_out and update next_out and avail_out
accordingly. This action is forced if the parameter flush is non zero.
Forcing flush frequently degrades the compression ratio, so this parameter
should be set only when necessary (in interactive applications).
Some output may be provided even if flush is not set.
Before the call of deflate(), the application should ensure that at least
one of the actions is possible, by providing more input and/or consuming
more output, and updating avail_in or avail_out accordingly; avail_out
should never be zero before the call. The application can consume the
compressed output when it wants, for example when the output buffer is full
(avail_out == 0), or after each call of deflate(). If deflate returns Z_OK
and with zero avail_out, it must be called again after making room in the
output buffer because there might be more output pending.
Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to
decide how much data to accumualte before producing output, in order to
maximize compression.
If the parameter flush is set to Z_SYNC_FLUSH, all pending output is
flushed to the output buffer and the output is aligned on a byte boundary, so
that the decompressor can get all input data available so far. (In particular
avail_in is zero after the call if enough output space has been provided
before the call.) Flushing may degrade compression for some compression
algorithms and so it should be used only when necessary.
If flush is set to Z_FULL_FLUSH, all output is flushed as with
Z_SYNC_FLUSH, and the compression state is reset so that decompression can
restart from this point if previous compressed data has been damaged or if
random access is desired. Using Z_FULL_FLUSH too often can seriously degrade
compression.
If deflate returns with avail_out == 0, this function must be called again
with the same value of the flush parameter and more output space (updated
avail_out), until the flush is complete (deflate returns with non-zero
avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that
avail_out is greater than six to avoid repeated flush markers due to
avail_out == 0 on return.
If the parameter flush is set to Z_FINISH, pending input is processed,
pending output is flushed and deflate returns with Z_STREAM_END if there
was enough output space; if deflate returns with Z_OK, this function must be
called again with Z_FINISH and more output space (updated avail_out) but no
more input data, until it returns with Z_STREAM_END or an error. After
deflate has returned Z_STREAM_END, the only possible operations on the
stream are deflateReset or deflateEnd.
Z_FINISH can be used immediately after deflateInit if all the compression
is to be done in a single step. In this case, avail_out must be at least
the value returned by deflateBound (see below). If deflate does not return
Z_STREAM_END, then it must be called again as described above.
deflate() sets strm->adler to the adler32 checksum of all input read
so far (that is, total_in bytes).
deflate() may update strm->data_type if it can make a good guess about
the input data type (Z_BINARY or Z_TEXT). In doubt, the data is considered
binary. This field is only for information purposes and does not affect
the compression algorithm in any manner.
deflate() returns Z_OK if some progress has been made (more input
processed or more output produced), Z_STREAM_END if all input has been
consumed and all output has been produced (only when flush is set to
Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example
if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible
(for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not
fatal, and deflate() can be called again with more input and more output
space to continue compressing.
*/
ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm));
/*
All dynamically allocated data structures for this stream are freed.
This function discards any unprocessed input and does not flush any
pending output.
deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the
stream state was inconsistent, Z_DATA_ERROR if the stream was freed
prematurely (some input or output was discarded). In the error case,
msg may be set but then points to a static string (which must not be
deallocated).
*/
/*
ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));
Initializes the internal stream state for decompression. The fields
next_in, avail_in, zalloc, zfree and opaque must be initialized before by
the caller. If next_in is not Z_NULL and avail_in is large enough (the exact
value depends on the compression method), inflateInit determines the
compression method from the zlib header and allocates all data structures
accordingly; otherwise the allocation will be deferred to the first call of
inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to
use default allocation functions.
inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
version assumed by the caller. msg is set to null if there is no error
message. inflateInit does not perform any decompression apart from reading
the zlib header if present: this will be done by inflate(). (So next_in and
avail_in may be modified, but next_out and avail_out are unchanged.)
*/
ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
/*
inflate decompresses as much data as possible, and stops when the input
buffer becomes empty or the output buffer becomes full. It may introduce
some output latency (reading input without producing any output) except when
forced to flush.
The detailed semantics are as follows. inflate performs one or both of the
following actions:
- Decompress more input starting at next_in and update next_in and avail_in
accordingly. If not all input can be processed (because there is not
enough room in the output buffer), next_in is updated and processing
will resume at this point for the next call of inflate().
- Provide more output starting at next_out and update next_out and avail_out
accordingly. inflate() provides as much output as possible, until there
is no more input data or no more space in the output buffer (see below
about the flush parameter).
Before the call of inflate(), the application should ensure that at least
one of the actions is possible, by providing more input and/or consuming
more output, and updating the next_* and avail_* values accordingly.
The application can consume the uncompressed output when it wants, for
example when the output buffer is full (avail_out == 0), or after each
call of inflate(). If inflate returns Z_OK and with zero avail_out, it
must be called again after making room in the output buffer because there
might be more output pending.
The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH,
Z_FINISH, or Z_BLOCK. Z_SYNC_FLUSH requests that inflate() flush as much
output as possible to the output buffer. Z_BLOCK requests that inflate() stop
if and when it gets to the next deflate block boundary. When decoding the
zlib or gzip format, this will cause inflate() to return immediately after
the header and before the first block. When doing a raw inflate, inflate()
will go ahead and process the first block, and will return when it gets to
the end of that block, or when it runs out of data.
The Z_BLOCK option assists in appending to or combining deflate streams.
Also to assist in this, on return inflate() will set strm->data_type to the
number of unused bits in the last byte taken from strm->next_in, plus 64
if inflate() is currently decoding the last block in the deflate stream,
plus 128 if inflate() returned immediately after decoding an end-of-block
code or decoding the complete header up to just before the first byte of the
deflate stream. The end-of-block will not be indicated until all of the
uncompressed data from that block has been written to strm->next_out. The
number of unused bits may in general be greater than seven, except when
bit 7 of data_type is set, in which case the number of unused bits will be
less than eight.
inflate() should normally be called until it returns Z_STREAM_END or an
error. However if all decompression is to be performed in a single step
(a single call of inflate), the parameter flush should be set to
Z_FINISH. In this case all pending input is processed and all pending
output is flushed; avail_out must be large enough to hold all the
uncompressed data. (The size of the uncompressed data may have been saved
by the compressor for this purpose.) The next operation on this stream must
be inflateEnd to deallocate the decompression state. The use of Z_FINISH
is never required, but can be used to inform inflate that a faster approach
may be used for the single inflate() call.
In this implementation, inflate() always flushes as much output as
possible to the output buffer, and always uses the faster approach on the
first call. So the only effect of the flush parameter in this implementation
is on the return value of inflate(), as noted below, or when it returns early
because Z_BLOCK is used.
If a preset dictionary is needed after this call (see inflateSetDictionary
below), inflate sets strm->adler to the adler32 checksum of the dictionary
chosen by the compressor and returns Z_NEED_DICT; otherwise it sets
strm->adler to the adler32 checksum of all output produced so far (that is,
total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described
below. At the end of the stream, inflate() checks that its computed adler32
checksum is equal to that saved by the compressor and returns Z_STREAM_END
only if the checksum is correct.
inflate() will decompress and check either zlib-wrapped or gzip-wrapped
deflate data. The header type is detected automatically. Any information
contained in the gzip header is not retained, so applications that need that
information should instead use raw inflate, see inflateInit2() below, or
inflateBack() and perform their own processing of the gzip header and
trailer.
inflate() returns Z_OK if some progress has been made (more input processed
or more output produced), Z_STREAM_END if the end of the compressed data has
been reached and all uncompressed output has been produced, Z_NEED_DICT if a
preset dictionary is needed at this point, Z_DATA_ERROR if the input data was
corrupted (input stream not conforming to the zlib format or incorrect check
value), Z_STREAM_ERROR if the stream structure was inconsistent (for example
if next_in or next_out was NULL), Z_MEM_ERROR if there was not enough memory,
Z_BUF_ERROR if no progress is possible or if there was not enough room in the
output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and
inflate() can be called again with more input and more output space to
continue decompressing. If Z_DATA_ERROR is returned, the application may then
call inflateSync() to look for a good compression block if a partial recovery
of the data is desired.
*/
ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm));
/*
All dynamically allocated data structures for this stream are freed.
This function discards any unprocessed input and does not flush any
pending output.
inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state
was inconsistent. In the error case, msg may be set but then points to a
static string (which must not be deallocated).
*/
/* Advanced functions */
/*
The following functions are needed only in some special applications.
*/
/*
ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
int level,
int method,
int windowBits,
int memLevel,
int strategy));
This is another version of deflateInit with more compression options. The
fields next_in, zalloc, zfree and opaque must be initialized before by
the caller.
The method parameter is the compression method. It must be Z_DEFLATED in
this version of the library.
The windowBits parameter is the base two logarithm of the window size
(the size of the history buffer). It should be in the range 8..15 for this
version of the library. Larger values of this parameter result in better
compression at the expense of memory usage. The default value is 15 if
deflateInit is used instead.
windowBits can also be -8..-15 for raw deflate. In this case, -windowBits
determines the window size. deflate() will then generate raw deflate data
with no zlib header or trailer, and will not compute an adler32 check value.
windowBits can also be greater than 15 for optional gzip encoding. Add
16 to windowBits to write a simple gzip header and trailer around the
compressed data instead of a zlib wrapper. The gzip header will have no
file name, no extra data, no comment, no modification time (set to zero),
no header crc, and the operating system will be set to 255 (unknown). If a
gzip stream is being written, strm->adler is a crc32 instead of an adler32.
The memLevel parameter specifies how much memory should be allocated
for the internal compression state. memLevel=1 uses minimum memory but
is slow and reduces compression ratio; memLevel=9 uses maximum memory
for optimal speed. The default value is 8. See zconf.h for total memory
usage as a function of windowBits and memLevel.
The strategy parameter is used to tune the compression algorithm. Use the
value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a
filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no
string match), or Z_RLE to limit match distances to one (run-length
encoding). Filtered data consists mostly of small values with a somewhat
random distribution. In this case, the compression algorithm is tuned to
compress them better. The effect of Z_FILTERED is to force more Huffman
coding and less string matching; it is somewhat intermediate between
Z_DEFAULT and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as fast as
Z_HUFFMAN_ONLY, but give better compression for PNG image data. The strategy
parameter only affects the compression ratio but not the correctness of the
compressed output even if it is not set appropriately. Z_FIXED prevents the
use of dynamic Huffman codes, allowing for a simpler decoder for special
applications.
deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid
method). msg is set to null if there is no error message. deflateInit2 does
not perform any compression: this will be done by deflate().
*/
ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
const Bytef *dictionary,
uInt dictLength));
/*
Initializes the compression dictionary from the given byte sequence
without producing any compressed output. This function must be called
immediately after deflateInit, deflateInit2 or deflateReset, before any
call of deflate. The compressor and decompressor must use exactly the same
dictionary (see inflateSetDictionary).
The dictionary should consist of strings (byte sequences) that are likely
to be encountered later in the data to be compressed, with the most commonly
used strings preferably put towards the end of the dictionary. Using a
dictionary is most useful when the data to be compressed is short and can be
predicted with good accuracy; the data can then be compressed better than
with the default empty dictionary.
Depending on the size of the compression data structures selected by
deflateInit or deflateInit2, a part of the dictionary may in effect be
discarded, for example if the dictionary is larger than the window size in
deflate or deflate2. Thus the strings most likely to be useful should be
put at the end of the dictionary, not at the front. In addition, the
current implementation of deflate will use at most the window size minus
262 bytes of the provided dictionary.
Upon return of this function, strm->adler is set to the adler32 value
of the dictionary; the decompressor may later use this value to determine
which dictionary has been used by the compressor. (The adler32 value
applies to the whole dictionary even if only a subset of the dictionary is
actually used by the compressor.) If a raw deflate was requested, then the
adler32 value is not computed and strm->adler is not set.
deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a
parameter is invalid (such as NULL dictionary) or the stream state is
inconsistent (for example if deflate has already been called for this stream
or if the compression method is bsort). deflateSetDictionary does not
perform any compression: this will be done by deflate().
*/
ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
z_streamp source));
/*
Sets the destination stream as a complete copy of the source stream.
This function can be useful when several compression strategies will be
tried, for example when there are several ways of pre-processing the input
data with a filter. The streams that will be discarded should then be freed
by calling deflateEnd. Note that deflateCopy duplicates the internal
compression state which can be quite large, so this strategy is slow and
can consume lots of memory.
deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
(such as zalloc being NULL). msg is left unchanged in both source and
destination.
*/
ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm));
/*
This function is equivalent to deflateEnd followed by deflateInit,
but does not free and reallocate all the internal compression state.
The stream will keep the same compression level and any other attributes
that may have been set by deflateInit2.
deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
stream state was inconsistent (such as zalloc or state being NULL).
*/
ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
int level,
int strategy));
/*
Dynamically update the compression level and compression strategy. The
interpretation of level and strategy is as in deflateInit2. This can be
used to switch between compression and straight copy of the input data, or
to switch to a different kind of input data requiring a different
strategy. If the compression level is changed, the input available so far
is compressed with the old level (and may be flushed); the new level will
take effect only at the next call of deflate().
Before the call of deflateParams, the stream state must be set as for
a call of deflate(), since the currently available input may have to
be compressed and flushed. In particular, strm->avail_out must be non-zero.
deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source
stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR
if strm->avail_out was zero.
*/
ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm,
int good_length,
int max_lazy,
int nice_length,
int max_chain));
/*
Fine tune deflate's internal compression parameters. This should only be
used by someone who understands the algorithm used by zlib's deflate for
searching for the best matching string, and even then only by the most
fanatic optimizer trying to squeeze out the last compressed bit for their
specific input data. Read the deflate.c source code for the meaning of the
max_lazy, good_length, nice_length, and max_chain parameters.
deflateTune() can be called after deflateInit() or deflateInit2(), and
returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream.
*/
ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm,
uLong sourceLen));
/*
deflateBound() returns an upper bound on the compressed size after
deflation of sourceLen bytes. It must be called after deflateInit()
or deflateInit2(). This would be used to allocate an output buffer
for deflation in a single pass, and so would be called before deflate().
*/
ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm,
int bits,
int value));
/*
deflatePrime() inserts bits in the deflate output stream. The intent
is that this function is used to start off the deflate output with the
bits leftover from a previous deflate stream when appending to it. As such,
this function can only be used for raw deflate, and must be used before the
first deflate() call after a deflateInit2() or deflateReset(). bits must be
less than or equal to 16, and that many of the least significant bits of
value will be inserted in the output.
deflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source
stream state was inconsistent.
*/
ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm,
gz_headerp head));
/*
deflateSetHeader() provides gzip header information for when a gzip
stream is requested by deflateInit2(). deflateSetHeader() may be called
after deflateInit2() or deflateReset() and before the first call of
deflate(). The text, time, os, extra field, name, and comment information
in the provided gz_header structure are written to the gzip header (xflag is
ignored -- the extra flags are set according to the compression level). The
caller must assure that, if not Z_NULL, name and comment are terminated with
a zero byte, and that if extra is not Z_NULL, that extra_len bytes are
available there. If hcrc is true, a gzip header crc is included. Note that
the current versions of the command-line version of gzip (up through version
1.3.x) do not support header crc's, and will report that it is a "multi-part
gzip file" and give up.
If deflateSetHeader is not used, the default gzip header has text false,
the time set to zero, and os set to 255, with no extra, name, or comment
fields. The gzip header is returned to the default state by deflateReset().
deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
stream state was inconsistent.
*/
/*
ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
int windowBits));
This is another version of inflateInit with an extra parameter. The
fields next_in, avail_in, zalloc, zfree and opaque must be initialized
before by the caller.
The windowBits parameter is the base two logarithm of the maximum window
size (the size of the history buffer). It should be in the range 8..15 for
this version of the library. The default value is 15 if inflateInit is used
instead. windowBits must be greater than or equal to the windowBits value
provided to deflateInit2() while compressing, or it must be equal to 15 if
deflateInit2() was not used. If a compressed stream with a larger window
size is given as input, inflate() will return with the error code
Z_DATA_ERROR instead of trying to allocate a larger window.
windowBits can also be -8..-15 for raw inflate. In this case, -windowBits
determines the window size. inflate() will then process raw deflate data,
not looking for a zlib or gzip header, not generating a check value, and not
looking for any check values for comparison at the end of the stream. This
is for use with other formats that use the deflate compressed data format
such as zip. Those formats provide their own check values. If a custom
format is developed using the raw deflate format for compressed data, it is
recommended that a check value such as an adler32 or a crc32 be applied to
the uncompressed data as is done in the zlib, gzip, and zip formats. For
most applications, the zlib format should be used as is. Note that comments
above on the use in deflateInit2() applies to the magnitude of windowBits.
windowBits can also be greater than 15 for optional gzip decoding. Add
32 to windowBits to enable zlib and gzip decoding with automatic header
detection, or add 16 to decode only the gzip format (the zlib format will
return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is
a crc32 instead of an adler32.
inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
memory, Z_STREAM_ERROR if a parameter is invalid (such as a null strm). msg
is set to null if there is no error message. inflateInit2 does not perform
any decompression apart from reading the zlib header if present: this will
be done by inflate(). (So next_in and avail_in may be modified, but next_out
and avail_out are unchanged.)
*/
ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
const Bytef *dictionary,
uInt dictLength));
/*
Initializes the decompression dictionary from the given uncompressed byte
sequence. This function must be called immediately after a call of inflate,
if that call returned Z_NEED_DICT. The dictionary chosen by the compressor
can be determined from the adler32 value returned by that call of inflate.
The compressor and decompressor must use exactly the same dictionary (see
deflateSetDictionary). For raw inflate, this function can be called
immediately after inflateInit2() or inflateReset() and before any call of
inflate() to set the dictionary. The application must insure that the
dictionary that was used for compression is provided.
inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a
parameter is invalid (such as NULL dictionary) or the stream state is
inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the
expected one (incorrect adler32 value). inflateSetDictionary does not
perform any decompression: this will be done by subsequent calls of
inflate().
*/
ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));
/*
Skips invalid compressed data until a full flush point (see above the
description of deflate with Z_FULL_FLUSH) can be found, or until all
available input is skipped. No output is provided.
inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR
if no more input was provided, Z_DATA_ERROR if no flush point has been found,
or Z_STREAM_ERROR if the stream structure was inconsistent. In the success
case, the application may save the current current value of total_in which
indicates where valid compressed data was found. In the error case, the
application may repeatedly call inflateSync, providing more input each time,
until success or end of the input data.
*/
ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest,
z_streamp source));
/*
Sets the destination stream as a complete copy of the source stream.
This function can be useful when randomly accessing a large stream. The
first pass through the stream can periodically record the inflate state,
allowing restarting inflate at those points when randomly accessing the
stream.
inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
(such as zalloc being NULL). msg is left unchanged in both source and
destination.
*/
ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));
/*
This function is equivalent to inflateEnd followed by inflateInit,
but does not free and reallocate all the internal decompression state.
The stream will keep attributes that may have been set by inflateInit2.
inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
stream state was inconsistent (such as zalloc or state being NULL).
*/
ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm,
int bits,
int value));
/*
This function inserts bits in the inflate input stream. The intent is
that this function is used to start inflating at a bit position in the
middle of a byte. The provided bits will be used before any bytes are used
from next_in. This function should only be used with raw inflate, and
should be used before the first inflate() call after inflateInit2() or
inflateReset(). bits must be less than or equal to 16, and that many of the
least significant bits of value will be inserted in the input.
inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source
stream state was inconsistent.
*/
ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm,
gz_headerp head));
/*
inflateGetHeader() requests that gzip header information be stored in the
provided gz_header structure. inflateGetHeader() may be called after
inflateInit2() or inflateReset(), and before the first call of inflate().
As inflate() processes the gzip stream, head->done is zero until the header
is completed, at which time head->done is set to one. If a zlib stream is
being decoded, then head->done is set to -1 to indicate that there will be
no gzip header information forthcoming. Note that Z_BLOCK can be used to
force inflate() to return immediately after header processing is complete
and before any actual data is decompressed.
The text, time, xflags, and os fields are filled in with the gzip header
contents. hcrc is set to true if there is a header CRC. (The header CRC
was valid if done is set to one.) If extra is not Z_NULL, then extra_max
contains the maximum number of bytes to write to extra. Once done is true,
extra_len contains the actual extra field length, and extra contains the
extra field, or that field truncated if extra_max is less than extra_len.
If name is not Z_NULL, then up to name_max characters are written there,
terminated with a zero unless the length is greater than name_max. If
comment is not Z_NULL, then up to comm_max characters are written there,
terminated with a zero unless the length is greater than comm_max. When
any of extra, name, or comment are not Z_NULL and the respective field is
not present in the header, then that field is set to Z_NULL to signal its
absence. This allows the use of deflateSetHeader() with the returned
structure to duplicate the header. However if those fields are set to
allocated memory, then the application will need to save those pointers
elsewhere so that they can be eventually freed.
If inflateGetHeader is not used, then the header information is simply
discarded. The header is always checked for validity, including the header
CRC if present. inflateReset() will reset the process to discard the header
information. The application would need to call inflateGetHeader() again to
retrieve the header from the next gzip stream.
inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
stream state was inconsistent.
*/
/*
ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits,
unsigned char FAR *window));
Initialize the internal stream state for decompression using inflateBack()
calls. The fields zalloc, zfree and opaque in strm must be initialized
before the call. If zalloc and zfree are Z_NULL, then the default library-
derived memory allocation routines are used. windowBits is the base two
logarithm of the window size, in the range 8..15. window is a caller
supplied buffer of that size. Except for special applications where it is
assured that deflate was used with small window sizes, windowBits must be 15
and a 32K byte window must be supplied to be able to decompress general
deflate streams.
See inflateBack() for the usage of these routines.
inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of
the paramaters are invalid, Z_MEM_ERROR if the internal state could not
be allocated, or Z_VERSION_ERROR if the version of the library does not
match the version of the header file.
*/
typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *));
typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned));
ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,
in_func in, void FAR *in_desc,
out_func out, void FAR *out_desc));
/*
inflateBack() does a raw inflate with a single call using a call-back
interface for input and output. This is more efficient than inflate() for
file i/o applications in that it avoids copying between the output and the
sliding window by simply making the window itself the output buffer. This
function trusts the application to not change the output buffer passed by
the output function, at least until inflateBack() returns.
inflateBackInit() must be called first to allocate the internal state
and to initialize the state with the user-provided window buffer.
inflateBack() may then be used multiple times to inflate a complete, raw
deflate stream with each call. inflateBackEnd() is then called to free
the allocated state.
A raw deflate stream is one with no zlib or gzip header or trailer.
This routine would normally be used in a utility that reads zip or gzip
files and writes out uncompressed files. The utility would decode the
header and process the trailer on its own, hence this routine expects
only the raw deflate stream to decompress. This is different from the
normal behavior of inflate(), which expects either a zlib or gzip header and
trailer around the deflate stream.
inflateBack() uses two subroutines supplied by the caller that are then
called by inflateBack() for input and output. inflateBack() calls those
routines until it reads a complete deflate stream and writes out all of the
uncompressed data, or until it encounters an error. The function's
parameters and return types are defined above in the in_func and out_func
typedefs. inflateBack() will call in(in_desc, &buf) which should return the
number of bytes of provided input, and a pointer to that input in buf. If
there is no input available, in() must return zero--buf is ignored in that
case--and inflateBack() will return a buffer error. inflateBack() will call
out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. out()
should return zero on success, or non-zero on failure. If out() returns
non-zero, inflateBack() will return with an error. Neither in() nor out()
are permitted to change the contents of the window provided to
inflateBackInit(), which is also the buffer that out() uses to write from.
The length written by out() will be at most the window size. Any non-zero
amount of input may be provided by in().
For convenience, inflateBack() can be provided input on the first call by
setting strm->next_in and strm->avail_in. If that input is exhausted, then
in() will be called. Therefore strm->next_in must be initialized before
calling inflateBack(). If strm->next_in is Z_NULL, then in() will be called
immediately for input. If strm->next_in is not Z_NULL, then strm->avail_in
must also be initialized, and then if strm->avail_in is not zero, input will
initially be taken from strm->next_in[0 .. strm->avail_in - 1].
The in_desc and out_desc parameters of inflateBack() is passed as the
first parameter of in() and out() respectively when they are called. These
descriptors can be optionally used to pass any information that the caller-
supplied in() and out() functions need to do their job.
On return, inflateBack() will set strm->next_in and strm->avail_in to
pass back any unused input that was provided by the last in() call. The
return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR
if in() or out() returned an error, Z_DATA_ERROR if there was a format
error in the deflate stream (in which case strm->msg is set to indicate the
nature of the error), or Z_STREAM_ERROR if the stream was not properly
initialized. In the case of Z_BUF_ERROR, an input or output error can be
distinguished using strm->next_in which will be Z_NULL only if in() returned
an error. If strm->next is not Z_NULL, then the Z_BUF_ERROR was due to
out() returning non-zero. (in() will always be called before out(), so
strm->next_in is assured to be defined if out() returns non-zero.) Note
that inflateBack() cannot return Z_OK.
*/
ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm));
/*
All memory allocated by inflateBackInit() is freed.
inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream
state was inconsistent.
*/
ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void));
/* Return flags indicating compile-time options.
Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other:
1.0: size of uInt
3.2: size of uLong
5.4: size of voidpf (pointer)
7.6: size of z_off_t
Compiler, assembler, and debug options:
8: DEBUG
9: ASMV or ASMINF -- use ASM code
10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention
11: 0 (reserved)
One-time table building (smaller code, but not thread-safe if true):
12: BUILDFIXED -- build static block decoding tables when needed
13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed
14,15: 0 (reserved)
Library content (indicates missing functionality):
16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking
deflate code when not needed)
17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect
and decode gzip streams (to avoid linking crc code)
18-19: 0 (reserved)
Operation variations (changes in library functionality):
20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate
21: FASTEST -- deflate algorithm with only one, lowest compression level
22,23: 0 (reserved)
The sprintf variant used by gzprintf (zero is best):
24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format
25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure!
26: 0 = returns value, 1 = void -- 1 means inferred string length returned
Remainder:
27-31: 0 (reserved)
*/
/* utility functions */
/*
The following utility functions are implemented on top of the
basic stream-oriented functions. To simplify the interface, some
default options are assumed (compression level and memory usage,
standard memory allocation functions). The source code of these
utility functions can easily be modified if you need special options.
*/
ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen,
const Bytef *source, uLong sourceLen));
/*
Compresses the source buffer into the destination buffer. sourceLen is
the byte length of the source buffer. Upon entry, destLen is the total
size of the destination buffer, which must be at least the value returned
by compressBound(sourceLen). Upon exit, destLen is the actual size of the
compressed buffer.
This function can be used to compress a whole file at once if the
input file is mmap'ed.
compress returns Z_OK if success, Z_MEM_ERROR if there was not
enough memory, Z_BUF_ERROR if there was not enough room in the output
buffer.
*/
ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen,
const Bytef *source, uLong sourceLen,
int level));
/*
Compresses the source buffer into the destination buffer. The level
parameter has the same meaning as in deflateInit. sourceLen is the byte
length of the source buffer. Upon entry, destLen is the total size of the
destination buffer, which must be at least the value returned by
compressBound(sourceLen). Upon exit, destLen is the actual size of the
compressed buffer.
compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
memory, Z_BUF_ERROR if there was not enough room in the output buffer,
Z_STREAM_ERROR if the level parameter is invalid.
*/
ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen));
/*
compressBound() returns an upper bound on the compressed size after
compress() or compress2() on sourceLen bytes. It would be used before
a compress() or compress2() call to allocate the destination buffer.
*/
ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen,
const Bytef *source, uLong sourceLen));
/*
Decompresses the source buffer into the destination buffer. sourceLen is
the byte length of the source buffer. Upon entry, destLen is the total
size of the destination buffer, which must be large enough to hold the
entire uncompressed data. (The size of the uncompressed data must have
been saved previously by the compressor and transmitted to the decompressor
by some mechanism outside the scope of this compression library.)
Upon exit, destLen is the actual size of the compressed buffer.
This function can be used to decompress a whole file at once if the
input file is mmap'ed.
uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
enough memory, Z_BUF_ERROR if there was not enough room in the output
buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete.
*/
typedef voidp gzFile;
ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode));
/*
Opens a gzip (.gz) file for reading or writing. The mode parameter
is as in fopen ("rb" or "wb") but can also include a compression level
("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for
Huffman only compression as in "wb1h", or 'R' for run-length encoding
as in "wb1R". (See the description of deflateInit2 for more information
about the strategy parameter.)
gzopen can be used to read a file which is not in gzip format; in this
case gzread will directly read from the file without decompression.
gzopen returns NULL if the file could not be opened or if there was
insufficient memory to allocate the (de)compression state; errno
can be checked to distinguish the two cases (if errno is zero, the
zlib error is Z_MEM_ERROR). */
ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode));
/*
gzdopen() associates a gzFile with the file descriptor fd. File
descriptors are obtained from calls like open, dup, creat, pipe or
fileno (in the file has been previously opened with fopen).
The mode parameter is as in gzopen.
The next call of gzclose on the returned gzFile will also close the
file descriptor fd, just like fclose(fdopen(fd), mode) closes the file
descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode).
gzdopen returns NULL if there was insufficient memory to allocate
the (de)compression state.
*/
ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
/*
Dynamically update the compression level or strategy. See the description
of deflateInit2 for the meaning of these parameters.
gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not
opened for writing.
*/
ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len));
/*
Reads the given number of uncompressed bytes from the compressed file.
If the input file was not in gzip format, gzread copies the given number
of bytes into the buffer.
gzread returns the number of uncompressed bytes actually read (0 for
end of file, -1 for error). */
ZEXTERN int ZEXPORT gzwrite OF((gzFile file,
voidpc buf, unsigned len));
/*
Writes the given number of uncompressed bytes into the compressed file.
gzwrite returns the number of uncompressed bytes actually written
(0 in case of error).
*/
ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...));
/*
Converts, formats, and writes the args to the compressed file under
control of the format string, as in fprintf. gzprintf returns the number of
uncompressed bytes actually written (0 in case of error). The number of
uncompressed bytes written is limited to 4095. The caller should assure that
this limit is not exceeded. If it is exceeded, then gzprintf() will return
return an error (0) with nothing written. In this case, there may also be a
buffer overflow with unpredictable consequences, which is possible only if
zlib was compiled with the insecure functions sprintf() or vsprintf()
because the secure snprintf() or vsnprintf() functions were not available.
*/
ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s));
/*
Writes the given null-terminated string to the compressed file, excluding
the terminating null character.
gzputs returns the number of characters written, or -1 in case of error.
*/
ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
/*
Reads bytes from the compressed file until len-1 characters are read, or
a newline character is read and transferred to buf, or an end-of-file
condition is encountered. The string is then terminated with a null
character.
gzgets returns buf, or Z_NULL in case of error.
*/
ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c));
/*
Writes c, converted to an unsigned char, into the compressed file.
gzputc returns the value that was written, or -1 in case of error.
*/
ZEXTERN int ZEXPORT gzgetc OF((gzFile file));
/*
Reads one byte from the compressed file. gzgetc returns this byte
or -1 in case of end of file or error.
*/
ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file));
/*
Push one character back onto the stream to be read again later.
Only one character of push-back is allowed. gzungetc() returns the
character pushed, or -1 on failure. gzungetc() will fail if a
character has been pushed but not read yet, or if c is -1. The pushed
character will be discarded if the stream is repositioned with gzseek()
or gzrewind().
*/
ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush));
/*
Flushes all pending output into the compressed file. The parameter
flush is as in the deflate() function. The return value is the zlib
error number (see function gzerror below). gzflush returns Z_OK if
the flush parameter is Z_FINISH and all output could be flushed.
gzflush should be called only when strictly necessary because it can
degrade compression.
*/
ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file,
z_off_t offset, int whence));
/*
Sets the starting position for the next gzread or gzwrite on the
given compressed file. The offset represents a number of bytes in the
uncompressed data stream. The whence parameter is defined as in lseek(2);
the value SEEK_END is not supported.
If the file is opened for reading, this function is emulated but can be
extremely slow. If the file is opened for writing, only forward seeks are
supported; gzseek then compresses a sequence of zeroes up to the new
starting position.
gzseek returns the resulting offset location as measured in bytes from
the beginning of the uncompressed stream, or -1 in case of error, in
particular if the file is opened for writing and the new starting position
would be before the current position.
*/
ZEXTERN int ZEXPORT gzrewind OF((gzFile file));
/*
Rewinds the given file. This function is supported only for reading.
gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)
*/
ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file));
/*
Returns the starting position for the next gzread or gzwrite on the
given compressed file. This position represents a number of bytes in the
uncompressed data stream.
gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)
*/
ZEXTERN int ZEXPORT gzeof OF((gzFile file));
/*
Returns 1 when EOF has previously been detected reading the given
input stream, otherwise zero.
*/
ZEXTERN int ZEXPORT gzdirect OF((gzFile file));
/*
Returns 1 if file is being read directly without decompression, otherwise
zero.
*/
ZEXTERN int ZEXPORT gzclose OF((gzFile file));
/*
Flushes all pending output if necessary, closes the compressed file
and deallocates all the (de)compression state. The return value is the zlib
error number (see function gzerror below).
*/
ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum));
/*
Returns the error message for the last error which occurred on the
given compressed file. errnum is set to zlib error number. If an
error occurred in the file system and not in the compression library,
errnum is set to Z_ERRNO and the application may consult errno
to get the exact error code.
*/
ZEXTERN void ZEXPORT gzclearerr OF((gzFile file));
/*
Clears the error and end-of-file flags for file. This is analogous to the
clearerr() function in stdio. This is useful for continuing to read a gzip
file that is being written concurrently.
*/
/* checksum functions */
/*
These functions are not related to compression but are exported
anyway because they might be useful in applications using the
compression library.
*/
ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
/*
Update a running Adler-32 checksum with the bytes buf[0..len-1] and
return the updated checksum. If buf is NULL, this function returns
the required initial value for the checksum.
An Adler-32 checksum is almost as reliable as a CRC32 but can be computed
much faster. Usage example:
uLong adler = adler32(0L, Z_NULL, 0);
while (read_buffer(buffer, length) != EOF) {
adler = adler32(adler, buffer, length);
}
if (adler != original_adler) error();
*/
ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2,
z_off_t len2));
/*
Combine two Adler-32 checksums into one. For two sequences of bytes, seq1
and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for
each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of
seq1 and seq2 concatenated, requiring only adler1, adler2, and len2.
*/
ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
/*
Update a running CRC-32 with the bytes buf[0..len-1] and return the
updated CRC-32. If buf is NULL, this function returns the required initial
value for the for the crc. Pre- and post-conditioning (one's complement) is
performed within this function so it shouldn't be done by the application.
Usage example:
uLong crc = crc32(0L, Z_NULL, 0);
while (read_buffer(buffer, length) != EOF) {
crc = crc32(crc, buffer, length);
}
if (crc != original_crc) error();
*/
ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2));
/*
Combine two CRC-32 check values into one. For two sequences of bytes,
seq1 and seq2 with lengths len1 and len2, CRC-32 check values were
calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32
check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and
len2.
*/
/* various hacks, don't look :) */
/* deflateInit and inflateInit are macros to allow checking the zlib version
* and the compiler's view of z_stream:
*/
ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level,
const char *version, int stream_size));
ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm,
const char *version, int stream_size));
ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method,
int windowBits, int memLevel,
int strategy, const char *version,
int stream_size));
ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits,
const char *version, int stream_size));
ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
unsigned char FAR *window,
const char *version,
int stream_size));
#define deflateInit(strm, level) \
deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream))
#define inflateInit(strm) \
inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream))
#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
(strategy), ZLIB_VERSION, sizeof(z_stream))
#define inflateInit2(strm, windowBits) \
inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream))
#define inflateBackInit(strm, windowBits, window) \
inflateBackInit_((strm), (windowBits), (window), \
ZLIB_VERSION, sizeof(z_stream))
#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL)
struct internal_state {int dummy;}; /* hack for buggy compilers */
#endif
ZEXTERN const char * ZEXPORT zError OF((int));
ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp z));
ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void));
#ifdef __cplusplus
}
#endif
#endif /* ZLIB_H */
| 66,188 | 47.740059 | 79 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/inttypes.h
|
// ISO C9x compliant inttypes.h for Microsoft Visual Studio
// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
//
// Copyright (c) 2006 Alexander Chemeris
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. The name of the author may be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
///////////////////////////////////////////////////////////////////////////////
#ifndef _MSC_VER // [
#error "Use this header only with Microsoft Visual C++ compilers!"
#endif // _MSC_VER ]
#ifndef _MSC_INTTYPES_H_ // [
#define _MSC_INTTYPES_H_
#if _MSC_VER > 1000
#pragma once
#endif
#include "stdint.h"
// 7.8 Format conversion of integer types
typedef struct {
intmax_t quot;
intmax_t rem;
} imaxdiv_t;
// 7.8.1 Macros for format specifiers
#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) // [ See footnote 185 at page 198
// The fprintf macros for signed integers are:
#define PRId8 "d"
#define PRIi8 "i"
#define PRIdLEAST8 "d"
#define PRIiLEAST8 "i"
#define PRIdFAST8 "d"
#define PRIiFAST8 "i"
#define PRId16 "hd"
#define PRIi16 "hi"
#define PRIdLEAST16 "hd"
#define PRIiLEAST16 "hi"
#define PRIdFAST16 "hd"
#define PRIiFAST16 "hi"
#define PRId32 "I32d"
#define PRIi32 "I32i"
#define PRIdLEAST32 "I32d"
#define PRIiLEAST32 "I32i"
#define PRIdFAST32 "I32d"
#define PRIiFAST32 "I32i"
#define PRId64 "I64d"
#define PRIi64 "I64i"
#define PRIdLEAST64 "I64d"
#define PRIiLEAST64 "I64i"
#define PRIdFAST64 "I64d"
#define PRIiFAST64 "I64i"
#define PRIdMAX "I64d"
#define PRIiMAX "I64i"
#define PRIdPTR "Id"
#define PRIiPTR "Ii"
// The fprintf macros for unsigned integers are:
#define PRIo8 "o"
#define PRIu8 "u"
#define PRIx8 "x"
#define PRIX8 "X"
#define PRIoLEAST8 "o"
#define PRIuLEAST8 "u"
#define PRIxLEAST8 "x"
#define PRIXLEAST8 "X"
#define PRIoFAST8 "o"
#define PRIuFAST8 "u"
#define PRIxFAST8 "x"
#define PRIXFAST8 "X"
#define PRIo16 "ho"
#define PRIu16 "hu"
#define PRIx16 "hx"
#define PRIX16 "hX"
#define PRIoLEAST16 "ho"
#define PRIuLEAST16 "hu"
#define PRIxLEAST16 "hx"
#define PRIXLEAST16 "hX"
#define PRIoFAST16 "ho"
#define PRIuFAST16 "hu"
#define PRIxFAST16 "hx"
#define PRIXFAST16 "hX"
#define PRIo32 "I32o"
#define PRIu32 "I32u"
#define PRIx32 "I32x"
#define PRIX32 "I32X"
#define PRIoLEAST32 "I32o"
#define PRIuLEAST32 "I32u"
#define PRIxLEAST32 "I32x"
#define PRIXLEAST32 "I32X"
#define PRIoFAST32 "I32o"
#define PRIuFAST32 "I32u"
#define PRIxFAST32 "I32x"
#define PRIXFAST32 "I32X"
#define PRIo64 "I64o"
#define PRIu64 "I64u"
#define PRIx64 "I64x"
#define PRIX64 "I64X"
#define PRIoLEAST64 "I64o"
#define PRIuLEAST64 "I64u"
#define PRIxLEAST64 "I64x"
#define PRIXLEAST64 "I64X"
#define PRIoFAST64 "I64o"
#define PRIuFAST64 "I64u"
#define PRIxFAST64 "I64x"
#define PRIXFAST64 "I64X"
#define PRIoMAX "I64o"
#define PRIuMAX "I64u"
#define PRIxMAX "I64x"
#define PRIXMAX "I64X"
#define PRIoPTR "Io"
#define PRIuPTR "Iu"
#define PRIxPTR "Ix"
#define PRIXPTR "IX"
// The fscanf macros for signed integers are:
#define SCNd8 "d"
#define SCNi8 "i"
#define SCNdLEAST8 "d"
#define SCNiLEAST8 "i"
#define SCNdFAST8 "d"
#define SCNiFAST8 "i"
#define SCNd16 "hd"
#define SCNi16 "hi"
#define SCNdLEAST16 "hd"
#define SCNiLEAST16 "hi"
#define SCNdFAST16 "hd"
#define SCNiFAST16 "hi"
#define SCNd32 "ld"
#define SCNi32 "li"
#define SCNdLEAST32 "ld"
#define SCNiLEAST32 "li"
#define SCNdFAST32 "ld"
#define SCNiFAST32 "li"
#define SCNd64 "I64d"
#define SCNi64 "I64i"
#define SCNdLEAST64 "I64d"
#define SCNiLEAST64 "I64i"
#define SCNdFAST64 "I64d"
#define SCNiFAST64 "I64i"
#define SCNdMAX "I64d"
#define SCNiMAX "I64i"
#ifdef _WIN64 // [
# define SCNdPTR "I64d"
# define SCNiPTR "I64i"
#else // _WIN64 ][
# define SCNdPTR "ld"
# define SCNiPTR "li"
#endif // _WIN64 ]
// The fscanf macros for unsigned integers are:
#define SCNo8 "o"
#define SCNu8 "u"
#define SCNx8 "x"
#define SCNX8 "X"
#define SCNoLEAST8 "o"
#define SCNuLEAST8 "u"
#define SCNxLEAST8 "x"
#define SCNXLEAST8 "X"
#define SCNoFAST8 "o"
#define SCNuFAST8 "u"
#define SCNxFAST8 "x"
#define SCNXFAST8 "X"
#define SCNo16 "ho"
#define SCNu16 "hu"
#define SCNx16 "hx"
#define SCNX16 "hX"
#define SCNoLEAST16 "ho"
#define SCNuLEAST16 "hu"
#define SCNxLEAST16 "hx"
#define SCNXLEAST16 "hX"
#define SCNoFAST16 "ho"
#define SCNuFAST16 "hu"
#define SCNxFAST16 "hx"
#define SCNXFAST16 "hX"
#define SCNo32 "lo"
#define SCNu32 "lu"
#define SCNx32 "lx"
#define SCNX32 "lX"
#define SCNoLEAST32 "lo"
#define SCNuLEAST32 "lu"
#define SCNxLEAST32 "lx"
#define SCNXLEAST32 "lX"
#define SCNoFAST32 "lo"
#define SCNuFAST32 "lu"
#define SCNxFAST32 "lx"
#define SCNXFAST32 "lX"
#define SCNo64 "I64o"
#define SCNu64 "I64u"
#define SCNx64 "I64x"
#define SCNX64 "I64X"
#define SCNoLEAST64 "I64o"
#define SCNuLEAST64 "I64u"
#define SCNxLEAST64 "I64x"
#define SCNXLEAST64 "I64X"
#define SCNoFAST64 "I64o"
#define SCNuFAST64 "I64u"
#define SCNxFAST64 "I64x"
#define SCNXFAST64 "I64X"
#define SCNoMAX "I64o"
#define SCNuMAX "I64u"
#define SCNxMAX "I64x"
#define SCNXMAX "I64X"
#ifdef _WIN64 // [
# define SCNoPTR "I64o"
# define SCNuPTR "I64u"
# define SCNxPTR "I64x"
# define SCNXPTR "I64X"
#else // _WIN64 ][
# define SCNoPTR "lo"
# define SCNuPTR "lu"
# define SCNxPTR "lx"
# define SCNXPTR "lX"
#endif // _WIN64 ]
#endif // __STDC_FORMAT_MACROS ]
// 7.8.2 Functions for greatest-width integer types
// 7.8.2.1 The imaxabs function
#define imaxabs _abs64
// 7.8.2.2 The imaxdiv function
// This is modified version of div() function from Microsoft's div.c found
// in %MSVC.NET%\crt\src\div.c
#ifdef STATIC_IMAXDIV // [
static
#else // STATIC_IMAXDIV ][
_inline
#endif // STATIC_IMAXDIV ]
imaxdiv_t __cdecl imaxdiv(intmax_t numer, intmax_t denom)
{
imaxdiv_t result;
result.quot = numer / denom;
result.rem = numer % denom;
if (numer < 0 && result.rem > 0) {
// did division wrong; must fix up
++result.quot;
result.rem -= denom;
}
return result;
}
// 7.8.2.3 The strtoimax and strtoumax functions
#define strtoimax _strtoi64
#define strtoumax _strtoui64
// 7.8.2.4 The wcstoimax and wcstoumax functions
#define wcstoimax _wcstoi64
#define wcstoumax _wcstoui64
#endif // _MSC_INTTYPES_H_ ]
| 8,004 | 25.160131 | 94 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libavfilter/avcodec.h
|
/*
* This file is part of FFmpeg.
*
* FFmpeg 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.
*
* FFmpeg 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 FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVFILTER_AVCODEC_H
#define AVFILTER_AVCODEC_H
/**
* @file
* libavcodec/libavfilter gluing utilities
*
* This should be included in an application ONLY if the installed
* libavfilter has been compiled with libavcodec support, otherwise
* symbols defined below will not be available.
*/
#include "libavcodec/avcodec.h" // AVFrame
#include "avfilter.h"
/**
* Copy the frame properties of src to dst, without copying the actual
* image data.
*
* @return 0 on success, a negative number on error.
*/
int avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src);
/**
* Copy the frame properties and data pointers of src to dst, without copying
* the actual data.
*
* @return 0 on success, a negative number on error.
*/
int avfilter_copy_buf_props(AVFrame *dst, const AVFilterBufferRef *src);
/**
* Create and return a picref reference from the data and properties
* contained in frame.
*
* @param perms permissions to assign to the new buffer reference
*/
AVFilterBufferRef *avfilter_get_video_buffer_ref_from_frame(const AVFrame *frame, int perms);
/**
* Create and return a picref reference from the data and properties
* contained in frame.
*
* @param perms permissions to assign to the new buffer reference
*/
AVFilterBufferRef *avfilter_get_audio_buffer_ref_from_frame(const AVFrame *frame,
int perms);
/**
* Create and return a buffer reference from the data and properties
* contained in frame.
*
* @param perms permissions to assign to the new buffer reference
*/
AVFilterBufferRef *avfilter_get_buffer_ref_from_frame(enum AVMediaType type,
const AVFrame *frame,
int perms);
#ifdef FF_API_FILL_FRAME
/**
* Fill an AVFrame with the information stored in samplesref.
*
* @param frame an already allocated AVFrame
* @param samplesref an audio buffer reference
* @return 0 in case of success, a negative AVERROR code in case of
* failure
* @deprecated Use avfilter_copy_buf_props() instead.
*/
attribute_deprecated
int avfilter_fill_frame_from_audio_buffer_ref(AVFrame *frame,
const AVFilterBufferRef *samplesref);
/**
* Fill an AVFrame with the information stored in picref.
*
* @param frame an already allocated AVFrame
* @param picref a video buffer reference
* @return 0 in case of success, a negative AVERROR code in case of
* failure
* @deprecated Use avfilter_copy_buf_props() instead.
*/
attribute_deprecated
int avfilter_fill_frame_from_video_buffer_ref(AVFrame *frame,
const AVFilterBufferRef *picref);
/**
* Fill an AVFrame with information stored in ref.
*
* @param frame an already allocated AVFrame
* @param ref a video or audio buffer reference
* @return 0 in case of success, a negative AVERROR code in case of
* failure
* @deprecated Use avfilter_copy_buf_props() instead.
*/
attribute_deprecated
int avfilter_fill_frame_from_buffer_ref(AVFrame *frame,
const AVFilterBufferRef *ref);
#endif
/**
* Add frame data to buffer_src.
*
* @param buffer_src pointer to a buffer source context
* @param frame a frame, or NULL to mark EOF
* @param flags a combination of AV_BUFFERSRC_FLAG_*
* @return >= 0 in case of success, a negative AVERROR code
* in case of failure
*/
int av_buffersrc_add_frame(AVFilterContext *buffer_src,
const AVFrame *frame, int flags);
#endif /* AVFILTER_AVCODEC_H */
| 4,433 | 32.590909 | 93 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libavfilter/buffersink.h
|
/*
* This file is part of FFmpeg.
*
* FFmpeg 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.
*
* FFmpeg 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 FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVFILTER_BUFFERSINK_H
#define AVFILTER_BUFFERSINK_H
/**
* @file
* memory buffer sink API for audio and video
*/
#include "avfilter.h"
/**
* Struct to use for initializing a buffersink context.
*/
typedef struct {
const enum PixelFormat *pixel_fmts; ///< list of allowed pixel formats, terminated by PIX_FMT_NONE
} AVBufferSinkParams;
/**
* Create an AVBufferSinkParams structure.
*
* Must be freed with av_free().
*/
AVBufferSinkParams *av_buffersink_params_alloc(void);
/**
* Struct to use for initializing an abuffersink context.
*/
typedef struct {
const enum AVSampleFormat *sample_fmts; ///< list of allowed sample formats, terminated by AV_SAMPLE_FMT_NONE
const int64_t *channel_layouts; ///< list of allowed channel layouts, terminated by -1
} AVABufferSinkParams;
/**
* Create an AVABufferSinkParams structure.
*
* Must be freed with av_free().
*/
AVABufferSinkParams *av_abuffersink_params_alloc(void);
/**
* Set the frame size for an audio buffer sink.
*
* All calls to av_buffersink_get_buffer_ref will return a buffer with
* exactly the specified number of samples, or AVERROR(EAGAIN) if there is
* not enough. The last buffer at EOF will be padded with 0.
*/
void av_buffersink_set_frame_size(AVFilterContext *ctx, unsigned frame_size);
/**
* Tell av_buffersink_get_buffer_ref() to read video/samples buffer
* reference, but not remove it from the buffer. This is useful if you
* need only to read a video/samples buffer, without to fetch it.
*/
#define AV_BUFFERSINK_FLAG_PEEK 1
/**
* Tell av_buffersink_get_buffer_ref() not to request a frame from its input.
* If a frame is already buffered, it is read (and removed from the buffer),
* but if no frame is present, return AVERROR(EAGAIN).
*/
#define AV_BUFFERSINK_FLAG_NO_REQUEST 2
/**
* Get an audio/video buffer data from buffer_sink and put it in bufref.
*
* This function works with both audio and video buffer sinks.
*
* @param buffer_sink pointer to a buffersink or abuffersink context
* @param flags a combination of AV_BUFFERSINK_FLAG_* flags
* @return >= 0 in case of success, a negative AVERROR code in case of
* failure
*/
int av_buffersink_get_buffer_ref(AVFilterContext *buffer_sink,
AVFilterBufferRef **bufref, int flags);
/**
* Get the number of immediately available frames.
*/
int av_buffersink_poll_frame(AVFilterContext *ctx);
/**
* Get the frame rate of the input.
*/
AVRational av_buffersink_get_frame_rate(AVFilterContext *ctx);
/**
* @defgroup libav_api Libav API
* @{
*/
/**
* Get a buffer with filtered data from sink and put it in buf.
*
* @param ctx pointer to a context of a buffersink or abuffersink AVFilter.
* @param buf pointer to the buffer will be written here if buf is non-NULL. buf
* must be freed by the caller using avfilter_unref_buffer().
* Buf may also be NULL to query whether a buffer is ready to be
* output.
*
* @return >= 0 in case of success, a negative AVERROR code in case of
* failure.
*/
int av_buffersink_read(AVFilterContext *ctx, AVFilterBufferRef **buf);
/**
* Same as av_buffersink_read, but with the ability to specify the number of
* samples read. This function is less efficient than av_buffersink_read(),
* because it copies the data around.
*
* @param ctx pointer to a context of the abuffersink AVFilter.
* @param buf pointer to the buffer will be written here if buf is non-NULL. buf
* must be freed by the caller using avfilter_unref_buffer(). buf
* will contain exactly nb_samples audio samples, except at the end
* of stream, when it can contain less than nb_samples.
* Buf may also be NULL to query whether a buffer is ready to be
* output.
*
* @warning do not mix this function with av_buffersink_read(). Use only one or
* the other with a single sink, not both.
*/
int av_buffersink_read_samples(AVFilterContext *ctx, AVFilterBufferRef **buf,
int nb_samples);
/**
* @}
*/
#endif /* AVFILTER_BUFFERSINK_H */
| 4,885 | 32.013514 | 113 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libavfilter/version.h
|
/*
* Version macros.
*
* This file is part of FFmpeg.
*
* FFmpeg 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.
*
* FFmpeg 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 FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVFILTER_VERSION_H
#define AVFILTER_VERSION_H
/**
* @file
* Libavfilter version macros
*/
#include "libavutil/avutil.h"
#define LIBAVFILTER_VERSION_MAJOR 3
#define LIBAVFILTER_VERSION_MINOR 16
#define LIBAVFILTER_VERSION_MICRO 100
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
LIBAVFILTER_VERSION_MINOR, \
LIBAVFILTER_VERSION_MICRO)
#define LIBAVFILTER_VERSION AV_VERSION(LIBAVFILTER_VERSION_MAJOR, \
LIBAVFILTER_VERSION_MINOR, \
LIBAVFILTER_VERSION_MICRO)
#define LIBAVFILTER_BUILD LIBAVFILTER_VERSION_INT
/**
* FF_API_* defines may be placed below to indicate public API that will be
* dropped at a future version bump. The defines themselves are not part of
* the public API and may change, break or disappear at any time.
*/
#ifndef FF_API_OLD_ALL_FORMATS_API
#define FF_API_OLD_ALL_FORMATS_API (LIBAVFILTER_VERSION_MAJOR < 3)
#endif
#ifndef FF_API_AVFILTERPAD_PUBLIC
#define FF_API_AVFILTERPAD_PUBLIC (LIBAVFILTER_VERSION_MAJOR < 4)
#endif
#ifndef FF_API_FOO_COUNT
#define FF_API_FOO_COUNT (LIBAVFILTER_VERSION_MAJOR < 4)
#endif
#ifndef FF_API_FILL_FRAME
#define FF_API_FILL_FRAME (LIBAVFILTER_VERSION_MAJOR < 4)
#endif
#ifndef FF_API_BUFFERSRC_BUFFER
#define FF_API_BUFFERSRC_BUFFER (LIBAVFILTER_VERSION_MAJOR < 4)
#endif
#endif /* AVFILTER_VERSION_H */
| 2,353 | 34.666667 | 79 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libavfilter/buffersrc.h
|
/*
*
* This file is part of Libav.
*
* Libav 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.
*
* Libav 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 Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVFILTER_BUFFERSRC_H
#define AVFILTER_BUFFERSRC_H
/**
* @file
* Memory buffer source API.
*/
#include "libavcodec/avcodec.h"
#include "avfilter.h"
enum {
/**
* Do not check for format changes.
*/
AV_BUFFERSRC_FLAG_NO_CHECK_FORMAT = 1,
/**
* Do not copy buffer data.
*/
AV_BUFFERSRC_FLAG_NO_COPY = 2,
/**
* Immediately push the frame to the output.
*/
AV_BUFFERSRC_FLAG_PUSH = 4,
};
/**
* Add buffer data in picref to buffer_src.
*
* @param buffer_src pointer to a buffer source context
* @param picref a buffer reference, or NULL to mark EOF
* @param flags a combination of AV_BUFFERSRC_FLAG_*
* @return >= 0 in case of success, a negative AVERROR code
* in case of failure
*/
int av_buffersrc_add_ref(AVFilterContext *buffer_src,
AVFilterBufferRef *picref, int flags);
/**
* Get the number of failed requests.
*
* A failed request is when the request_frame method is called while no
* frame is present in the buffer.
* The number is reset when a frame is added.
*/
unsigned av_buffersrc_get_nb_failed_requests(AVFilterContext *buffer_src);
#ifdef FF_API_BUFFERSRC_BUFFER
/**
* Add a buffer to the filtergraph s.
*
* @param buf buffer containing frame data to be passed down the filtergraph.
* This function will take ownership of buf, the user must not free it.
* A NULL buf signals EOF -- i.e. no more frames will be sent to this filter.
* @deprecated Use av_buffersrc_add_ref(s, picref, AV_BUFFERSRC_FLAG_NO_COPY) instead.
*/
attribute_deprecated
int av_buffersrc_buffer(AVFilterContext *s, AVFilterBufferRef *buf);
#endif
/**
* Add a frame to the buffer source.
*
* @param s an instance of the buffersrc filter.
* @param frame frame to be added.
*
* @warning frame data will be memcpy()ed, which may be a big performance
* hit. Use av_buffersrc_buffer() to avoid copying the data.
*/
int av_buffersrc_write_frame(AVFilterContext *s, AVFrame *frame);
#endif /* AVFILTER_BUFFERSRC_H */
| 2,833 | 28.520833 | 86 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libavfilter/asrc_abuffer.h
|
/*
* This file is part of FFmpeg.
*
* FFmpeg 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.
*
* FFmpeg 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 FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVFILTER_ASRC_ABUFFER_H
#define AVFILTER_ASRC_ABUFFER_H
#include "avfilter.h"
/**
* @file
* memory buffer source for audio
*
* @deprecated use buffersrc.h instead.
*/
/**
* Queue an audio buffer to the audio buffer source.
*
* @param abuffersrc audio source buffer context
* @param data pointers to the samples planes
* @param linesize linesizes of each audio buffer plane
* @param nb_samples number of samples per channel
* @param sample_fmt sample format of the audio data
* @param ch_layout channel layout of the audio data
* @param planar flag to indicate if audio data is planar or packed
* @param pts presentation timestamp of the audio buffer
* @param flags unused
*
* @deprecated use av_buffersrc_add_ref() instead.
*/
attribute_deprecated
int av_asrc_buffer_add_samples(AVFilterContext *abuffersrc,
uint8_t *data[8], int linesize[8],
int nb_samples, int sample_rate,
int sample_fmt, int64_t ch_layout, int planar,
int64_t pts, int av_unused flags);
/**
* Queue an audio buffer to the audio buffer source.
*
* This is similar to av_asrc_buffer_add_samples(), but the samples
* are stored in a buffer with known size.
*
* @param abuffersrc audio source buffer context
* @param buf pointer to the samples data, packed is assumed
* @param size the size in bytes of the buffer, it must contain an
* integer number of samples
* @param sample_fmt sample format of the audio data
* @param ch_layout channel layout of the audio data
* @param pts presentation timestamp of the audio buffer
* @param flags unused
*
* @deprecated use av_buffersrc_add_ref() instead.
*/
attribute_deprecated
int av_asrc_buffer_add_buffer(AVFilterContext *abuffersrc,
uint8_t *buf, int buf_size,
int sample_rate,
int sample_fmt, int64_t ch_layout, int planar,
int64_t pts, int av_unused flags);
/**
* Queue an audio buffer to the audio buffer source.
*
* @param abuffersrc audio source buffer context
* @param samplesref buffer ref to queue
* @param flags unused
*
* @deprecated use av_buffersrc_add_ref() instead.
*/
attribute_deprecated
int av_asrc_buffer_add_audio_buffer_ref(AVFilterContext *abuffersrc,
AVFilterBufferRef *samplesref,
int av_unused flags);
#endif /* AVFILTER_ASRC_ABUFFER_H */
| 3,321 | 35.108696 | 79 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libavfilter/avfilter.h
|
/*
* filter layer
* Copyright (c) 2007 Bobby Bingham
*
* This file is part of FFmpeg.
*
* FFmpeg 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.
*
* FFmpeg 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 FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVFILTER_AVFILTER_H
#define AVFILTER_AVFILTER_H
#include <stddef.h>
#include "libavutil/avutil.h"
#include "libavutil/log.h"
#include "libavutil/samplefmt.h"
#include "libavutil/pixfmt.h"
#include "libavutil/rational.h"
#include "libavfilter/version.h"
/**
* Return the LIBAVFILTER_VERSION_INT constant.
*/
unsigned avfilter_version(void);
/**
* Return the libavfilter build-time configuration.
*/
const char *avfilter_configuration(void);
/**
* Return the libavfilter license.
*/
const char *avfilter_license(void);
/**
* Get the class for the AVFilterContext struct.
*/
const AVClass *avfilter_get_class(void);
typedef struct AVFilterContext AVFilterContext;
typedef struct AVFilterLink AVFilterLink;
typedef struct AVFilterPad AVFilterPad;
typedef struct AVFilterFormats AVFilterFormats;
/**
* A reference-counted buffer data type used by the filter system. Filters
* should not store pointers to this structure directly, but instead use the
* AVFilterBufferRef structure below.
*/
typedef struct AVFilterBuffer {
uint8_t *data[8]; ///< buffer data for each plane/channel
/**
* pointers to the data planes/channels.
*
* For video, this should simply point to data[].
*
* For planar audio, each channel has a separate data pointer, and
* linesize[0] contains the size of each channel buffer.
* For packed audio, there is just one data pointer, and linesize[0]
* contains the total size of the buffer for all channels.
*
* Note: Both data and extended_data will always be set, but for planar
* audio with more channels that can fit in data, extended_data must be used
* in order to access all channels.
*/
uint8_t **extended_data;
int linesize[8]; ///< number of bytes per line
/** private data to be used by a custom free function */
void *priv;
/**
* A pointer to the function to deallocate this buffer if the default
* function is not sufficient. This could, for example, add the memory
* back into a memory pool to be reused later without the overhead of
* reallocating it from scratch.
*/
void (*free)(struct AVFilterBuffer *buf);
int format; ///< media format
int w, h; ///< width and height of the allocated buffer
unsigned refcount; ///< number of references to this buffer
} AVFilterBuffer;
#define AV_PERM_READ 0x01 ///< can read from the buffer
#define AV_PERM_WRITE 0x02 ///< can write to the buffer
#define AV_PERM_PRESERVE 0x04 ///< nobody else can overwrite the buffer
#define AV_PERM_REUSE 0x08 ///< can output the buffer multiple times, with the same contents each time
#define AV_PERM_REUSE2 0x10 ///< can output the buffer multiple times, modified each time
#define AV_PERM_NEG_LINESIZES 0x20 ///< the buffer requested can have negative linesizes
#define AV_PERM_ALIGN 0x40 ///< the buffer must be aligned
#define AVFILTER_ALIGN 16 //not part of ABI
/**
* Audio specific properties in a reference to an AVFilterBuffer. Since
* AVFilterBufferRef is common to different media formats, audio specific
* per reference properties must be separated out.
*/
typedef struct AVFilterBufferRefAudioProps {
uint64_t channel_layout; ///< channel layout of audio buffer
int nb_samples; ///< number of audio samples per channel
int sample_rate; ///< audio buffer sample rate
} AVFilterBufferRefAudioProps;
/**
* Video specific properties in a reference to an AVFilterBuffer. Since
* AVFilterBufferRef is common to different media formats, video specific
* per reference properties must be separated out.
*/
typedef struct AVFilterBufferRefVideoProps {
int w; ///< image width
int h; ///< image height
AVRational sample_aspect_ratio; ///< sample aspect ratio
int interlaced; ///< is frame interlaced
int top_field_first; ///< field order
enum AVPictureType pict_type; ///< picture type of the frame
int key_frame; ///< 1 -> keyframe, 0-> not
int qp_table_linesize; ///< qp_table stride
int qp_table_size; ///< qp_table size
int8_t *qp_table; ///< array of Quantization Parameters
} AVFilterBufferRefVideoProps;
/**
* A reference to an AVFilterBuffer. Since filters can manipulate the origin of
* a buffer to, for example, crop image without any memcpy, the buffer origin
* and dimensions are per-reference properties. Linesize is also useful for
* image flipping, frame to field filters, etc, and so is also per-reference.
*
* TODO: add anything necessary for frame reordering
*/
typedef struct AVFilterBufferRef {
AVFilterBuffer *buf; ///< the buffer that this is a reference to
uint8_t *data[8]; ///< picture/audio data for each plane
/**
* pointers to the data planes/channels.
*
* For video, this should simply point to data[].
*
* For planar audio, each channel has a separate data pointer, and
* linesize[0] contains the size of each channel buffer.
* For packed audio, there is just one data pointer, and linesize[0]
* contains the total size of the buffer for all channels.
*
* Note: Both data and extended_data will always be set, but for planar
* audio with more channels that can fit in data, extended_data must be used
* in order to access all channels.
*/
uint8_t **extended_data;
int linesize[8]; ///< number of bytes per line
AVFilterBufferRefVideoProps *video; ///< video buffer specific properties
AVFilterBufferRefAudioProps *audio; ///< audio buffer specific properties
/**
* presentation timestamp. The time unit may change during
* filtering, as it is specified in the link and the filter code
* may need to rescale the PTS accordingly.
*/
int64_t pts;
int64_t pos; ///< byte position in stream, -1 if unknown
int format; ///< media format
int perms; ///< permissions, see the AV_PERM_* flags
enum AVMediaType type; ///< media type of buffer data
} AVFilterBufferRef;
/**
* Copy properties of src to dst, without copying the actual data
*/
void avfilter_copy_buffer_ref_props(AVFilterBufferRef *dst, AVFilterBufferRef *src);
/**
* Add a new reference to a buffer.
*
* @param ref an existing reference to the buffer
* @param pmask a bitmask containing the allowable permissions in the new
* reference
* @return a new reference to the buffer with the same properties as the
* old, excluding any permissions denied by pmask
*/
AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef *ref, int pmask);
/**
* Remove a reference to a buffer. If this is the last reference to the
* buffer, the buffer itself is also automatically freed.
*
* @param ref reference to the buffer, may be NULL
*
* @note it is recommended to use avfilter_unref_bufferp() instead of this
* function
*/
void avfilter_unref_buffer(AVFilterBufferRef *ref);
/**
* Remove a reference to a buffer and set the pointer to NULL.
* If this is the last reference to the buffer, the buffer itself
* is also automatically freed.
*
* @param ref pointer to the buffer reference
*/
void avfilter_unref_bufferp(AVFilterBufferRef **ref);
#if FF_API_AVFILTERPAD_PUBLIC
/**
* A filter pad used for either input or output.
*
* See doc/filter_design.txt for details on how to implement the methods.
*
* @warning this struct might be removed from public API.
* users should call avfilter_pad_get_name() and avfilter_pad_get_type()
* to access the name and type fields; there should be no need to access
* any other fields from outside of libavfilter.
*/
struct AVFilterPad {
/**
* Pad name. The name is unique among inputs and among outputs, but an
* input may have the same name as an output. This may be NULL if this
* pad has no need to ever be referenced by name.
*/
const char *name;
/**
* AVFilterPad type.
*/
enum AVMediaType type;
/**
* Input pads:
* Minimum required permissions on incoming buffers. Any buffer with
* insufficient permissions will be automatically copied by the filter
* system to a new buffer which provides the needed access permissions.
*
* Output pads:
* Guaranteed permissions on outgoing buffers. Any buffer pushed on the
* link must have at least these permissions; this fact is checked by
* asserts. It can be used to optimize buffer allocation.
*/
int min_perms;
/**
* Input pads:
* Permissions which are not accepted on incoming buffers. Any buffer
* which has any of these permissions set will be automatically copied
* by the filter system to a new buffer which does not have those
* permissions. This can be used to easily disallow buffers with
* AV_PERM_REUSE.
*
* Output pads:
* Permissions which are automatically removed on outgoing buffers. It
* can be used to optimize buffer allocation.
*/
int rej_perms;
/**
* Callback called before passing the first slice of a new frame. If
* NULL, the filter layer will default to storing a reference to the
* picture inside the link structure.
*
* The reference given as argument is also available in link->cur_buf.
* It can be stored elsewhere or given away, but then clearing
* link->cur_buf is advised, as it is automatically unreferenced.
* The reference must not be unreferenced before end_frame(), as it may
* still be in use by the automatic copy mechanism.
*
* Input video pads only.
*
* @return >= 0 on success, a negative AVERROR on error. picref will be
* unreferenced by the caller in case of error.
*/
int (*start_frame)(AVFilterLink *link, AVFilterBufferRef *picref);
/**
* Callback function to get a video buffer. If NULL, the filter system will
* use avfilter_default_get_video_buffer().
*
* Input video pads only.
*/
AVFilterBufferRef *(*get_video_buffer)(AVFilterLink *link, int perms, int w, int h);
/**
* Callback function to get an audio buffer. If NULL, the filter system will
* use avfilter_default_get_audio_buffer().
*
* Input audio pads only.
*/
AVFilterBufferRef *(*get_audio_buffer)(AVFilterLink *link, int perms,
int nb_samples);
/**
* Callback called after the slices of a frame are completely sent. If
* NULL, the filter layer will default to releasing the reference stored
* in the link structure during start_frame().
*
* Input video pads only.
*
* @return >= 0 on success, a negative AVERROR on error.
*/
int (*end_frame)(AVFilterLink *link);
/**
* Slice drawing callback. This is where a filter receives video data
* and should do its processing.
*
* Input video pads only.
*
* @return >= 0 on success, a negative AVERROR on error.
*/
int (*draw_slice)(AVFilterLink *link, int y, int height, int slice_dir);
/**
* Samples filtering callback. This is where a filter receives audio data
* and should do its processing.
*
* Input audio pads only.
*
* @return >= 0 on success, a negative AVERROR on error. This function
* must ensure that samplesref is properly unreferenced on error if it
* hasn't been passed on to another filter.
*/
int (*filter_samples)(AVFilterLink *link, AVFilterBufferRef *samplesref);
/**
* Frame poll callback. This returns the number of immediately available
* samples. It should return a positive value if the next request_frame()
* is guaranteed to return one frame (with no delay).
*
* Defaults to just calling the source poll_frame() method.
*
* Output pads only.
*/
int (*poll_frame)(AVFilterLink *link);
/**
* Frame request callback. A call to this should result in at least one
* frame being output over the given link. This should return zero on
* success, and another value on error.
* See ff_request_frame() for the error codes with a specific
* meaning.
*
* Output pads only.
*/
int (*request_frame)(AVFilterLink *link);
/**
* Link configuration callback.
*
* For output pads, this should set the following link properties:
* video: width, height, sample_aspect_ratio, time_base
* audio: sample_rate.
*
* This should NOT set properties such as format, channel_layout, etc which
* are negotiated between filters by the filter system using the
* query_formats() callback before this function is called.
*
* For input pads, this should check the properties of the link, and update
* the filter's internal state as necessary.
*
* For both input and output pads, this should return zero on success,
* and another value on error.
*/
int (*config_props)(AVFilterLink *link);
/**
* The filter expects a fifo to be inserted on its input link,
* typically because it has a delay.
*
* input pads only.
*/
int needs_fifo;
};
#endif
/**
* Get the name of an AVFilterPad.
*
* @param pads an array of AVFilterPads
* @param pad_idx index of the pad in the array it; is the caller's
* responsibility to ensure the index is valid
*
* @return name of the pad_idx'th pad in pads
*/
const char *avfilter_pad_get_name(AVFilterPad *pads, int pad_idx);
/**
* Get the type of an AVFilterPad.
*
* @param pads an array of AVFilterPads
* @param pad_idx index of the pad in the array; it is the caller's
* responsibility to ensure the index is valid
*
* @return type of the pad_idx'th pad in pads
*/
enum AVMediaType avfilter_pad_get_type(AVFilterPad *pads, int pad_idx);
/** default handler for end_frame() for video inputs */
attribute_deprecated
int avfilter_default_end_frame(AVFilterLink *link);
/**
* Filter definition. This defines the pads a filter contains, and all the
* callback functions used to interact with the filter.
*/
typedef struct AVFilter {
const char *name; ///< filter name
/**
* A description for the filter. You should use the
* NULL_IF_CONFIG_SMALL() macro to define it.
*/
const char *description;
const AVFilterPad *inputs; ///< NULL terminated list of inputs. NULL if none
const AVFilterPad *outputs; ///< NULL terminated list of outputs. NULL if none
/*****************************************************************
* All fields below this line are not part of the public API. They
* may not be used outside of libavfilter and can be changed and
* removed at will.
* New public fields should be added right above.
*****************************************************************
*/
/**
* Filter initialization function. Args contains the user-supplied
* parameters. FIXME: maybe an AVOption-based system would be better?
*/
int (*init)(AVFilterContext *ctx, const char *args);
/**
* Filter uninitialization function. Should deallocate any memory held
* by the filter, release any buffer references, etc. This does not need
* to deallocate the AVFilterContext->priv memory itself.
*/
void (*uninit)(AVFilterContext *ctx);
/**
* Queries formats/layouts supported by the filter and its pads, and sets
* the in_formats/in_chlayouts for links connected to its output pads,
* and out_formats/out_chlayouts for links connected to its input pads.
*
* @return zero on success, a negative value corresponding to an
* AVERROR code otherwise
*/
int (*query_formats)(AVFilterContext *);
int priv_size; ///< size of private data to allocate for the filter
/**
* Make the filter instance process a command.
*
* @param cmd the command to process, for handling simplicity all commands must be alphanumeric only
* @param arg the argument for the command
* @param res a buffer with size res_size where the filter(s) can return a response. This must not change when the command is not supported.
* @param flags if AVFILTER_CMD_FLAG_FAST is set and the command would be
* time consuming then a filter should treat it like an unsupported command
*
* @returns >=0 on success otherwise an error code.
* AVERROR(ENOSYS) on unsupported commands
*/
int (*process_command)(AVFilterContext *, const char *cmd, const char *arg, char *res, int res_len, int flags);
/**
* Filter initialization function, alternative to the init()
* callback. Args contains the user-supplied parameters, opaque is
* used for providing binary data.
*/
int (*init_opaque)(AVFilterContext *ctx, const char *args, void *opaque);
const AVClass *priv_class; ///< private class, containing filter specific options
} AVFilter;
/** An instance of a filter */
struct AVFilterContext {
const AVClass *av_class; ///< needed for av_log()
AVFilter *filter; ///< the AVFilter of which this is an instance
char *name; ///< name of this filter instance
AVFilterPad *input_pads; ///< array of input pads
AVFilterLink **inputs; ///< array of pointers to input links
#if FF_API_FOO_COUNT
unsigned input_count; ///< @deprecated use nb_inputs
#endif
unsigned nb_inputs; ///< number of input pads
AVFilterPad *output_pads; ///< array of output pads
AVFilterLink **outputs; ///< array of pointers to output links
#if FF_API_FOO_COUNT
unsigned output_count; ///< @deprecated use nb_outputs
#endif
unsigned nb_outputs; ///< number of output pads
void *priv; ///< private data for use by the filter
struct AVFilterCommand *command_queue;
};
/**
* A link between two filters. This contains pointers to the source and
* destination filters between which this link exists, and the indexes of
* the pads involved. In addition, this link also contains the parameters
* which have been negotiated and agreed upon between the filter, such as
* image dimensions, format, etc.
*/
struct AVFilterLink {
AVFilterContext *src; ///< source filter
AVFilterPad *srcpad; ///< output pad on the source filter
AVFilterContext *dst; ///< dest filter
AVFilterPad *dstpad; ///< input pad on the dest filter
enum AVMediaType type; ///< filter media type
/* These parameters apply only to video */
int w; ///< agreed upon image width
int h; ///< agreed upon image height
AVRational sample_aspect_ratio; ///< agreed upon sample aspect ratio
/* These parameters apply only to audio */
uint64_t channel_layout; ///< channel layout of current buffer (see libavutil/audioconvert.h)
int sample_rate; ///< samples per second
int format; ///< agreed upon media format
/**
* Define the time base used by the PTS of the frames/samples
* which will pass through this link.
* During the configuration stage, each filter is supposed to
* change only the output timebase, while the timebase of the
* input link is assumed to be an unchangeable property.
*/
AVRational time_base;
/*****************************************************************
* All fields below this line are not part of the public API. They
* may not be used outside of libavfilter and can be changed and
* removed at will.
* New public fields should be added right above.
*****************************************************************
*/
/**
* Lists of formats and channel layouts supported by the input and output
* filters respectively. These lists are used for negotiating the format
* to actually be used, which will be loaded into the format and
* channel_layout members, above, when chosen.
*
*/
AVFilterFormats *in_formats;
AVFilterFormats *out_formats;
/**
* Lists of channel layouts and sample rates used for automatic
* negotiation.
*/
AVFilterFormats *in_samplerates;
AVFilterFormats *out_samplerates;
struct AVFilterChannelLayouts *in_channel_layouts;
struct AVFilterChannelLayouts *out_channel_layouts;
/**
* Audio only, the destination filter sets this to a non-zero value to
* request that buffers with the given number of samples should be sent to
* it. AVFilterPad.needs_fifo must also be set on the corresponding input
* pad.
* Last buffer before EOF will be padded with silence.
*/
int request_samples;
/** stage of the initialization of the link properties (dimensions, etc) */
enum {
AVLINK_UNINIT = 0, ///< not started
AVLINK_STARTINIT, ///< started, but incomplete
AVLINK_INIT ///< complete
} init_state;
/**
* The buffer reference currently being sent across the link by the source
* filter. This is used internally by the filter system to allow
* automatic copying of buffers which do not have sufficient permissions
* for the destination. This should not be accessed directly by the
* filters.
*/
AVFilterBufferRef *src_buf;
/**
* The buffer reference to the frame sent across the link by the
* source filter, which is read by the destination filter. It is
* automatically set up by ff_start_frame().
*
* Depending on the permissions, it may either be the same as
* src_buf or an automatic copy of it.
*
* It is automatically freed by the filter system when calling
* ff_end_frame(). In case you save the buffer reference
* internally (e.g. if you cache it for later reuse), or give it
* away (e.g. if you pass the reference to the next filter) it
* must be set to NULL before calling ff_end_frame().
*/
AVFilterBufferRef *cur_buf;
/**
* The buffer reference to the frame which is sent to output by
* the source filter.
*
* If no start_frame callback is defined on a link,
* ff_start_frame() will automatically request a new buffer on the
* first output link of the destination filter. The reference to
* the buffer so obtained is stored in the out_buf field on the
* output link.
*
* It can also be set by the filter code in case the filter needs
* to access the output buffer later. For example the filter code
* may set it in a custom start_frame, and access it in
* draw_slice.
*
* It is automatically freed by the filter system in
* ff_end_frame().
*/
AVFilterBufferRef *out_buf;
struct AVFilterPool *pool;
/**
* Graph the filter belongs to.
*/
struct AVFilterGraph *graph;
/**
* Current timestamp of the link, as defined by the most recent
* frame(s), in AV_TIME_BASE units.
*/
int64_t current_pts;
/**
* Index in the age array.
*/
int age_index;
/**
* Frame rate of the stream on the link, or 1/0 if unknown;
* if left to 0/0, will be automatically be copied from the first input
* of the source filter if it exists.
*
* Sources should set it to the best estimation of the real frame rate.
* Filters should update it if necessary depending on their function.
* Sinks can use it to set a default output frame rate.
* It is similar to the r_frame_rate field in AVStream.
*/
AVRational frame_rate;
/**
* Buffer partially filled with samples to achieve a fixed/minimum size.
*/
AVFilterBufferRef *partial_buf;
/**
* Size of the partial buffer to allocate.
* Must be between min_samples and max_samples.
*/
int partial_buf_size;
/**
* Minimum number of samples to filter at once. If filter_samples() is
* called with fewer samples, it will accumulate them in partial_buf.
* This field and the related ones must not be changed after filtering
* has started.
* If 0, all related fields are ignored.
*/
int min_samples;
/**
* Maximum number of samples to filter at once. If filter_samples() is
* called with more samples, it will split them.
*/
int max_samples;
/**
* The buffer reference currently being received across the link by the
* destination filter. This is used internally by the filter system to
* allow automatic copying of buffers which do not have sufficient
* permissions for the destination. This should not be accessed directly
* by the filters.
*/
AVFilterBufferRef *cur_buf_copy;
/**
* True if the link is closed.
* If set, all attemps of start_frame, filter_samples or request_frame
* will fail with AVERROR_EOF, and if necessary the reference will be
* destroyed.
* If request_frame returns AVERROR_EOF, this flag is set on the
* corresponding link.
* It can be set also be set by either the source or the destination
* filter.
*/
int closed;
};
/**
* Link two filters together.
*
* @param src the source filter
* @param srcpad index of the output pad on the source filter
* @param dst the destination filter
* @param dstpad index of the input pad on the destination filter
* @return zero on success
*/
int avfilter_link(AVFilterContext *src, unsigned srcpad,
AVFilterContext *dst, unsigned dstpad);
/**
* Free the link in *link, and set its pointer to NULL.
*/
void avfilter_link_free(AVFilterLink **link);
/**
* Set the closed field of a link.
*/
void avfilter_link_set_closed(AVFilterLink *link, int closed);
/**
* Negotiate the media format, dimensions, etc of all inputs to a filter.
*
* @param filter the filter to negotiate the properties for its inputs
* @return zero on successful negotiation
*/
int avfilter_config_links(AVFilterContext *filter);
/**
* Create a buffer reference wrapped around an already allocated image
* buffer.
*
* @param data pointers to the planes of the image to reference
* @param linesize linesizes for the planes of the image to reference
* @param perms the required access permissions
* @param w the width of the image specified by the data and linesize arrays
* @param h the height of the image specified by the data and linesize arrays
* @param format the pixel format of the image specified by the data and linesize arrays
*/
AVFilterBufferRef *
avfilter_get_video_buffer_ref_from_arrays(uint8_t * const data[4], const int linesize[4], int perms,
int w, int h, enum PixelFormat format);
/**
* Create an audio buffer reference wrapped around an already
* allocated samples buffer.
*
* @param data pointers to the samples plane buffers
* @param linesize linesize for the samples plane buffers
* @param perms the required access permissions
* @param nb_samples number of samples per channel
* @param sample_fmt the format of each sample in the buffer to allocate
* @param channel_layout the channel layout of the buffer
*/
AVFilterBufferRef *avfilter_get_audio_buffer_ref_from_arrays(uint8_t **data,
int linesize,
int perms,
int nb_samples,
enum AVSampleFormat sample_fmt,
uint64_t channel_layout);
#define AVFILTER_CMD_FLAG_ONE 1 ///< Stop once a filter understood the command (for target=all for example), fast filters are favored automatically
#define AVFILTER_CMD_FLAG_FAST 2 ///< Only execute command when its fast (like a video out that supports contrast adjustment in hw)
/**
* Make the filter instance process a command.
* It is recommended to use avfilter_graph_send_command().
*/
int avfilter_process_command(AVFilterContext *filter, const char *cmd, const char *arg, char *res, int res_len, int flags);
/** Initialize the filter system. Register all builtin filters. */
void avfilter_register_all(void);
/** Uninitialize the filter system. Unregister all filters. */
void avfilter_uninit(void);
/**
* Register a filter. This is only needed if you plan to use
* avfilter_get_by_name later to lookup the AVFilter structure by name. A
* filter can still by instantiated with avfilter_open even if it is not
* registered.
*
* @param filter the filter to register
* @return 0 if the registration was successful, a negative value
* otherwise
*/
int avfilter_register(AVFilter *filter);
/**
* Get a filter definition matching the given name.
*
* @param name the filter name to find
* @return the filter definition, if any matching one is registered.
* NULL if none found.
*/
AVFilter *avfilter_get_by_name(const char *name);
/**
* If filter is NULL, returns a pointer to the first registered filter pointer,
* if filter is non-NULL, returns the next pointer after filter.
* If the returned pointer points to NULL, the last registered filter
* was already reached.
*/
AVFilter **av_filter_next(AVFilter **filter);
/**
* Create a filter instance.
*
* @param filter_ctx put here a pointer to the created filter context
* on success, NULL on failure
* @param filter the filter to create an instance of
* @param inst_name Name to give to the new instance. Can be NULL for none.
* @return >= 0 in case of success, a negative error code otherwise
*/
int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *inst_name);
/**
* Initialize a filter.
*
* @param filter the filter to initialize
* @param args A string of parameters to use when initializing the filter.
* The format and meaning of this string varies by filter.
* @param opaque Any extra non-string data needed by the filter. The meaning
* of this parameter varies by filter.
* @return zero on success
*/
int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque);
/**
* Free a filter context.
*
* @param filter the filter to free
*/
void avfilter_free(AVFilterContext *filter);
/**
* Insert a filter in the middle of an existing link.
*
* @param link the link into which the filter should be inserted
* @param filt the filter to be inserted
* @param filt_srcpad_idx the input pad on the filter to connect
* @param filt_dstpad_idx the output pad on the filter to connect
* @return zero on success
*/
int avfilter_insert_filter(AVFilterLink *link, AVFilterContext *filt,
unsigned filt_srcpad_idx, unsigned filt_dstpad_idx);
#endif /* AVFILTER_AVFILTER_H */
| 32,182 | 36.077189 | 149 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libavfilter/avfiltergraph.h
|
/*
* Filter graphs
* copyright (c) 2007 Bobby Bingham
*
* This file is part of FFmpeg.
*
* FFmpeg 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.
*
* FFmpeg 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 FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVFILTER_AVFILTERGRAPH_H
#define AVFILTER_AVFILTERGRAPH_H
#include "avfilter.h"
#include "libavutil/log.h"
typedef struct AVFilterGraph {
const AVClass *av_class;
unsigned filter_count;
AVFilterContext **filters;
char *scale_sws_opts; ///< sws options to use for the auto-inserted scale filters
/**
* Private fields
*
* The following fields are for internal use only.
* Their type, offset, number and semantic can change without notice.
*/
AVFilterLink **sink_links;
int sink_links_count;
unsigned disable_auto_convert;
} AVFilterGraph;
/**
* Allocate a filter graph.
*/
AVFilterGraph *avfilter_graph_alloc(void);
/**
* Get a filter instance with name name from graph.
*
* @return the pointer to the found filter instance or NULL if it
* cannot be found.
*/
AVFilterContext *avfilter_graph_get_filter(AVFilterGraph *graph, char *name);
/**
* Add an existing filter instance to a filter graph.
*
* @param graphctx the filter graph
* @param filter the filter to be added
*/
int avfilter_graph_add_filter(AVFilterGraph *graphctx, AVFilterContext *filter);
/**
* Create and add a filter instance into an existing graph.
* The filter instance is created from the filter filt and inited
* with the parameters args and opaque.
*
* In case of success put in *filt_ctx the pointer to the created
* filter instance, otherwise set *filt_ctx to NULL.
*
* @param name the instance name to give to the created filter instance
* @param graph_ctx the filter graph
* @return a negative AVERROR error code in case of failure, a non
* negative value otherwise
*/
int avfilter_graph_create_filter(AVFilterContext **filt_ctx, AVFilter *filt,
const char *name, const char *args, void *opaque,
AVFilterGraph *graph_ctx);
/**
* Enable or disable automatic format conversion inside the graph.
*
* Note that format conversion can still happen inside explicitly inserted
* scale and aconvert filters.
*
* @param flags any of the AVFILTER_AUTO_CONVERT_* constants
*/
void avfilter_graph_set_auto_convert(AVFilterGraph *graph, unsigned flags);
enum {
AVFILTER_AUTO_CONVERT_ALL = 0, /**< all automatic conversions enabled */
AVFILTER_AUTO_CONVERT_NONE = -1, /**< all automatic conversions disabled */
};
/**
* Check validity and configure all the links and formats in the graph.
*
* @param graphctx the filter graph
* @param log_ctx context used for logging
* @return 0 in case of success, a negative AVERROR code otherwise
*/
int avfilter_graph_config(AVFilterGraph *graphctx, void *log_ctx);
/**
* Free a graph, destroy its links, and set *graph to NULL.
* If *graph is NULL, do nothing.
*/
void avfilter_graph_free(AVFilterGraph **graph);
/**
* A linked-list of the inputs/outputs of the filter chain.
*
* This is mainly useful for avfilter_graph_parse() / avfilter_graph_parse2(),
* where it is used to communicate open (unlinked) inputs and outputs from and
* to the caller.
* This struct specifies, per each not connected pad contained in the graph, the
* filter context and the pad index required for establishing a link.
*/
typedef struct AVFilterInOut {
/** unique name for this input/output in the list */
char *name;
/** filter context associated to this input/output */
AVFilterContext *filter_ctx;
/** index of the filt_ctx pad to use for linking */
int pad_idx;
/** next input/input in the list, NULL if this is the last */
struct AVFilterInOut *next;
} AVFilterInOut;
/**
* Allocate a single AVFilterInOut entry.
* Must be freed with avfilter_inout_free().
* @return allocated AVFilterInOut on success, NULL on failure.
*/
AVFilterInOut *avfilter_inout_alloc(void);
/**
* Free the supplied list of AVFilterInOut and set *inout to NULL.
* If *inout is NULL, do nothing.
*/
void avfilter_inout_free(AVFilterInOut **inout);
/**
* Add a graph described by a string to a graph.
*
* @param graph the filter graph where to link the parsed graph context
* @param filters string to be parsed
* @param inputs pointer to a linked list to the inputs of the graph, may be NULL.
* If non-NULL, *inputs is updated to contain the list of open inputs
* after the parsing, should be freed with avfilter_inout_free().
* @param outputs pointer to a linked list to the outputs of the graph, may be NULL.
* If non-NULL, *outputs is updated to contain the list of open outputs
* after the parsing, should be freed with avfilter_inout_free().
* @return non negative on success, a negative AVERROR code on error
*/
int avfilter_graph_parse(AVFilterGraph *graph, const char *filters,
AVFilterInOut **inputs, AVFilterInOut **outputs,
void *log_ctx);
/**
* Add a graph described by a string to a graph.
*
* @param[in] graph the filter graph where to link the parsed graph context
* @param[in] filters string to be parsed
* @param[out] inputs a linked list of all free (unlinked) inputs of the
* parsed graph will be returned here. It is to be freed
* by the caller using avfilter_inout_free().
* @param[out] outputs a linked list of all free (unlinked) outputs of the
* parsed graph will be returned here. It is to be freed by the
* caller using avfilter_inout_free().
* @return zero on success, a negative AVERROR code on error
*
* @note the difference between avfilter_graph_parse2() and
* avfilter_graph_parse() is that in avfilter_graph_parse(), the caller provides
* the lists of inputs and outputs, which therefore must be known before calling
* the function. On the other hand, avfilter_graph_parse2() \em returns the
* inputs and outputs that are left unlinked after parsing the graph and the
* caller then deals with them. Another difference is that in
* avfilter_graph_parse(), the inputs parameter describes inputs of the
* <em>already existing</em> part of the graph; i.e. from the point of view of
* the newly created part, they are outputs. Similarly the outputs parameter
* describes outputs of the already existing filters, which are provided as
* inputs to the parsed filters.
* avfilter_graph_parse2() takes the opposite approach -- it makes no reference
* whatsoever to already existing parts of the graph and the inputs parameter
* will on return contain inputs of the newly parsed part of the graph.
* Analogously the outputs parameter will contain outputs of the newly created
* filters.
*/
int avfilter_graph_parse2(AVFilterGraph *graph, const char *filters,
AVFilterInOut **inputs,
AVFilterInOut **outputs);
/**
* Send a command to one or more filter instances.
*
* @param graph the filter graph
* @param target the filter(s) to which the command should be sent
* "all" sends to all filters
* otherwise it can be a filter or filter instance name
* which will send the command to all matching filters.
* @param cmd the command to sent, for handling simplicity all commands must be alphanumeric only
* @param arg the argument for the command
* @param res a buffer with size res_size where the filter(s) can return a response.
*
* @returns >=0 on success otherwise an error code.
* AVERROR(ENOSYS) on unsupported commands
*/
int avfilter_graph_send_command(AVFilterGraph *graph, const char *target, const char *cmd, const char *arg, char *res, int res_len, int flags);
/**
* Queue a command for one or more filter instances.
*
* @param graph the filter graph
* @param target the filter(s) to which the command should be sent
* "all" sends to all filters
* otherwise it can be a filter or filter instance name
* which will send the command to all matching filters.
* @param cmd the command to sent, for handling simplicity all commands must be alphanummeric only
* @param arg the argument for the command
* @param ts time at which the command should be sent to the filter
*
* @note As this executes commands after this function returns, no return code
* from the filter is provided, also AVFILTER_CMD_FLAG_ONE is not supported.
*/
int avfilter_graph_queue_command(AVFilterGraph *graph, const char *target, const char *cmd, const char *arg, int flags, double ts);
/**
* Dump a graph into a human-readable string representation.
*
* @param graph the graph to dump
* @param options formatting options; currently ignored
* @return a string, or NULL in case of memory allocation failure;
* the string must be freed using av_free
*/
char *avfilter_graph_dump(AVFilterGraph *graph, const char *options);
/**
* Request a frame on the oldest sink link.
*
* If the request returns AVERROR_EOF, try the next.
*
* Note that this function is not meant to be the sole scheduling mechanism
* of a filtergraph, only a convenience function to help drain a filtergraph
* in a balanced way under normal circumstances.
*
* Also note that AVERROR_EOF does not mean that frames did not arrive on
* some of the sinks during the process.
* When there are multiple sink links, in case the requested link
* returns an EOF, this may cause a filter to flush pending frames
* which are sent to another sink link, although unrequested.
*
* @return the return value of ff_request_frame(),
* or AVERROR_EOF if all links returned AVERROR_EOF
*/
int avfilter_graph_request_oldest(AVFilterGraph *graph);
#endif /* AVFILTER_AVFILTERGRAPH_H */
| 10,554 | 38.092593 | 143 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libswscale/swscale.h
|
/*
* Copyright (C) 2001-2011 Michael Niedermayer <[email protected]>
*
* This file is part of FFmpeg.
*
* FFmpeg 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.
*
* FFmpeg 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 FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef SWSCALE_SWSCALE_H
#define SWSCALE_SWSCALE_H
/**
* @file
* @brief
* external api for the swscale stuff
*/
#include <stdint.h>
#include "libavutil/avutil.h"
#include "libavutil/log.h"
#include "libavutil/pixfmt.h"
#include "version.h"
/**
* Return the LIBSWSCALE_VERSION_INT constant.
*/
unsigned swscale_version(void);
/**
* Return the libswscale build-time configuration.
*/
const char *swscale_configuration(void);
/**
* Return the libswscale license.
*/
const char *swscale_license(void);
/* values for the flags, the stuff on the command line is different */
#define SWS_FAST_BILINEAR 1
#define SWS_BILINEAR 2
#define SWS_BICUBIC 4
#define SWS_X 8
#define SWS_POINT 0x10
#define SWS_AREA 0x20
#define SWS_BICUBLIN 0x40
#define SWS_GAUSS 0x80
#define SWS_SINC 0x100
#define SWS_LANCZOS 0x200
#define SWS_SPLINE 0x400
#define SWS_SRC_V_CHR_DROP_MASK 0x30000
#define SWS_SRC_V_CHR_DROP_SHIFT 16
#define SWS_PARAM_DEFAULT 123456
#define SWS_PRINT_INFO 0x1000
//the following 3 flags are not completely implemented
//internal chrominace subsampling info
#define SWS_FULL_CHR_H_INT 0x2000
//input subsampling info
#define SWS_FULL_CHR_H_INP 0x4000
#define SWS_DIRECT_BGR 0x8000
#define SWS_ACCURATE_RND 0x40000
#define SWS_BITEXACT 0x80000
#if FF_API_SWS_CPU_CAPS
/**
* CPU caps are autodetected now, those flags
* are only provided for API compatibility.
*/
#define SWS_CPU_CAPS_MMX 0x80000000
#define SWS_CPU_CAPS_MMXEXT 0x20000000
#if LIBSWSCALE_VERSION_MAJOR < 3
#define SWS_CPU_CAPS_MMX2 0x20000000
#endif
#define SWS_CPU_CAPS_3DNOW 0x40000000
#define SWS_CPU_CAPS_ALTIVEC 0x10000000
#define SWS_CPU_CAPS_BFIN 0x01000000
#define SWS_CPU_CAPS_SSE2 0x02000000
#endif
#define SWS_MAX_REDUCE_CUTOFF 0.002
#define SWS_CS_ITU709 1
#define SWS_CS_FCC 4
#define SWS_CS_ITU601 5
#define SWS_CS_ITU624 5
#define SWS_CS_SMPTE170M 5
#define SWS_CS_SMPTE240M 7
#define SWS_CS_DEFAULT 5
/**
* Return a pointer to yuv<->rgb coefficients for the given colorspace
* suitable for sws_setColorspaceDetails().
*
* @param colorspace One of the SWS_CS_* macros. If invalid,
* SWS_CS_DEFAULT is used.
*/
const int *sws_getCoefficients(int colorspace);
// when used for filters they must have an odd number of elements
// coeffs cannot be shared between vectors
typedef struct {
double *coeff; ///< pointer to the list of coefficients
int length; ///< number of coefficients in the vector
} SwsVector;
// vectors can be shared
typedef struct {
SwsVector *lumH;
SwsVector *lumV;
SwsVector *chrH;
SwsVector *chrV;
} SwsFilter;
struct SwsContext;
/**
* Return a positive value if pix_fmt is a supported input format, 0
* otherwise.
*/
int sws_isSupportedInput(enum PixelFormat pix_fmt);
/**
* Return a positive value if pix_fmt is a supported output format, 0
* otherwise.
*/
int sws_isSupportedOutput(enum PixelFormat pix_fmt);
/**
* Allocate an empty SwsContext. This must be filled and passed to
* sws_init_context(). For filling see AVOptions, options.c and
* sws_setColorspaceDetails().
*/
struct SwsContext *sws_alloc_context(void);
/**
* Initialize the swscaler context sws_context.
*
* @return zero or positive value on success, a negative value on
* error
*/
int sws_init_context(struct SwsContext *sws_context, SwsFilter *srcFilter, SwsFilter *dstFilter);
/**
* Free the swscaler context swsContext.
* If swsContext is NULL, then does nothing.
*/
void sws_freeContext(struct SwsContext *swsContext);
#if FF_API_SWS_GETCONTEXT
/**
* Allocate and return an SwsContext. You need it to perform
* scaling/conversion operations using sws_scale().
*
* @param srcW the width of the source image
* @param srcH the height of the source image
* @param srcFormat the source image format
* @param dstW the width of the destination image
* @param dstH the height of the destination image
* @param dstFormat the destination image format
* @param flags specify which algorithm and options to use for rescaling
* @return a pointer to an allocated context, or NULL in case of error
* @note this function is to be removed after a saner alternative is
* written
* @deprecated Use sws_getCachedContext() instead.
*/
struct SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat,
int dstW, int dstH, enum PixelFormat dstFormat,
int flags, SwsFilter *srcFilter,
SwsFilter *dstFilter, const double *param);
#endif
/**
* Scale the image slice in srcSlice and put the resulting scaled
* slice in the image in dst. A slice is a sequence of consecutive
* rows in an image.
*
* Slices have to be provided in sequential order, either in
* top-bottom or bottom-top order. If slices are provided in
* non-sequential order the behavior of the function is undefined.
*
* @param c the scaling context previously created with
* sws_getContext()
* @param srcSlice the array containing the pointers to the planes of
* the source slice
* @param srcStride the array containing the strides for each plane of
* the source image
* @param srcSliceY the position in the source image of the slice to
* process, that is the number (counted starting from
* zero) in the image of the first row of the slice
* @param srcSliceH the height of the source slice, that is the number
* of rows in the slice
* @param dst the array containing the pointers to the planes of
* the destination image
* @param dstStride the array containing the strides for each plane of
* the destination image
* @return the height of the output slice
*/
int sws_scale(struct SwsContext *c, const uint8_t *const srcSlice[],
const int srcStride[], int srcSliceY, int srcSliceH,
uint8_t *const dst[], const int dstStride[]);
/**
* @param dstRange flag indicating the while-black range of the output (1=jpeg / 0=mpeg)
* @param srcRange flag indicating the while-black range of the input (1=jpeg / 0=mpeg)
* @param table the yuv2rgb coefficients describing the output yuv space, normally ff_yuv2rgb_coeffs[x]
* @param inv_table the yuv2rgb coefficients describing the input yuv space, normally ff_yuv2rgb_coeffs[x]
* @param brightness 16.16 fixed point brightness correction
* @param contrast 16.16 fixed point contrast correction
* @param saturation 16.16 fixed point saturation correction
* @return -1 if not supported
*/
int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4],
int srcRange, const int table[4], int dstRange,
int brightness, int contrast, int saturation);
/**
* @return -1 if not supported
*/
int sws_getColorspaceDetails(struct SwsContext *c, int **inv_table,
int *srcRange, int **table, int *dstRange,
int *brightness, int *contrast, int *saturation);
/**
* Allocate and return an uninitialized vector with length coefficients.
*/
SwsVector *sws_allocVec(int length);
/**
* Return a normalized Gaussian curve used to filter stuff
* quality = 3 is high quality, lower is lower quality.
*/
SwsVector *sws_getGaussianVec(double variance, double quality);
/**
* Allocate and return a vector with length coefficients, all
* with the same value c.
*/
SwsVector *sws_getConstVec(double c, int length);
/**
* Allocate and return a vector with just one coefficient, with
* value 1.0.
*/
SwsVector *sws_getIdentityVec(void);
/**
* Scale all the coefficients of a by the scalar value.
*/
void sws_scaleVec(SwsVector *a, double scalar);
/**
* Scale all the coefficients of a so that their sum equals height.
*/
void sws_normalizeVec(SwsVector *a, double height);
void sws_convVec(SwsVector *a, SwsVector *b);
void sws_addVec(SwsVector *a, SwsVector *b);
void sws_subVec(SwsVector *a, SwsVector *b);
void sws_shiftVec(SwsVector *a, int shift);
/**
* Allocate and return a clone of the vector a, that is a vector
* with the same coefficients as a.
*/
SwsVector *sws_cloneVec(SwsVector *a);
/**
* Print with av_log() a textual representation of the vector a
* if log_level <= av_log_level.
*/
void sws_printVec2(SwsVector *a, AVClass *log_ctx, int log_level);
void sws_freeVec(SwsVector *a);
SwsFilter *sws_getDefaultFilter(float lumaGBlur, float chromaGBlur,
float lumaSharpen, float chromaSharpen,
float chromaHShift, float chromaVShift,
int verbose);
void sws_freeFilter(SwsFilter *filter);
/**
* Check if context can be reused, otherwise reallocate a new one.
*
* If context is NULL, just calls sws_getContext() to get a new
* context. Otherwise, checks if the parameters are the ones already
* saved in context. If that is the case, returns the current
* context. Otherwise, frees context and gets a new context with
* the new parameters.
*
* Be warned that srcFilter and dstFilter are not checked, they
* are assumed to remain the same.
*/
struct SwsContext *sws_getCachedContext(struct SwsContext *context,
int srcW, int srcH, enum PixelFormat srcFormat,
int dstW, int dstH, enum PixelFormat dstFormat,
int flags, SwsFilter *srcFilter,
SwsFilter *dstFilter, const double *param);
/**
* Convert an 8-bit paletted frame into a frame with a color depth of 32 bits.
*
* The output frame will have the same packed format as the palette.
*
* @param src source frame buffer
* @param dst destination frame buffer
* @param num_pixels number of pixels to convert
* @param palette array with [256] entries, which must match color arrangement (RGB or BGR) of src
*/
void sws_convertPalette8ToPacked32(const uint8_t *src, uint8_t *dst, int num_pixels, const uint8_t *palette);
/**
* Convert an 8-bit paletted frame into a frame with a color depth of 24 bits.
*
* With the palette format "ABCD", the destination frame ends up with the format "ABC".
*
* @param src source frame buffer
* @param dst destination frame buffer
* @param num_pixels number of pixels to convert
* @param palette array with [256] entries, which must match color arrangement (RGB or BGR) of src
*/
void sws_convertPalette8ToPacked24(const uint8_t *src, uint8_t *dst, int num_pixels, const uint8_t *palette);
/**
* Get the AVClass for swsContext. It can be used in combination with
* AV_OPT_SEARCH_FAKE_OBJ for examining options.
*
* @see av_opt_find().
*/
const AVClass *sws_get_class(void);
#endif /* SWSCALE_SWSCALE_H */
| 11,948 | 33.336207 | 109 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libswscale/version.h
|
/*
* This file is part of FFmpeg.
*
* FFmpeg 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.
*
* FFmpeg 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 FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef SWSCALE_VERSION_H
#define SWSCALE_VERSION_H
/**
* @file
* swscale version macros
*/
#include "libavutil/avutil.h"
#define LIBSWSCALE_VERSION_MAJOR 2
#define LIBSWSCALE_VERSION_MINOR 1
#define LIBSWSCALE_VERSION_MICRO 101
#define LIBSWSCALE_VERSION_INT AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \
LIBSWSCALE_VERSION_MINOR, \
LIBSWSCALE_VERSION_MICRO)
#define LIBSWSCALE_VERSION AV_VERSION(LIBSWSCALE_VERSION_MAJOR, \
LIBSWSCALE_VERSION_MINOR, \
LIBSWSCALE_VERSION_MICRO)
#define LIBSWSCALE_BUILD LIBSWSCALE_VERSION_INT
#define LIBSWSCALE_IDENT "SwS" AV_STRINGIFY(LIBSWSCALE_VERSION)
/**
* FF_API_* defines may be placed below to indicate public API that will be
* dropped at a future version bump. The defines themselves are not part of
* the public API and may change, break or disappear at any time.
*/
#ifndef FF_API_SWS_GETCONTEXT
#define FF_API_SWS_GETCONTEXT (LIBSWSCALE_VERSION_MAJOR < 3)
#endif
#ifndef FF_API_SWS_CPU_CAPS
#define FF_API_SWS_CPU_CAPS (LIBSWSCALE_VERSION_MAJOR < 3)
#endif
#ifndef FF_API_SWS_FORMAT_NAME
#define FF_API_SWS_FORMAT_NAME (LIBSWSCALE_VERSION_MAJOR < 3)
#endif
#endif /* SWSCALE_VERSION_H */
| 2,118 | 34.316667 | 79 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libavutil/adler32.h
|
/*
* copyright (c) 2006 Mans Rullgard
*
* This file is part of FFmpeg.
*
* FFmpeg 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.
*
* FFmpeg 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 FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVUTIL_ADLER32_H
#define AVUTIL_ADLER32_H
#include <stdint.h>
#include "attributes.h"
/**
* @ingroup lavu_crypto
* Calculate the Adler32 checksum of a buffer.
*
* Passing the return value to a subsequent av_adler32_update() call
* allows the checksum of multiple buffers to be calculated as though
* they were concatenated.
*
* @param adler initial checksum value
* @param buf pointer to input buffer
* @param len size of input buffer
* @return updated checksum
*/
unsigned long av_adler32_update(unsigned long adler, const uint8_t *buf,
unsigned int len) av_pure;
#endif /* AVUTIL_ADLER32_H */
| 1,462 | 32.25 | 79 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libavutil/random_seed.h
|
/*
* Copyright (c) 2009 Baptiste Coudurier <[email protected]>
*
* This file is part of FFmpeg.
*
* FFmpeg 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.
*
* FFmpeg 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 FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVUTIL_RANDOM_SEED_H
#define AVUTIL_RANDOM_SEED_H
#include <stdint.h>
/**
* @addtogroup lavu_crypto
* @{
*/
/**
* Get a seed to use in conjunction with random functions.
* This function tries to provide a good seed at a best effort bases.
* Its possible to call this function multiple times if more bits are needed.
* It can be quite slow, which is why it should only be used as seed for a faster
* PRNG. The quality of the seed depends on the platform.
*/
uint32_t av_get_random_seed(void);
/**
* @}
*/
#endif /* AVUTIL_RANDOM_SEED_H */
| 1,400 | 30.840909 | 81 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libavutil/audio_fifo.h
|
/*
* Audio FIFO
* Copyright (c) 2012 Justin Ruggles <[email protected]>
*
* This file is part of Libav.
*
* Libav 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.
*
* Libav 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 Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* @file
* Audio FIFO Buffer
*/
#ifndef AVUTIL_AUDIO_FIFO_H
#define AVUTIL_AUDIO_FIFO_H
#include "avutil.h"
#include "fifo.h"
#include "samplefmt.h"
/**
* @addtogroup lavu_audio
* @{
*/
/**
* Context for an Audio FIFO Buffer.
*
* - Operates at the sample level rather than the byte level.
* - Supports multiple channels with either planar or packed sample format.
* - Automatic reallocation when writing to a full buffer.
*/
typedef struct AVAudioFifo AVAudioFifo;
/**
* Free an AVAudioFifo.
*
* @param af AVAudioFifo to free
*/
void av_audio_fifo_free(AVAudioFifo *af);
/**
* Allocate an AVAudioFifo.
*
* @param sample_fmt sample format
* @param channels number of channels
* @param nb_samples initial allocation size, in samples
* @return newly allocated AVAudioFifo, or NULL on error
*/
AVAudioFifo *av_audio_fifo_alloc(enum AVSampleFormat sample_fmt, int channels,
int nb_samples);
/**
* Reallocate an AVAudioFifo.
*
* @param af AVAudioFifo to reallocate
* @param nb_samples new allocation size, in samples
* @return 0 if OK, or negative AVERROR code on failure
*/
int av_audio_fifo_realloc(AVAudioFifo *af, int nb_samples);
/**
* Write data to an AVAudioFifo.
*
* The AVAudioFifo will be reallocated automatically if the available space
* is less than nb_samples.
*
* @see enum AVSampleFormat
* The documentation for AVSampleFormat describes the data layout.
*
* @param af AVAudioFifo to write to
* @param data audio data plane pointers
* @param nb_samples number of samples to write
* @return number of samples actually written, or negative AVERROR
* code on failure.
*/
int av_audio_fifo_write(AVAudioFifo *af, void **data, int nb_samples);
/**
* Read data from an AVAudioFifo.
*
* @see enum AVSampleFormat
* The documentation for AVSampleFormat describes the data layout.
*
* @param af AVAudioFifo to read from
* @param data audio data plane pointers
* @param nb_samples number of samples to read
* @return number of samples actually read, or negative AVERROR code
* on failure.
*/
int av_audio_fifo_read(AVAudioFifo *af, void **data, int nb_samples);
/**
* Drain data from an AVAudioFifo.
*
* Removes the data without reading it.
*
* @param af AVAudioFifo to drain
* @param nb_samples number of samples to drain
* @return 0 if OK, or negative AVERROR code on failure
*/
int av_audio_fifo_drain(AVAudioFifo *af, int nb_samples);
/**
* Reset the AVAudioFifo buffer.
*
* This empties all data in the buffer.
*
* @param af AVAudioFifo to reset
*/
void av_audio_fifo_reset(AVAudioFifo *af);
/**
* Get the current number of samples in the AVAudioFifo available for reading.
*
* @param af the AVAudioFifo to query
* @return number of samples available for reading
*/
int av_audio_fifo_size(AVAudioFifo *af);
/**
* Get the current number of samples in the AVAudioFifo available for writing.
*
* @param af the AVAudioFifo to query
* @return number of samples available for writing
*/
int av_audio_fifo_space(AVAudioFifo *af);
/**
* @}
*/
#endif /* AVUTIL_AUDIO_FIFO_H */
| 4,105 | 26.931973 | 79 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libavutil/avutil.h
|
/*
* copyright (c) 2006 Michael Niedermayer <[email protected]>
*
* This file is part of FFmpeg.
*
* FFmpeg 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.
*
* FFmpeg 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 FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVUTIL_AVUTIL_H
#define AVUTIL_AVUTIL_H
/**
* @file
* external API header
*/
/*
* @mainpage
*
* @section ffmpeg_intro Introduction
*
* This document describes the usage of the different libraries
* provided by FFmpeg.
*
* @li @ref libavc "libavcodec" encoding/decoding library
* @li @subpage libavfilter graph based frame editing library
* @li @ref libavf "libavformat" I/O and muxing/demuxing library
* @li @ref lavd "libavdevice" special devices muxing/demuxing library
* @li @ref lavu "libavutil" common utility library
* @li @subpage libpostproc post processing library
* @li @subpage libswscale color conversion and scaling library
*/
/**
* @defgroup lavu Common utility functions
*
* @brief
* libavutil contains the code shared across all the other FFmpeg
* libraries
*
* @note In order to use the functions provided by avutil you must include
* the specific header.
*
* @{
*
* @defgroup lavu_crypto Crypto and Hashing
*
* @{
* @}
*
* @defgroup lavu_math Maths
* @{
*
* @}
*
* @defgroup lavu_string String Manipulation
*
* @{
*
* @}
*
* @defgroup lavu_mem Memory Management
*
* @{
*
* @}
*
* @defgroup lavu_data Data Structures
* @{
*
* @}
*
* @defgroup lavu_audio Audio related
*
* @{
*
* @}
*
* @defgroup lavu_error Error Codes
*
* @{
*
* @}
*
* @defgroup lavu_misc Other
*
* @{
*
* @defgroup lavu_internal Internal
*
* Not exported functions, for internal usage only
*
* @{
*
* @}
*/
/**
* @defgroup preproc_misc Preprocessor String Macros
*
* String manipulation macros
*
* @{
*/
#define AV_STRINGIFY(s) AV_TOSTRING(s)
#define AV_TOSTRING(s) #s
#define AV_GLUE(a, b) a ## b
#define AV_JOIN(a, b) AV_GLUE(a, b)
#define AV_PRAGMA(s) _Pragma(#s)
/**
* @}
*/
/**
* @defgroup version_utils Library Version Macros
*
* Useful to check and match library version in order to maintain
* backward compatibility.
*
* @{
*/
#define AV_VERSION_INT(a, b, c) (a<<16 | b<<8 | c)
#define AV_VERSION_DOT(a, b, c) a ##.## b ##.## c
#define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c)
/**
* @}
*/
/**
* @addtogroup lavu_ver
* @{
*/
/**
* Return the LIBAVUTIL_VERSION_INT constant.
*/
unsigned avutil_version(void);
/**
* Return the libavutil build-time configuration.
*/
const char *avutil_configuration(void);
/**
* Return the libavutil license.
*/
const char *avutil_license(void);
/**
* @}
*/
/**
* @addtogroup lavu_media Media Type
* @brief Media Type
*/
enum AVMediaType {
AVMEDIA_TYPE_UNKNOWN = -1, ///< Usually treated as AVMEDIA_TYPE_DATA
AVMEDIA_TYPE_VIDEO,
AVMEDIA_TYPE_AUDIO,
AVMEDIA_TYPE_DATA, ///< Opaque data information usually continuous
AVMEDIA_TYPE_SUBTITLE,
AVMEDIA_TYPE_ATTACHMENT, ///< Opaque data information usually sparse
AVMEDIA_TYPE_NB
};
/**
* Return a string describing the media_type enum, NULL if media_type
* is unknown.
*/
const char *av_get_media_type_string(enum AVMediaType media_type);
/**
* @defgroup lavu_const Constants
* @{
*
* @defgroup lavu_enc Encoding specific
*
* @note those definition should move to avcodec
* @{
*/
#define FF_LAMBDA_SHIFT 7
#define FF_LAMBDA_SCALE (1<<FF_LAMBDA_SHIFT)
#define FF_QP2LAMBDA 118 ///< factor to convert from H.263 QP to lambda
#define FF_LAMBDA_MAX (256*128-1)
#define FF_QUALITY_SCALE FF_LAMBDA_SCALE //FIXME maybe remove
/**
* @}
* @defgroup lavu_time Timestamp specific
*
* FFmpeg internal timebase and timestamp definitions
*
* @{
*/
/**
* @brief Undefined timestamp value
*
* Usually reported by demuxer that work on containers that do not provide
* either pts or dts.
*/
#define AV_NOPTS_VALUE INT64_C(0x8000000000000000)
/**
* Internal time base represented as integer
*/
#define AV_TIME_BASE 1000000
/**
* Internal time base represented as fractional value
*/
#define AV_TIME_BASE_Q (AVRational){1, AV_TIME_BASE}
/**
* @}
* @}
* @defgroup lavu_picture Image related
*
* AVPicture types, pixel formats and basic image planes manipulation.
*
* @{
*/
enum AVPictureType {
AV_PICTURE_TYPE_NONE = 0, ///< Undefined
AV_PICTURE_TYPE_I, ///< Intra
AV_PICTURE_TYPE_P, ///< Predicted
AV_PICTURE_TYPE_B, ///< Bi-dir predicted
AV_PICTURE_TYPE_S, ///< S(GMC)-VOP MPEG4
AV_PICTURE_TYPE_SI, ///< Switching Intra
AV_PICTURE_TYPE_SP, ///< Switching Predicted
AV_PICTURE_TYPE_BI, ///< BI type
};
/**
* Return a single letter to describe the given picture type
* pict_type.
*
* @param[in] pict_type the picture type @return a single character
* representing the picture type, '?' if pict_type is unknown
*/
char av_get_picture_type_char(enum AVPictureType pict_type);
/**
* @}
*/
#include "common.h"
#include "error.h"
#include "version.h"
#include "mathematics.h"
#include "rational.h"
#include "intfloat_readwrite.h"
#include "log.h"
#include "pixfmt.h"
/**
* Return x default pointer in case p is NULL.
*/
static inline void *av_x_if_null(const void *p, const void *x)
{
return (void *)(intptr_t)(p ? p : x);
}
/**
* @}
* @}
*/
#endif /* AVUTIL_AVUTIL_H */
| 5,990 | 19.171717 | 79 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libavutil/file.h
|
/*
* This file is part of FFmpeg.
*
* FFmpeg 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.
*
* FFmpeg 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 FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVUTIL_FILE_H
#define AVUTIL_FILE_H
#include <stdint.h>
#include "avutil.h"
/**
* @file
* Misc file utilities.
*/
/**
* Read the file with name filename, and put its content in a newly
* allocated buffer or map it with mmap() when available.
* In case of success set *bufptr to the read or mmapped buffer, and
* *size to the size in bytes of the buffer in *bufptr.
* The returned buffer must be released with av_file_unmap().
*
* @param log_offset loglevel offset used for logging
* @param log_ctx context used for logging
* @return a non negative number in case of success, a negative value
* corresponding to an AVERROR error code in case of failure
*/
int av_file_map(const char *filename, uint8_t **bufptr, size_t *size,
int log_offset, void *log_ctx);
/**
* Unmap or free the buffer bufptr created by av_file_map().
*
* @param size size in bytes of bufptr, must be the same as returned
* by av_file_map()
*/
void av_file_unmap(uint8_t *bufptr, size_t size);
/**
* Wrapper to work around the lack of mkstemp() on mingw.
* Also, tries to create file in /tmp first, if possible.
* *prefix can be a character constant; *filename will be allocated internally.
* @return file descriptor of opened file (or -1 on error)
* and opened file name in **filename.
*/
int av_tempfile(const char *prefix, char **filename, int log_offset, void *log_ctx);
#endif /* AVUTIL_FILE_H */
| 2,191 | 33.25 | 84 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libavutil/blowfish.h
|
/*
* Blowfish algorithm
* Copyright (c) 2012 Samuel Pitoiset
*
* This file is part of FFmpeg.
*
* FFmpeg 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.
*
* FFmpeg 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 FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVUTIL_BLOWFISH_H
#define AVUTIL_BLOWFISH_H
#include <stdint.h>
/**
* @defgroup lavu_blowfish Blowfish
* @ingroup lavu_crypto
* @{
*/
#define AV_BF_ROUNDS 16
typedef struct AVBlowfish {
uint32_t p[AV_BF_ROUNDS + 2];
uint32_t s[4][256];
} AVBlowfish;
/**
* Initialize an AVBlowfish context.
*
* @param ctx an AVBlowfish context
* @param key a key
* @param key_len length of the key
*/
void av_blowfish_init(struct AVBlowfish *ctx, const uint8_t *key, int key_len);
/**
* Encrypt or decrypt a buffer using a previously initialized context.
*
* @param ctx an AVBlowfish context
* @param xl left four bytes halves of input to be encrypted
* @param xr right four bytes halves of input to be encrypted
* @param decrypt 0 for encryption, 1 for decryption
*/
void av_blowfish_crypt_ecb(struct AVBlowfish *ctx, uint32_t *xl, uint32_t *xr,
int decrypt);
/**
* Encrypt or decrypt a buffer using a previously initialized context.
*
* @param ctx an AVBlowfish context
* @param dst destination array, can be equal to src
* @param src source array, can be equal to dst
* @param count number of 8 byte blocks
* @param iv initialization vector for CBC mode, if NULL ECB will be used
* @param decrypt 0 for encryption, 1 for decryption
*/
void av_blowfish_crypt(struct AVBlowfish *ctx, uint8_t *dst, const uint8_t *src,
int count, uint8_t *iv, int decrypt);
/**
* @}
*/
#endif /* AVUTIL_BLOWFISH_H */
| 2,313 | 28.666667 | 80 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libavutil/imgutils.h
|
/*
* This file is part of FFmpeg.
*
* FFmpeg 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.
*
* FFmpeg 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 FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVUTIL_IMGUTILS_H
#define AVUTIL_IMGUTILS_H
/**
* @file
* misc image utilities
*
* @addtogroup lavu_picture
* @{
*/
#include "avutil.h"
#include "pixdesc.h"
/**
* Compute the max pixel step for each plane of an image with a
* format described by pixdesc.
*
* The pixel step is the distance in bytes between the first byte of
* the group of bytes which describe a pixel component and the first
* byte of the successive group in the same plane for the same
* component.
*
* @param max_pixsteps an array which is filled with the max pixel step
* for each plane. Since a plane may contain different pixel
* components, the computed max_pixsteps[plane] is relative to the
* component in the plane with the max pixel step.
* @param max_pixstep_comps an array which is filled with the component
* for each plane which has the max pixel step. May be NULL.
*/
void av_image_fill_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4],
const AVPixFmtDescriptor *pixdesc);
/**
* Compute the size of an image line with format pix_fmt and width
* width for the plane plane.
*
* @return the computed size in bytes
*/
int av_image_get_linesize(enum PixelFormat pix_fmt, int width, int plane);
/**
* Fill plane linesizes for an image with pixel format pix_fmt and
* width width.
*
* @param linesizes array to be filled with the linesize for each plane
* @return >= 0 in case of success, a negative error code otherwise
*/
int av_image_fill_linesizes(int linesizes[4], enum PixelFormat pix_fmt, int width);
/**
* Fill plane data pointers for an image with pixel format pix_fmt and
* height height.
*
* @param data pointers array to be filled with the pointer for each image plane
* @param ptr the pointer to a buffer which will contain the image
* @param linesizes the array containing the linesize for each
* plane, should be filled by av_image_fill_linesizes()
* @return the size in bytes required for the image buffer, a negative
* error code in case of failure
*/
int av_image_fill_pointers(uint8_t *data[4], enum PixelFormat pix_fmt, int height,
uint8_t *ptr, const int linesizes[4]);
/**
* Allocate an image with size w and h and pixel format pix_fmt, and
* fill pointers and linesizes accordingly.
* The allocated image buffer has to be freed by using
* av_freep(&pointers[0]).
*
* @param align the value to use for buffer size alignment
* @return the size in bytes required for the image buffer, a negative
* error code in case of failure
*/
int av_image_alloc(uint8_t *pointers[4], int linesizes[4],
int w, int h, enum PixelFormat pix_fmt, int align);
/**
* Copy image plane from src to dst.
* That is, copy "height" number of lines of "bytewidth" bytes each.
* The first byte of each successive line is separated by *_linesize
* bytes.
*
* @param dst_linesize linesize for the image plane in dst
* @param src_linesize linesize for the image plane in src
*/
void av_image_copy_plane(uint8_t *dst, int dst_linesize,
const uint8_t *src, int src_linesize,
int bytewidth, int height);
/**
* Copy image in src_data to dst_data.
*
* @param dst_linesizes linesizes for the image in dst_data
* @param src_linesizes linesizes for the image in src_data
*/
void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4],
const uint8_t *src_data[4], const int src_linesizes[4],
enum PixelFormat pix_fmt, int width, int height);
/**
* Setup the data pointers and linesizes based on the specified image
* parameters and the provided array.
*
* The fields of the given image are filled in by using the src
* address which points to the image data buffer. Depending on the
* specified pixel format, one or multiple image data pointers and
* line sizes will be set. If a planar format is specified, several
* pointers will be set pointing to the different picture planes and
* the line sizes of the different planes will be stored in the
* lines_sizes array. Call with src == NULL to get the required
* size for the src buffer.
*
* To allocate the buffer and fill in the dst_data and dst_linesize in
* one call, use av_image_alloc().
*
* @param dst_data data pointers to be filled in
* @param dst_linesizes linesizes for the image in dst_data to be filled in
* @param src buffer which will contain or contains the actual image data, can be NULL
* @param pix_fmt the pixel format of the image
* @param width the width of the image in pixels
* @param height the height of the image in pixels
* @param align the value used in src for linesize alignment
* @return the size in bytes required for src, a negative error code
* in case of failure
*/
int av_image_fill_arrays(uint8_t *dst_data[4], int dst_linesize[4],
const uint8_t *src,
enum PixelFormat pix_fmt, int width, int height, int align);
/**
* Return the size in bytes of the amount of data required to store an
* image with the given parameters.
*
* @param[in] align the assumed linesize alignment
*/
int av_image_get_buffer_size(enum PixelFormat pix_fmt, int width, int height, int align);
/**
* Copy image data from an image into a buffer.
*
* av_image_get_buffer_size() can be used to compute the required size
* for the buffer to fill.
*
* @param dst a buffer into which picture data will be copied
* @param dst_size the size in bytes of dst
* @param src_data pointers containing the source image data
* @param src_linesizes linesizes for the image in src_data
* @param pix_fmt the pixel format of the source image
* @param width the width of the source image in pixels
* @param height the height of the source image in pixels
* @param align the assumed linesize alignment for dst
* @return the number of bytes written to dst, or a negative value
* (error code) on error
*/
int av_image_copy_to_buffer(uint8_t *dst, int dst_size,
const uint8_t * const src_data[4], const int src_linesize[4],
enum PixelFormat pix_fmt, int width, int height, int align);
/**
* Check if the given dimension of an image is valid, meaning that all
* bytes of the image can be addressed with a signed int.
*
* @param w the width of the picture
* @param h the height of the picture
* @param log_offset the offset to sum to the log level for logging with log_ctx
* @param log_ctx the parent logging context, it may be NULL
* @return >= 0 if valid, a negative error code otherwise
*/
int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx);
int ff_set_systematic_pal2(uint32_t pal[256], enum PixelFormat pix_fmt);
/**
* @}
*/
#endif /* AVUTIL_IMGUTILS_H */
| 7,681 | 37.79798 | 96 |
h
|
cba-pipeline-public
|
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libavutil/lfg.h
|
/*
* Lagged Fibonacci PRNG
* Copyright (c) 2008 Michael Niedermayer
*
* This file is part of FFmpeg.
*
* FFmpeg 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.
*
* FFmpeg 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 FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVUTIL_LFG_H
#define AVUTIL_LFG_H
typedef struct {
unsigned int state[64];
int index;
} AVLFG;
void av_lfg_init(AVLFG *c, unsigned int seed);
/**
* Get the next random unsigned 32-bit number using an ALFG.
*
* Please also consider a simple LCG like state= state*1664525+1013904223,
* it may be good enough and faster for your specific use case.
*/
static inline unsigned int av_lfg_get(AVLFG *c){
c->state[c->index & 63] = c->state[(c->index-24) & 63] + c->state[(c->index-55) & 63];
return c->state[c->index++ & 63];
}
/**
* Get the next random unsigned 32-bit number using a MLFG.
*
* Please also consider av_lfg_get() above, it is faster.
*/
static inline unsigned int av_mlfg_get(AVLFG *c){
unsigned int a= c->state[(c->index-55) & 63];
unsigned int b= c->state[(c->index-24) & 63];
return c->state[c->index++ & 63] = 2*a*b+a+b;
}
/**
* Get the next two numbers generated by a Box-Muller Gaussian
* generator using the random numbers issued by lfg.
*
* @param out array where the two generated numbers are placed
*/
void av_bmg_get(AVLFG *lfg, double out[2]);
#endif /* AVUTIL_LFG_H */
| 1,980 | 30.444444 | 90 |
h
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.