repo
stringlengths
1
152
file
stringlengths
15
205
code
stringlengths
0
41.6M
file_length
int64
0
41.6M
avg_line_length
float64
0
1.81M
max_line_length
int64
0
12.7M
extension_type
stringclasses
90 values
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
cba-pipeline-public
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libavutil/opt.h
/* * AVOptions * copyright (c) 2005 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_OPT_H #define AVUTIL_OPT_H /** * @file * AVOptions */ #include "rational.h" #include "avutil.h" #include "dict.h" #include "log.h" /** * @defgroup avoptions AVOptions * @ingroup lavu_data * @{ * AVOptions provide a generic system to declare options on arbitrary structs * ("objects"). An option can have a help text, a type and a range of possible * values. Options may then be enumerated, read and written to. * * @section avoptions_implement Implementing AVOptions * This section describes how to add AVOptions capabilities to a struct. * * All AVOptions-related information is stored in an AVClass. Therefore * the first member of the struct should be a pointer to an AVClass describing it. * The option field of the AVClass must be set to a NULL-terminated static array * of AVOptions. Each AVOption must have a non-empty name, a type, a default * value and for number-type AVOptions also a range of allowed values. It must * also declare an offset in bytes from the start of the struct, where the field * associated with this AVOption is located. Other fields in the AVOption struct * should also be set when applicable, but are not required. * * The following example illustrates an AVOptions-enabled struct: * @code * typedef struct test_struct { * AVClass *class; * int int_opt; * char *str_opt; * uint8_t *bin_opt; * int bin_len; * } test_struct; * * static const AVOption options[] = { * { "test_int", "This is a test option of int type.", offsetof(test_struct, int_opt), * AV_OPT_TYPE_INT, { .i64 = -1 }, INT_MIN, INT_MAX }, * { "test_str", "This is a test option of string type.", offsetof(test_struct, str_opt), * AV_OPT_TYPE_STRING }, * { "test_bin", "This is a test option of binary type.", offsetof(test_struct, bin_opt), * AV_OPT_TYPE_BINARY }, * { NULL }, * }; * * static const AVClass test_class = { * .class_name = "test class", * .item_name = av_default_item_name, * .option = options, * .version = LIBAVUTIL_VERSION_INT, * }; * @endcode * * Next, when allocating your struct, you must ensure that the AVClass pointer * is set to the correct value. Then, av_opt_set_defaults() can be called to * initialize defaults. After that the struct is ready to be used with the * AVOptions API. * * When cleaning up, you may use the av_opt_free() function to automatically * free all the allocated string and binary options. * * Continuing with the above example: * * @code * test_struct *alloc_test_struct(void) * { * test_struct *ret = av_malloc(sizeof(*ret)); * ret->class = &test_class; * av_opt_set_defaults(ret); * return ret; * } * void free_test_struct(test_struct **foo) * { * av_opt_free(*foo); * av_freep(foo); * } * @endcode * * @subsection avoptions_implement_nesting Nesting * It may happen that an AVOptions-enabled struct contains another * AVOptions-enabled struct as a member (e.g. AVCodecContext in * libavcodec exports generic options, while its priv_data field exports * codec-specific options). In such a case, it is possible to set up the * parent struct to export a child's options. To do that, simply * implement AVClass.child_next() and AVClass.child_class_next() in the * parent struct's AVClass. * Assuming that the test_struct from above now also contains a * child_struct field: * * @code * typedef struct child_struct { * AVClass *class; * int flags_opt; * } child_struct; * static const AVOption child_opts[] = { * { "test_flags", "This is a test option of flags type.", * offsetof(child_struct, flags_opt), AV_OPT_TYPE_FLAGS, { .i64 = 0 }, INT_MIN, INT_MAX }, * { NULL }, * }; * static const AVClass child_class = { * .class_name = "child class", * .item_name = av_default_item_name, * .option = child_opts, * .version = LIBAVUTIL_VERSION_INT, * }; * * void *child_next(void *obj, void *prev) * { * test_struct *t = obj; * if (!prev && t->child_struct) * return t->child_struct; * return NULL * } * const AVClass child_class_next(const AVClass *prev) * { * return prev ? NULL : &child_class; * } * @endcode * Putting child_next() and child_class_next() as defined above into * test_class will now make child_struct's options accessible through * test_struct (again, proper setup as described above needs to be done on * child_struct right after it is created). * * From the above example it might not be clear why both child_next() * and child_class_next() are needed. The distinction is that child_next() * iterates over actually existing objects, while child_class_next() * iterates over all possible child classes. E.g. if an AVCodecContext * was initialized to use a codec which has private options, then its * child_next() will return AVCodecContext.priv_data and finish * iterating. OTOH child_class_next() on AVCodecContext.av_class will * iterate over all available codecs with private options. * * @subsection avoptions_implement_named_constants Named constants * It is possible to create named constants for options. Simply set the unit * field of the option the constants should apply to to a string and * create the constants themselves as options of type AV_OPT_TYPE_CONST * with their unit field set to the same string. * Their default_val field should contain the value of the named * constant. * For example, to add some named constants for the test_flags option * above, put the following into the child_opts array: * @code * { "test_flags", "This is a test option of flags type.", * offsetof(child_struct, flags_opt), AV_OPT_TYPE_FLAGS, { .i64 = 0 }, INT_MIN, INT_MAX, "test_unit" }, * { "flag1", "This is a flag with value 16", 0, AV_OPT_TYPE_CONST, { .i64 = 16 }, 0, 0, "test_unit" }, * @endcode * * @section avoptions_use Using AVOptions * This section deals with accessing options in an AVOptions-enabled struct. * Such structs in FFmpeg are e.g. AVCodecContext in libavcodec or * AVFormatContext in libavformat. * * @subsection avoptions_use_examine Examining AVOptions * The basic functions for examining options are av_opt_next(), which iterates * over all options defined for one object, and av_opt_find(), which searches * for an option with the given name. * * The situation is more complicated with nesting. An AVOptions-enabled struct * may have AVOptions-enabled children. Passing the AV_OPT_SEARCH_CHILDREN flag * to av_opt_find() will make the function search children recursively. * * For enumerating there are basically two cases. The first is when you want to * get all options that may potentially exist on the struct and its children * (e.g. when constructing documentation). In that case you should call * av_opt_child_class_next() recursively on the parent struct's AVClass. The * second case is when you have an already initialized struct with all its * children and you want to get all options that can be actually written or read * from it. In that case you should call av_opt_child_next() recursively (and * av_opt_next() on each result). * * @subsection avoptions_use_get_set Reading and writing AVOptions * When setting options, you often have a string read directly from the * user. In such a case, simply passing it to av_opt_set() is enough. For * non-string type options, av_opt_set() will parse the string according to the * option type. * * Similarly av_opt_get() will read any option type and convert it to a string * which will be returned. Do not forget that the string is allocated, so you * have to free it with av_free(). * * In some cases it may be more convenient to put all options into an * AVDictionary and call av_opt_set_dict() on it. A specific case of this * are the format/codec open functions in lavf/lavc which take a dictionary * filled with option as a parameter. This allows to set some options * that cannot be set otherwise, since e.g. the input file format is not known * before the file is actually opened. */ enum AVOptionType{ AV_OPT_TYPE_FLAGS, AV_OPT_TYPE_INT, AV_OPT_TYPE_INT64, AV_OPT_TYPE_DOUBLE, AV_OPT_TYPE_FLOAT, AV_OPT_TYPE_STRING, AV_OPT_TYPE_RATIONAL, AV_OPT_TYPE_BINARY, ///< offset must point to a pointer immediately followed by an int for the length AV_OPT_TYPE_CONST = 128, AV_OPT_TYPE_IMAGE_SIZE = MKBETAG('S','I','Z','E'), ///< offset must point to two consecutive integers AV_OPT_TYPE_PIXEL_FMT = MKBETAG('P','F','M','T'), #if FF_API_OLD_AVOPTIONS FF_OPT_TYPE_FLAGS = 0, FF_OPT_TYPE_INT, FF_OPT_TYPE_INT64, FF_OPT_TYPE_DOUBLE, FF_OPT_TYPE_FLOAT, FF_OPT_TYPE_STRING, FF_OPT_TYPE_RATIONAL, FF_OPT_TYPE_BINARY, ///< offset must point to a pointer immediately followed by an int for the length FF_OPT_TYPE_CONST=128, #endif }; /** * AVOption */ typedef struct AVOption { const char *name; /** * short English help text * @todo What about other languages? */ const char *help; /** * The offset relative to the context structure where the option * value is stored. It should be 0 for named constants. */ int offset; enum AVOptionType type; /** * the default value for scalar options */ union { int64_t i64; double dbl; const char *str; /* TODO those are unused now */ AVRational q; } default_val; double min; ///< minimum valid value for the option double max; ///< maximum valid value for the option int flags; #define AV_OPT_FLAG_ENCODING_PARAM 1 ///< a generic parameter which can be set by the user for muxing or encoding #define AV_OPT_FLAG_DECODING_PARAM 2 ///< a generic parameter which can be set by the user for demuxing or decoding #define AV_OPT_FLAG_METADATA 4 ///< some data extracted or inserted into the file like title, comment, ... #define AV_OPT_FLAG_AUDIO_PARAM 8 #define AV_OPT_FLAG_VIDEO_PARAM 16 #define AV_OPT_FLAG_SUBTITLE_PARAM 32 #define AV_OPT_FLAG_FILTERING_PARAM (1<<16) ///< a generic parameter which can be set by the user for filtering //FIXME think about enc-audio, ... style flags /** * The logical unit to which the option belongs. Non-constant * options and corresponding named constants share the same * unit. May be NULL. */ const char *unit; } AVOption; #if FF_API_FIND_OPT /** * Look for an option in obj. Look only for the options which * have the flags set as specified in mask and flags (that is, * for which it is the case that opt->flags & mask == flags). * * @param[in] obj a pointer to a struct whose first element is a * pointer to an AVClass * @param[in] name the name of the option to look for * @param[in] unit the unit of the option to look for, or any if NULL * @return a pointer to the option found, or NULL if no option * has been found * * @deprecated use av_opt_find. */ attribute_deprecated const AVOption *av_find_opt(void *obj, const char *name, const char *unit, int mask, int flags); #endif #if FF_API_OLD_AVOPTIONS /** * Set the field of obj with the given name to value. * * @param[in] obj A struct whose first element is a pointer to an * AVClass. * @param[in] name the name of the field to set * @param[in] val The value to set. If the field is not of a string * type, then the given string is parsed. * SI postfixes and some named scalars are supported. * If the field is of a numeric type, it has to be a numeric or named * scalar. Behavior with more than one scalar and +- infix operators * is undefined. * If the field is of a flags type, it has to be a sequence of numeric * scalars or named flags separated by '+' or '-'. Prefixing a flag * with '+' causes it to be set without affecting the other flags; * similarly, '-' unsets a flag. * @param[out] o_out if non-NULL put here a pointer to the AVOption * found * @param alloc this parameter is currently ignored * @return 0 if the value has been set, or an AVERROR code in case of * error: * AVERROR_OPTION_NOT_FOUND if no matching option exists * AVERROR(ERANGE) if the value is out of range * AVERROR(EINVAL) if the value is not valid * @deprecated use av_opt_set() */ attribute_deprecated int av_set_string3(void *obj, const char *name, const char *val, int alloc, const AVOption **o_out); attribute_deprecated const AVOption *av_set_double(void *obj, const char *name, double n); attribute_deprecated const AVOption *av_set_q(void *obj, const char *name, AVRational n); attribute_deprecated const AVOption *av_set_int(void *obj, const char *name, int64_t n); double av_get_double(void *obj, const char *name, const AVOption **o_out); AVRational av_get_q(void *obj, const char *name, const AVOption **o_out); int64_t av_get_int(void *obj, const char *name, const AVOption **o_out); attribute_deprecated const char *av_get_string(void *obj, const char *name, const AVOption **o_out, char *buf, int buf_len); attribute_deprecated const AVOption *av_next_option(void *obj, const AVOption *last); #endif /** * Show the obj options. * * @param req_flags requested flags for the options to show. Show only the * options for which it is opt->flags & req_flags. * @param rej_flags rejected flags for the options to show. Show only the * options for which it is !(opt->flags & req_flags). * @param av_log_obj log context to use for showing the options */ int av_opt_show2(void *obj, void *av_log_obj, int req_flags, int rej_flags); /** * Set the values of all AVOption fields to their default values. * * @param s an AVOption-enabled struct (its first member must be a pointer to AVClass) */ void av_opt_set_defaults(void *s); #if FF_API_OLD_AVOPTIONS attribute_deprecated void av_opt_set_defaults2(void *s, int mask, int flags); #endif /** * Parse the key/value pairs list in opts. For each key/value pair * found, stores the value in the field in ctx that is named like the * key. ctx must be an AVClass context, storing is done using * AVOptions. * * @param opts options string to parse, may be NULL * @param key_val_sep a 0-terminated list of characters used to * separate key from value * @param pairs_sep a 0-terminated list of characters used to separate * two pairs from each other * @return the number of successfully set key/value pairs, or a negative * value corresponding to an AVERROR code in case of error: * AVERROR(EINVAL) if opts cannot be parsed, * the error code issued by av_set_string3() if a key/value pair * cannot be set */ int av_set_options_string(void *ctx, const char *opts, const char *key_val_sep, const char *pairs_sep); /** * Free all string and binary options in obj. */ void av_opt_free(void *obj); /** * Check whether a particular flag is set in a flags field. * * @param field_name the name of the flag field option * @param flag_name the name of the flag to check * @return non-zero if the flag is set, zero if the flag isn't set, * isn't of the right type, or the flags field doesn't exist. */ int av_opt_flag_is_set(void *obj, const char *field_name, const char *flag_name); /* * Set all the options from a given dictionary on an object. * * @param obj a struct whose first element is a pointer to AVClass * @param options options to process. This dictionary will be freed and replaced * by a new one containing all options not found in obj. * Of course this new dictionary needs to be freed by caller * with av_dict_free(). * * @return 0 on success, a negative AVERROR if some option was found in obj, * but could not be set. * * @see av_dict_copy() */ int av_opt_set_dict(void *obj, struct AVDictionary **options); /** * @defgroup opt_eval_funcs Evaluating option strings * @{ * This group of functions can be used to evaluate option strings * and get numbers out of them. They do the same thing as av_opt_set(), * except the result is written into the caller-supplied pointer. * * @param obj a struct whose first element is a pointer to AVClass. * @param o an option for which the string is to be evaluated. * @param val string to be evaluated. * @param *_out value of the string will be written here. * * @return 0 on success, a negative number on failure. */ int av_opt_eval_flags (void *obj, const AVOption *o, const char *val, int *flags_out); int av_opt_eval_int (void *obj, const AVOption *o, const char *val, int *int_out); int av_opt_eval_int64 (void *obj, const AVOption *o, const char *val, int64_t *int64_out); int av_opt_eval_float (void *obj, const AVOption *o, const char *val, float *float_out); int av_opt_eval_double(void *obj, const AVOption *o, const char *val, double *double_out); int av_opt_eval_q (void *obj, const AVOption *o, const char *val, AVRational *q_out); /** * @} */ #define AV_OPT_SEARCH_CHILDREN 0x0001 /**< Search in possible children of the given object first. */ /** * The obj passed to av_opt_find() is fake -- only a double pointer to AVClass * instead of a required pointer to a struct containing AVClass. This is * useful for searching for options without needing to allocate the corresponding * object. */ #define AV_OPT_SEARCH_FAKE_OBJ 0x0002 /** * Look for an option in an object. Consider only options which * have all the specified flags set. * * @param[in] obj A pointer to a struct whose first element is a * pointer to an AVClass. * Alternatively a double pointer to an AVClass, if * AV_OPT_SEARCH_FAKE_OBJ search flag is set. * @param[in] name The name of the option to look for. * @param[in] unit When searching for named constants, name of the unit * it belongs to. * @param opt_flags Find only options with all the specified flags set (AV_OPT_FLAG). * @param search_flags A combination of AV_OPT_SEARCH_*. * * @return A pointer to the option found, or NULL if no option * was found. * * @note Options found with AV_OPT_SEARCH_CHILDREN flag may not be settable * directly with av_set_string3(). Use special calls which take an options * AVDictionary (e.g. avformat_open_input()) to set options found with this * flag. */ const AVOption *av_opt_find(void *obj, const char *name, const char *unit, int opt_flags, int search_flags); /** * Look for an option in an object. Consider only options which * have all the specified flags set. * * @param[in] obj A pointer to a struct whose first element is a * pointer to an AVClass. * Alternatively a double pointer to an AVClass, if * AV_OPT_SEARCH_FAKE_OBJ search flag is set. * @param[in] name The name of the option to look for. * @param[in] unit When searching for named constants, name of the unit * it belongs to. * @param opt_flags Find only options with all the specified flags set (AV_OPT_FLAG). * @param search_flags A combination of AV_OPT_SEARCH_*. * @param[out] target_obj if non-NULL, an object to which the option belongs will be * written here. It may be different from obj if AV_OPT_SEARCH_CHILDREN is present * in search_flags. This parameter is ignored if search_flags contain * AV_OPT_SEARCH_FAKE_OBJ. * * @return A pointer to the option found, or NULL if no option * was found. */ const AVOption *av_opt_find2(void *obj, const char *name, const char *unit, int opt_flags, int search_flags, void **target_obj); /** * Iterate over all AVOptions belonging to obj. * * @param obj an AVOptions-enabled struct or a double pointer to an * AVClass describing it. * @param prev result of the previous call to av_opt_next() on this object * or NULL * @return next AVOption or NULL */ const AVOption *av_opt_next(void *obj, const AVOption *prev); /** * Iterate over AVOptions-enabled children of obj. * * @param prev result of a previous call to this function or NULL * @return next AVOptions-enabled child or NULL */ void *av_opt_child_next(void *obj, void *prev); /** * Iterate over potential AVOptions-enabled children of parent. * * @param prev result of a previous call to this function or NULL * @return AVClass corresponding to next potential child or NULL */ const AVClass *av_opt_child_class_next(const AVClass *parent, const AVClass *prev); /** * @defgroup opt_set_funcs Option setting functions * @{ * Those functions set the field of obj with the given name to value. * * @param[in] obj A struct whose first element is a pointer to an AVClass. * @param[in] name the name of the field to set * @param[in] val The value to set. In case of av_opt_set() if the field is not * of a string type, then the given string is parsed. * SI postfixes and some named scalars are supported. * If the field is of a numeric type, it has to be a numeric or named * scalar. Behavior with more than one scalar and +- infix operators * is undefined. * If the field is of a flags type, it has to be a sequence of numeric * scalars or named flags separated by '+' or '-'. Prefixing a flag * with '+' causes it to be set without affecting the other flags; * similarly, '-' unsets a flag. * @param search_flags flags passed to av_opt_find2. I.e. if AV_OPT_SEARCH_CHILDREN * is passed here, then the option may be set on a child of obj. * * @return 0 if the value has been set, or an AVERROR code in case of * error: * AVERROR_OPTION_NOT_FOUND if no matching option exists * AVERROR(ERANGE) if the value is out of range * AVERROR(EINVAL) if the value is not valid */ int av_opt_set (void *obj, const char *name, const char *val, int search_flags); int av_opt_set_int (void *obj, const char *name, int64_t val, int search_flags); int av_opt_set_double(void *obj, const char *name, double val, int search_flags); int av_opt_set_q (void *obj, const char *name, AVRational val, int search_flags); int av_opt_set_bin (void *obj, const char *name, const uint8_t *val, int size, int search_flags); /** * @} */ /** * @defgroup opt_get_funcs Option getting functions * @{ * Those functions get a value of the option with the given name from an object. * * @param[in] obj a struct whose first element is a pointer to an AVClass. * @param[in] name name of the option to get. * @param[in] search_flags flags passed to av_opt_find2. I.e. if AV_OPT_SEARCH_CHILDREN * is passed here, then the option may be found in a child of obj. * @param[out] out_val value of the option will be written here * @return 0 on success, a negative error code otherwise */ /** * @note the returned string will av_malloc()ed and must be av_free()ed by the caller */ int av_opt_get (void *obj, const char *name, int search_flags, uint8_t **out_val); int av_opt_get_int (void *obj, const char *name, int search_flags, int64_t *out_val); int av_opt_get_double(void *obj, const char *name, int search_flags, double *out_val); int av_opt_get_q (void *obj, const char *name, int search_flags, AVRational *out_val); /** * @} */ /** * Gets a pointer to the requested field in a struct. * This function allows accessing a struct even when its fields are moved or * renamed since the application making the access has been compiled, * * @returns a pointer to the field, it can be cast to the correct type and read * or written to. */ void *av_opt_ptr(const AVClass *avclass, void *obj, const char *name); /** * @} */ #endif /* AVUTIL_OPT_H */
24,899
39.953947
124
h
cba-pipeline-public
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libavutil/bswap.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 */ /** * @file * byte swapping routines */ #ifndef AVUTIL_BSWAP_H #define AVUTIL_BSWAP_H #include <stdint.h> #include "libavutil/avconfig.h" #include "attributes.h" #ifdef HAVE_AV_CONFIG_H #include "config.h" #if ARCH_ARM # include "arm/bswap.h" #elif ARCH_AVR32 # include "avr32/bswap.h" #elif ARCH_BFIN # include "bfin/bswap.h" #elif ARCH_SH4 # include "sh4/bswap.h" #elif ARCH_X86 # include "x86/bswap.h" #endif #endif /* HAVE_AV_CONFIG_H */ #define AV_BSWAP16C(x) (((x) << 8 & 0xff00) | ((x) >> 8 & 0x00ff)) #define AV_BSWAP32C(x) (AV_BSWAP16C(x) << 16 | AV_BSWAP16C((x) >> 16)) #define AV_BSWAP64C(x) (AV_BSWAP32C(x) << 32 | AV_BSWAP32C((x) >> 32)) #define AV_BSWAPC(s, x) AV_BSWAP##s##C(x) #ifndef av_bswap16 static av_always_inline av_const uint16_t av_bswap16(uint16_t x) { x= (x>>8) | (x<<8); return x; } #endif #ifndef av_bswap32 static av_always_inline av_const uint32_t av_bswap32(uint32_t x) { return AV_BSWAP32C(x); } #endif #ifndef av_bswap64 static inline uint64_t av_const av_bswap64(uint64_t x) { return (uint64_t)av_bswap32(x) << 32 | av_bswap32(x >> 32); } #endif // be2ne ... big-endian to native-endian // le2ne ... little-endian to native-endian #if AV_HAVE_BIGENDIAN #define av_be2ne16(x) (x) #define av_be2ne32(x) (x) #define av_be2ne64(x) (x) #define av_le2ne16(x) av_bswap16(x) #define av_le2ne32(x) av_bswap32(x) #define av_le2ne64(x) av_bswap64(x) #define AV_BE2NEC(s, x) (x) #define AV_LE2NEC(s, x) AV_BSWAPC(s, x) #else #define av_be2ne16(x) av_bswap16(x) #define av_be2ne32(x) av_bswap32(x) #define av_be2ne64(x) av_bswap64(x) #define av_le2ne16(x) (x) #define av_le2ne32(x) (x) #define av_le2ne64(x) (x) #define AV_BE2NEC(s, x) AV_BSWAPC(s, x) #define AV_LE2NEC(s, x) (x) #endif #define AV_BE2NE16C(x) AV_BE2NEC(16, x) #define AV_BE2NE32C(x) AV_BE2NEC(32, x) #define AV_BE2NE64C(x) AV_BE2NEC(64, x) #define AV_LE2NE16C(x) AV_LE2NEC(16, x) #define AV_LE2NE32C(x) AV_LE2NEC(32, x) #define AV_LE2NE64C(x) AV_LE2NEC(64, x) #endif /* AVUTIL_BSWAP_H */
2,852
24.936364
79
h
cba-pipeline-public
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libavutil/attributes.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 */ /** * @file * Macro definitions for various function/variable attributes */ #ifndef AVUTIL_ATTRIBUTES_H #define AVUTIL_ATTRIBUTES_H #ifdef __GNUC__ # define AV_GCC_VERSION_AT_LEAST(x,y) (__GNUC__ > x || __GNUC__ == x && __GNUC_MINOR__ >= y) #else # define AV_GCC_VERSION_AT_LEAST(x,y) 0 #endif #ifndef av_always_inline #if AV_GCC_VERSION_AT_LEAST(3,1) # define av_always_inline __attribute__((always_inline)) inline #elif defined(_MSC_VER) # define av_always_inline __forceinline #else # define av_always_inline inline #endif #endif #ifndef av_extern_inline #if defined(__ICL) && __ICL >= 1210 || defined(__GNUC_STDC_INLINE__) # define av_extern_inline extern inline #else # define av_extern_inline inline #endif #endif #if AV_GCC_VERSION_AT_LEAST(3,1) # define av_noinline __attribute__((noinline)) #else # define av_noinline #endif #if AV_GCC_VERSION_AT_LEAST(3,1) # define av_pure __attribute__((pure)) #else # define av_pure #endif #ifndef av_restrict #define av_restrict restrict #endif #if AV_GCC_VERSION_AT_LEAST(2,6) # define av_const __attribute__((const)) #else # define av_const #endif #if AV_GCC_VERSION_AT_LEAST(4,3) # define av_cold __attribute__((cold)) #else # define av_cold #endif #if AV_GCC_VERSION_AT_LEAST(4,1) # define av_flatten __attribute__((flatten)) #else # define av_flatten #endif #if AV_GCC_VERSION_AT_LEAST(3,1) # define attribute_deprecated __attribute__((deprecated)) #else # define attribute_deprecated #endif /** * Disable warnings about deprecated features * This is useful for sections of code kept for backward compatibility and * scheduled for removal. */ #ifndef AV_NOWARN_DEPRECATED #if AV_GCC_VERSION_AT_LEAST(4,6) # define AV_NOWARN_DEPRECATED(code) \ _Pragma("GCC diagnostic push") \ _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") \ code \ _Pragma("GCC diagnostic pop") #else # define AV_NOWARN_DEPRECATED(code) code #endif #endif #if defined(__GNUC__) # define av_unused __attribute__((unused)) #else # define av_unused #endif /** * Mark a variable as used and prevent the compiler from optimizing it * away. This is useful for variables accessed only from inline * assembler without the compiler being aware. */ #if AV_GCC_VERSION_AT_LEAST(3,1) # define av_used __attribute__((used)) #else # define av_used #endif #if AV_GCC_VERSION_AT_LEAST(3,3) # define av_alias __attribute__((may_alias)) #else # define av_alias #endif #if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !defined(__clang__) # define av_uninit(x) x=x #else # define av_uninit(x) x #endif #ifdef __GNUC__ # define av_builtin_constant_p __builtin_constant_p # define av_printf_format(fmtpos, attrpos) __attribute__((__format__(__printf__, fmtpos, attrpos))) #else # define av_builtin_constant_p(x) 0 # define av_printf_format(fmtpos, attrpos) #endif #if AV_GCC_VERSION_AT_LEAST(2,5) # define av_noreturn __attribute__((noreturn)) #else # define av_noreturn #endif #endif /* AVUTIL_ATTRIBUTES_H */
3,926
24.335484
102
h
cba-pipeline-public
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libavutil/lzo.h
/* * LZO 1x decompression * copyright (c) 2006 Reimar Doeffinger * * 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_LZO_H #define AVUTIL_LZO_H /** * @defgroup lavu_lzo LZO * @ingroup lavu_crypto * * @{ */ #include <stdint.h> /** @name Error flags returned by av_lzo1x_decode * @{ */ /// end of the input buffer reached before decoding finished #define AV_LZO_INPUT_DEPLETED 1 /// decoded data did not fit into output buffer #define AV_LZO_OUTPUT_FULL 2 /// a reference to previously decoded data was wrong #define AV_LZO_INVALID_BACKPTR 4 /// a non-specific error in the compressed bitstream #define AV_LZO_ERROR 8 /** @} */ #define AV_LZO_INPUT_PADDING 8 #define AV_LZO_OUTPUT_PADDING 12 /** * @brief Decodes LZO 1x compressed data. * @param out output buffer * @param outlen size of output buffer, number of bytes left are returned here * @param in input buffer * @param inlen size of input buffer, number of bytes left are returned here * @return 0 on success, otherwise a combination of the error flags above * * Make sure all buffers are appropriately padded, in must provide * AV_LZO_INPUT_PADDING, out must provide AV_LZO_OUTPUT_PADDING additional bytes. */ int av_lzo1x_decode(void *out, int *outlen, const void *in, int *inlen); /** * @brief deliberately overlapping memcpy implementation * @param dst destination buffer; must be padded with 12 additional bytes * @param back how many bytes back we start (the initial size of the overlapping window), must be > 0 * @param cnt number of bytes to copy, must be >= 0 * * cnt > back is valid, this will copy the bytes we just copied, * thus creating a repeating pattern with a period length of back. */ void av_memcpy_backptr(uint8_t *dst, int back, int cnt); /** * @} */ #endif /* AVUTIL_LZO_H */
2,518
31.294872
101
h
cba-pipeline-public
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libavutil/pixfmt.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_PIXFMT_H #define AVUTIL_PIXFMT_H /** * @file * pixel format definitions * */ #include "libavutil/avconfig.h" #define AVPALETTE_SIZE 1024 #define AVPALETTE_COUNT 256 /** * Pixel format. * * @note * PIX_FMT_RGB32 is handled in an endian-specific manner. An RGBA * color is put together as: * (A << 24) | (R << 16) | (G << 8) | B * This is stored as BGRA on little-endian CPU architectures and ARGB on * big-endian CPUs. * * @par * When the pixel format is palettized RGB (PIX_FMT_PAL8), the palettized * image data is stored in AVFrame.data[0]. The palette is transported in * AVFrame.data[1], is 1024 bytes long (256 4-byte entries) and is * formatted the same as in PIX_FMT_RGB32 described above (i.e., it is * also endian-specific). Note also that the individual RGB palette * components stored in AVFrame.data[1] should be in the range 0..255. * This is important as many custom PAL8 video codecs that were designed * to run on the IBM VGA graphics adapter use 6-bit palette components. * * @par * For all the 8bit per pixel formats, an RGB32 palette is in data[1] like * for pal8. This palette is filled in automatically by the function * allocating the picture. * * @note * make sure that all newly added big endian formats have pix_fmt&1==1 * and that all newly added little endian formats have pix_fmt&1==0 * this allows simpler detection of big vs little endian. */ enum PixelFormat { PIX_FMT_NONE= -1, PIX_FMT_YUV420P, ///< planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples) PIX_FMT_YUYV422, ///< packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr PIX_FMT_RGB24, ///< packed RGB 8:8:8, 24bpp, RGBRGB... PIX_FMT_BGR24, ///< packed RGB 8:8:8, 24bpp, BGRBGR... PIX_FMT_YUV422P, ///< planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples) PIX_FMT_YUV444P, ///< planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples) PIX_FMT_YUV410P, ///< planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples) PIX_FMT_YUV411P, ///< planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) PIX_FMT_GRAY8, ///< Y , 8bpp PIX_FMT_MONOWHITE, ///< Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb PIX_FMT_MONOBLACK, ///< Y , 1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb PIX_FMT_PAL8, ///< 8 bit with PIX_FMT_RGB32 palette PIX_FMT_YUVJ420P, ///< planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV420P and setting color_range PIX_FMT_YUVJ422P, ///< planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV422P and setting color_range PIX_FMT_YUVJ444P, ///< planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV444P and setting color_range PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing PIX_FMT_XVMC_MPEG2_IDCT, PIX_FMT_UYVY422, ///< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1 PIX_FMT_UYYVYY411, ///< packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3 PIX_FMT_BGR8, ///< packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb) PIX_FMT_BGR4, ///< packed RGB 1:2:1 bitstream, 4bpp, (msb)1B 2G 1R(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits PIX_FMT_BGR4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb) PIX_FMT_RGB8, ///< packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb) PIX_FMT_RGB4, ///< packed RGB 1:2:1 bitstream, 4bpp, (msb)1R 2G 1B(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits PIX_FMT_RGB4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb) PIX_FMT_NV12, ///< planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (first byte U and the following byte V) PIX_FMT_NV21, ///< as above, but U and V bytes are swapped PIX_FMT_ARGB, ///< packed ARGB 8:8:8:8, 32bpp, ARGBARGB... PIX_FMT_RGBA, ///< packed RGBA 8:8:8:8, 32bpp, RGBARGBA... PIX_FMT_ABGR, ///< packed ABGR 8:8:8:8, 32bpp, ABGRABGR... PIX_FMT_BGRA, ///< packed BGRA 8:8:8:8, 32bpp, BGRABGRA... PIX_FMT_GRAY16BE, ///< Y , 16bpp, big-endian PIX_FMT_GRAY16LE, ///< Y , 16bpp, little-endian PIX_FMT_YUV440P, ///< planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples) PIX_FMT_YUVJ440P, ///< planar YUV 4:4:0 full scale (JPEG), deprecated in favor of PIX_FMT_YUV440P and setting color_range PIX_FMT_YUVA420P, ///< planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples) PIX_FMT_VDPAU_H264,///< H.264 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers PIX_FMT_VDPAU_MPEG1,///< MPEG-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers PIX_FMT_VDPAU_MPEG2,///< MPEG-2 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers PIX_FMT_VDPAU_WMV3,///< WMV3 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers PIX_FMT_VDPAU_VC1, ///< VC-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers PIX_FMT_RGB48BE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big-endian PIX_FMT_RGB48LE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as little-endian PIX_FMT_RGB565BE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), big-endian PIX_FMT_RGB565LE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian PIX_FMT_RGB555BE, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), big-endian, most significant bit to 0 PIX_FMT_RGB555LE, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), little-endian, most significant bit to 0 PIX_FMT_BGR565BE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), big-endian PIX_FMT_BGR565LE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), little-endian PIX_FMT_BGR555BE, ///< packed BGR 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), big-endian, most significant bit to 1 PIX_FMT_BGR555LE, ///< packed BGR 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), little-endian, most significant bit to 1 PIX_FMT_VAAPI_MOCO, ///< HW acceleration through VA API at motion compensation entry-point, Picture.data[3] contains a vaapi_render_state struct which contains macroblocks as well as various fields extracted from headers PIX_FMT_VAAPI_IDCT, ///< HW acceleration through VA API at IDCT entry-point, Picture.data[3] contains a vaapi_render_state struct which contains fields extracted from headers PIX_FMT_VAAPI_VLD, ///< HW decoding through VA API, Picture.data[3] contains a vaapi_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers PIX_FMT_YUV420P16LE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian PIX_FMT_YUV420P16BE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian PIX_FMT_YUV422P16LE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian PIX_FMT_YUV422P16BE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian PIX_FMT_YUV444P16LE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian PIX_FMT_YUV444P16BE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian PIX_FMT_VDPAU_MPEG4, ///< MPEG4 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers PIX_FMT_DXVA2_VLD, ///< HW decoding through DXVA2, Picture.data[3] contains a LPDIRECT3DSURFACE9 pointer PIX_FMT_RGB444LE, ///< packed RGB 4:4:4, 16bpp, (msb)4A 4R 4G 4B(lsb), little-endian, most significant bits to 0 PIX_FMT_RGB444BE, ///< packed RGB 4:4:4, 16bpp, (msb)4A 4R 4G 4B(lsb), big-endian, most significant bits to 0 PIX_FMT_BGR444LE, ///< packed BGR 4:4:4, 16bpp, (msb)4A 4B 4G 4R(lsb), little-endian, most significant bits to 1 PIX_FMT_BGR444BE, ///< packed BGR 4:4:4, 16bpp, (msb)4A 4B 4G 4R(lsb), big-endian, most significant bits to 1 PIX_FMT_GRAY8A, ///< 8bit gray, 8bit alpha PIX_FMT_BGR48BE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as big-endian PIX_FMT_BGR48LE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as little-endian //the following 10 formats have the disadvantage of needing 1 format for each bit depth, thus //If you want to support multiple bit depths, then using PIX_FMT_YUV420P16* with the bpp stored separately //is better PIX_FMT_YUV420P9BE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian PIX_FMT_YUV420P9LE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian PIX_FMT_YUV420P10BE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian PIX_FMT_YUV420P10LE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian PIX_FMT_YUV422P10BE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian PIX_FMT_YUV422P10LE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian PIX_FMT_YUV444P9BE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian PIX_FMT_YUV444P9LE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian PIX_FMT_YUV444P10BE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian PIX_FMT_YUV444P10LE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian PIX_FMT_YUV422P9BE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian PIX_FMT_YUV422P9LE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian PIX_FMT_VDA_VLD, ///< hardware decoding through VDA #ifdef AV_PIX_FMT_ABI_GIT_MASTER PIX_FMT_RGBA64BE, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian PIX_FMT_RGBA64LE, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian PIX_FMT_BGRA64BE, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian PIX_FMT_BGRA64LE, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian #endif PIX_FMT_GBRP, ///< planar GBR 4:4:4 24bpp PIX_FMT_GBRP9BE, ///< planar GBR 4:4:4 27bpp, big endian PIX_FMT_GBRP9LE, ///< planar GBR 4:4:4 27bpp, little endian PIX_FMT_GBRP10BE, ///< planar GBR 4:4:4 30bpp, big endian PIX_FMT_GBRP10LE, ///< planar GBR 4:4:4 30bpp, little endian PIX_FMT_GBRP16BE, ///< planar GBR 4:4:4 48bpp, big endian PIX_FMT_GBRP16LE, ///< planar GBR 4:4:4 48bpp, little endian #ifndef AV_PIX_FMT_ABI_GIT_MASTER PIX_FMT_RGBA64BE=0x123, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian PIX_FMT_RGBA64LE, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian PIX_FMT_BGRA64BE, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian PIX_FMT_BGRA64LE, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian #endif PIX_FMT_0RGB=0x123+4, ///< packed RGB 8:8:8, 32bpp, 0RGB0RGB... PIX_FMT_RGB0, ///< packed RGB 8:8:8, 32bpp, RGB0RGB0... PIX_FMT_0BGR, ///< packed BGR 8:8:8, 32bpp, 0BGR0BGR... PIX_FMT_BGR0, ///< packed BGR 8:8:8, 32bpp, BGR0BGR0... PIX_FMT_YUVA444P, ///< planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples) PIX_FMT_YUVA422P, ///< planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples) PIX_FMT_YUV420P12BE, ///< planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian PIX_FMT_YUV420P12LE, ///< planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian PIX_FMT_YUV420P14BE, ///< planar YUV 4:2:0,21bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian PIX_FMT_YUV420P14LE, ///< planar YUV 4:2:0,21bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian PIX_FMT_YUV422P12BE, ///< planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian PIX_FMT_YUV422P12LE, ///< planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian PIX_FMT_YUV422P14BE, ///< planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian PIX_FMT_YUV422P14LE, ///< planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian PIX_FMT_YUV444P12BE, ///< planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian PIX_FMT_YUV444P12LE, ///< planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian PIX_FMT_YUV444P14BE, ///< planar YUV 4:4:4,42bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian PIX_FMT_YUV444P14LE, ///< planar YUV 4:4:4,42bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian PIX_FMT_GBRP12BE, ///< planar GBR 4:4:4 36bpp, big endian PIX_FMT_GBRP12LE, ///< planar GBR 4:4:4 36bpp, little endian PIX_FMT_GBRP14BE, ///< planar GBR 4:4:4 42bpp, big endian PIX_FMT_GBRP14LE, ///< planar GBR 4:4:4 42bpp, little endian PIX_FMT_NB, ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions }; #define PIX_FMT_Y400A PIX_FMT_GRAY8A #define PIX_FMT_GBR24P PIX_FMT_GBRP #if AV_HAVE_BIGENDIAN # define PIX_FMT_NE(be, le) PIX_FMT_##be #else # define PIX_FMT_NE(be, le) PIX_FMT_##le #endif #define PIX_FMT_RGB32 PIX_FMT_NE(ARGB, BGRA) #define PIX_FMT_RGB32_1 PIX_FMT_NE(RGBA, ABGR) #define PIX_FMT_BGR32 PIX_FMT_NE(ABGR, RGBA) #define PIX_FMT_BGR32_1 PIX_FMT_NE(BGRA, ARGB) #define PIX_FMT_0RGB32 PIX_FMT_NE(0RGB, BGR0) #define PIX_FMT_0BGR32 PIX_FMT_NE(0BGR, RGB0) #define PIX_FMT_GRAY16 PIX_FMT_NE(GRAY16BE, GRAY16LE) #define PIX_FMT_RGB48 PIX_FMT_NE(RGB48BE, RGB48LE) #define PIX_FMT_RGB565 PIX_FMT_NE(RGB565BE, RGB565LE) #define PIX_FMT_RGB555 PIX_FMT_NE(RGB555BE, RGB555LE) #define PIX_FMT_RGB444 PIX_FMT_NE(RGB444BE, RGB444LE) #define PIX_FMT_BGR48 PIX_FMT_NE(BGR48BE, BGR48LE) #define PIX_FMT_BGR565 PIX_FMT_NE(BGR565BE, BGR565LE) #define PIX_FMT_BGR555 PIX_FMT_NE(BGR555BE, BGR555LE) #define PIX_FMT_BGR444 PIX_FMT_NE(BGR444BE, BGR444LE) #define PIX_FMT_YUV420P9 PIX_FMT_NE(YUV420P9BE , YUV420P9LE) #define PIX_FMT_YUV422P9 PIX_FMT_NE(YUV422P9BE , YUV422P9LE) #define PIX_FMT_YUV444P9 PIX_FMT_NE(YUV444P9BE , YUV444P9LE) #define PIX_FMT_YUV420P10 PIX_FMT_NE(YUV420P10BE, YUV420P10LE) #define PIX_FMT_YUV422P10 PIX_FMT_NE(YUV422P10BE, YUV422P10LE) #define PIX_FMT_YUV444P10 PIX_FMT_NE(YUV444P10BE, YUV444P10LE) #define PIX_FMT_YUV420P12 PIX_FMT_NE(YUV420P12BE, YUV420P12LE) #define PIX_FMT_YUV422P12 PIX_FMT_NE(YUV422P12BE, YUV422P12LE) #define PIX_FMT_YUV444P12 PIX_FMT_NE(YUV444P12BE, YUV444P12LE) #define PIX_FMT_YUV420P14 PIX_FMT_NE(YUV420P14BE, YUV420P14LE) #define PIX_FMT_YUV422P14 PIX_FMT_NE(YUV422P14BE, YUV422P14LE) #define PIX_FMT_YUV444P14 PIX_FMT_NE(YUV444P14BE, YUV444P14LE) #define PIX_FMT_YUV420P16 PIX_FMT_NE(YUV420P16BE, YUV420P16LE) #define PIX_FMT_YUV422P16 PIX_FMT_NE(YUV422P16BE, YUV422P16LE) #define PIX_FMT_YUV444P16 PIX_FMT_NE(YUV444P16BE, YUV444P16LE) #define PIX_FMT_RGBA64 PIX_FMT_NE(RGBA64BE, RGBA64LE) #define PIX_FMT_BGRA64 PIX_FMT_NE(BGRA64BE, BGRA64LE) #define PIX_FMT_GBRP9 PIX_FMT_NE(GBRP9BE , GBRP9LE) #define PIX_FMT_GBRP10 PIX_FMT_NE(GBRP10BE, GBRP10LE) #define PIX_FMT_GBRP12 PIX_FMT_NE(GBRP12BE, GBRP12LE) #define PIX_FMT_GBRP14 PIX_FMT_NE(GBRP14BE, GBRP14LE) #define PIX_FMT_GBRP16 PIX_FMT_NE(GBRP16BE, GBRP16LE) #endif /* AVUTIL_PIXFMT_H */
17,732
67.467181
224
h
cba-pipeline-public
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libavutil/log.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_LOG_H #define AVUTIL_LOG_H #include <stdarg.h> #include "avutil.h" #include "attributes.h" typedef enum { AV_CLASS_CATEGORY_NA = 0, AV_CLASS_CATEGORY_INPUT, AV_CLASS_CATEGORY_OUTPUT, AV_CLASS_CATEGORY_MUXER, AV_CLASS_CATEGORY_DEMUXER, AV_CLASS_CATEGORY_ENCODER, AV_CLASS_CATEGORY_DECODER, AV_CLASS_CATEGORY_FILTER, AV_CLASS_CATEGORY_BITSTREAM_FILTER, AV_CLASS_CATEGORY_SWSCALER, AV_CLASS_CATEGORY_SWRESAMPLER, AV_CLASS_CATEGORY_NB, ///< not part of ABI/API }AVClassCategory; /** * Describe the class of an AVClass context structure. That is an * arbitrary struct of which the first field is a pointer to an * AVClass struct (e.g. AVCodecContext, AVFormatContext etc.). */ typedef struct AVClass { /** * The name of the class; usually it is the same name as the * context structure type to which the AVClass is associated. */ const char* class_name; /** * A pointer to a function which returns the name of a context * instance ctx associated with the class. */ const char* (*item_name)(void* ctx); /** * a pointer to the first option specified in the class if any or NULL * * @see av_set_default_options() */ const struct AVOption *option; /** * LIBAVUTIL_VERSION with which this structure was created. * This is used to allow fields to be added without requiring major * version bumps everywhere. */ int version; /** * Offset in the structure where log_level_offset is stored. * 0 means there is no such variable */ int log_level_offset_offset; /** * Offset in the structure where a pointer to the parent context for loging is stored. * for example a decoder that uses eval.c could pass its AVCodecContext to eval as such * parent context. And a av_log() implementation could then display the parent context * can be NULL of course */ int parent_log_context_offset; /** * Return next AVOptions-enabled child or NULL */ void* (*child_next)(void *obj, void *prev); /** * Return an AVClass corresponding to next potential * AVOptions-enabled child. * * The difference between child_next and this is that * child_next iterates over _already existing_ objects, while * child_class_next iterates over _all possible_ children. */ const struct AVClass* (*child_class_next)(const struct AVClass *prev); /** * Category used for visualization (like color) * This is only set if the category is equal for all objects using this class. * available since version (51 << 16 | 56 << 8 | 100) */ AVClassCategory category; /** * Callback to return the category. * available since version (51 << 16 | 59 << 8 | 100) */ AVClassCategory (*get_category)(void* ctx); } AVClass; /* av_log API */ #define AV_LOG_QUIET -8 /** * Something went really wrong and we will crash now. */ #define AV_LOG_PANIC 0 /** * Something went wrong and recovery is not possible. * For example, no header was found for a format which depends * on headers or an illegal combination of parameters is used. */ #define AV_LOG_FATAL 8 /** * Something went wrong and cannot losslessly be recovered. * However, not all future data is affected. */ #define AV_LOG_ERROR 16 /** * Something somehow does not look correct. This may or may not * lead to problems. An example would be the use of '-vstrict -2'. */ #define AV_LOG_WARNING 24 #define AV_LOG_INFO 32 #define AV_LOG_VERBOSE 40 /** * Stuff which is only useful for libav* developers. */ #define AV_LOG_DEBUG 48 #define AV_LOG_MAX_OFFSET (AV_LOG_DEBUG - AV_LOG_QUIET) /** * Send the specified message to the log if the level is less than or equal * to the current av_log_level. By default, all logging messages are sent to * stderr. This behavior can be altered by setting a different av_vlog callback * function. * * @param avcl A pointer to an arbitrary struct of which the first field is a * pointer to an AVClass struct. * @param level The importance level of the message, lower values signifying * higher importance. * @param fmt The format string (printf-compatible) that specifies how * subsequent arguments are converted to output. * @see av_vlog */ void av_log(void *avcl, int level, const char *fmt, ...) av_printf_format(3, 4); void av_vlog(void *avcl, int level, const char *fmt, va_list); int av_log_get_level(void); void av_log_set_level(int); void av_log_set_callback(void (*)(void*, int, const char*, va_list)); void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl); const char* av_default_item_name(void* ctx); AVClassCategory av_default_get_category(void *ptr); /** * Format a line of log the same way as the default callback. * @param line buffer to receive the formated line * @param line_size size of the buffer * @param print_prefix used to store whether the prefix must be printed; * must point to a persistent integer initially set to 1 */ void av_log_format_line(void *ptr, int level, const char *fmt, va_list vl, char *line, int line_size, int *print_prefix); /** * av_dlog macros * Useful to print debug messages that shouldn't get compiled in normally. */ #ifdef DEBUG # define av_dlog(pctx, ...) av_log(pctx, AV_LOG_DEBUG, __VA_ARGS__) #else # define av_dlog(pctx, ...) do { if (0) av_log(pctx, AV_LOG_DEBUG, __VA_ARGS__); } while (0) #endif /** * Skip repeated messages, this requires the user app to use av_log() instead of * (f)printf as the 2 would otherwise interfere and lead to * "Last message repeated x times" messages below (f)printf messages with some * bad luck. * Also to receive the last, "last repeated" line if any, the user app must * call av_log(NULL, AV_LOG_QUIET, "%s", ""); at the end */ #define AV_LOG_SKIP_REPEATED 1 void av_log_set_flags(int arg); #endif /* AVUTIL_LOG_H */
6,880
31.154206
95
h
cba-pipeline-public
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libavutil/intfloat_readwrite.h
/* * copyright (c) 2005 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_INTFLOAT_READWRITE_H #define AVUTIL_INTFLOAT_READWRITE_H #include <stdint.h> #include "attributes.h" /* IEEE 80 bits extended float */ typedef struct AVExtFloat { uint8_t exponent[2]; uint8_t mantissa[8]; } AVExtFloat; attribute_deprecated double av_int2dbl(int64_t v) av_const; attribute_deprecated float av_int2flt(int32_t v) av_const; attribute_deprecated double av_ext2dbl(const AVExtFloat ext) av_const; attribute_deprecated int64_t av_dbl2int(double d) av_const; attribute_deprecated int32_t av_flt2int(float d) av_const; attribute_deprecated AVExtFloat av_dbl2ext(double d) av_const; #endif /* AVUTIL_INTFLOAT_READWRITE_H */
1,488
35.317073
79
h
cba-pipeline-public
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libavutil/avassert.h
/* * copyright (c) 2010 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 */ /** * @file * simple assert() macros that are a bit more flexible than ISO C assert(). * @author Michael Niedermayer <[email protected]> */ #ifndef AVUTIL_AVASSERT_H #define AVUTIL_AVASSERT_H #include <stdlib.h> #include "avutil.h" #include "log.h" /** * assert() equivalent, that is always enabled. */ #define av_assert0(cond) do { \ if (!(cond)) { \ av_log(NULL, AV_LOG_FATAL, "Assertion %s failed at %s:%d\n", \ AV_STRINGIFY(cond), __FILE__, __LINE__); \ abort(); \ } \ } while (0) /** * assert() equivalent, that does not lie in speed critical code. * These asserts() thus can be enabled without fearing speedloss. */ #if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 0 #define av_assert1(cond) av_assert0(cond) #else #define av_assert1(cond) ((void)0) #endif /** * assert() equivalent, that does lie in speed critical code. */ #if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 1 #define av_assert2(cond) av_assert0(cond) #else #define av_assert2(cond) ((void)0) #endif #endif /* AVUTIL_AVASSERT_H */
2,113
30.552239
79
h
cba-pipeline-public
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libavutil/aes.h
/* * copyright (c) 2007 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_AES_H #define AVUTIL_AES_H #include <stdint.h> /** * @defgroup lavu_aes AES * @ingroup lavu_crypto * @{ */ extern const int av_aes_size; struct AVAES; /** * Initialize an AVAES context. * @param key_bits 128, 192 or 256 * @param decrypt 0 for encryption, 1 for decryption */ int av_aes_init(struct AVAES *a, const uint8_t *key, int key_bits, int decrypt); /** * Encrypt or decrypt a buffer using a previously initialized context. * @param count number of 16 byte blocks * @param dst destination array, can be equal to src * @param src source array, can be equal to dst * @param iv initialization vector for CBC mode, if NULL then ECB will be used * @param decrypt 0 for encryption, 1 for decryption */ void av_aes_crypt(struct AVAES *a, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt); /** * @} */ #endif /* AVUTIL_AES_H */
1,715
28.586207
106
h
cba-pipeline-public
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libavutil/sha.h
/* * Copyright (C) 2007 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_SHA_H #define AVUTIL_SHA_H #include <stdint.h> /** * @defgroup lavu_sha SHA * @ingroup lavu_crypto * @{ */ extern const int av_sha_size; struct AVSHA; /** * Initialize SHA-1 or SHA-2 hashing. * * @param context pointer to the function context (of size av_sha_size) * @param bits number of bits in digest (SHA-1 - 160 bits, SHA-2 224 or 256 bits) * @return zero if initialization succeeded, -1 otherwise */ int av_sha_init(struct AVSHA* context, int bits); /** * Update hash value. * * @param context hash function context * @param data input data to update hash with * @param len input data length */ void av_sha_update(struct AVSHA* context, const uint8_t* data, unsigned int len); /** * Finish hashing and output digest value. * * @param context hash function context * @param digest buffer where output digest value is stored */ void av_sha_final(struct AVSHA* context, uint8_t *digest); /** * @} */ #endif /* AVUTIL_SHA_H */
1,822
26.208955
84
h
cba-pipeline-public
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libavutil/samplefmt.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_SAMPLEFMT_H #define AVUTIL_SAMPLEFMT_H #include <stdint.h> #include "avutil.h" #include "attributes.h" /** * Audio Sample Formats * * @par * The data described by the sample format is always in native-endian order. * Sample values can be expressed by native C types, hence the lack of a signed * 24-bit sample format even though it is a common raw audio data format. * * @par * The floating-point formats are based on full volume being in the range * [-1.0, 1.0]. Any values outside this range are beyond full volume level. * * @par * The data layout as used in av_samples_fill_arrays() and elsewhere in Libav * (such as AVFrame in libavcodec) is as follows: * * For planar sample formats, each audio channel is in a separate data plane, * and linesize is the buffer size, in bytes, for a single plane. All data * planes must be the same size. For packed sample formats, only the first data * plane is used, and samples for each channel are interleaved. In this case, * linesize is the buffer size, in bytes, for the 1 plane. */ enum AVSampleFormat { AV_SAMPLE_FMT_NONE = -1, AV_SAMPLE_FMT_U8, ///< unsigned 8 bits AV_SAMPLE_FMT_S16, ///< signed 16 bits AV_SAMPLE_FMT_S32, ///< signed 32 bits AV_SAMPLE_FMT_FLT, ///< float AV_SAMPLE_FMT_DBL, ///< double AV_SAMPLE_FMT_U8P, ///< unsigned 8 bits, planar AV_SAMPLE_FMT_S16P, ///< signed 16 bits, planar AV_SAMPLE_FMT_S32P, ///< signed 32 bits, planar AV_SAMPLE_FMT_FLTP, ///< float, planar AV_SAMPLE_FMT_DBLP, ///< double, planar AV_SAMPLE_FMT_NB ///< Number of sample formats. DO NOT USE if linking dynamically }; /** * Return the name of sample_fmt, or NULL if sample_fmt is not * recognized. */ const char *av_get_sample_fmt_name(enum AVSampleFormat sample_fmt); /** * Return a sample format corresponding to name, or AV_SAMPLE_FMT_NONE * on error. */ enum AVSampleFormat av_get_sample_fmt(const char *name); /** * Return the planar<->packed alternative form of the given sample format, or * AV_SAMPLE_FMT_NONE on error. If the passed sample_fmt is already in the * requested planar/packed format, the format returned is the same as the * input. */ enum AVSampleFormat av_get_alt_sample_fmt(enum AVSampleFormat sample_fmt, int planar); /** * Get the packed alternative form of the given sample format. * * If the passed sample_fmt is already in packed format, the format returned is * the same as the input. * * @return the packed alternative form of the given sample format or AV_SAMPLE_FMT_NONE on error. */ enum AVSampleFormat av_get_packed_sample_fmt(enum AVSampleFormat sample_fmt); /** * Get the planar alternative form of the given sample format. * * If the passed sample_fmt is already in planar format, the format returned is * the same as the input. * * @return the planar alternative form of the given sample format or AV_SAMPLE_FMT_NONE on error. */ enum AVSampleFormat av_get_planar_sample_fmt(enum AVSampleFormat sample_fmt); /** * Generate a string corresponding to the sample format with * sample_fmt, or a header if sample_fmt is negative. * * @param buf the buffer where to write the string * @param buf_size the size of buf * @param sample_fmt the number of the sample format to print the * corresponding info string, or a negative value to print the * corresponding header. * @return the pointer to the filled buffer or NULL if sample_fmt is * unknown or in case of other errors */ char *av_get_sample_fmt_string(char *buf, int buf_size, enum AVSampleFormat sample_fmt); #if FF_API_GET_BITS_PER_SAMPLE_FMT /** * @deprecated Use av_get_bytes_per_sample() instead. */ attribute_deprecated int av_get_bits_per_sample_fmt(enum AVSampleFormat sample_fmt); #endif /** * Return number of bytes per sample. * * @param sample_fmt the sample format * @return number of bytes per sample or zero if unknown for the given * sample format */ int av_get_bytes_per_sample(enum AVSampleFormat sample_fmt); /** * Check if the sample format is planar. * * @param sample_fmt the sample format to inspect * @return 1 if the sample format is planar, 0 if it is interleaved */ int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt); /** * Get the required buffer size for the given audio parameters. * * @param[out] linesize calculated linesize, may be NULL * @param nb_channels the number of channels * @param nb_samples the number of samples in a single channel * @param sample_fmt the sample format * @param align buffer size alignment (0 = default, 1 = no alignment) * @return required buffer size, or negative error code on failure */ int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align); /** * Fill channel data pointers and linesize for samples with sample * format sample_fmt. * * The pointers array is filled with the pointers to the samples data: * for planar, set the start point of each channel's data within the buffer, * for packed, set the start point of the entire buffer only. * * The linesize array is filled with the aligned size of each channel's data * buffer for planar layout, or the aligned size of the buffer for all channels * for packed layout. * * @see enum AVSampleFormat * The documentation for AVSampleFormat describes the data layout. * * @param[out] audio_data array to be filled with the pointer for each channel * @param[out] linesize calculated linesize, may be NULL * @param buf the pointer to a buffer containing the samples * @param nb_channels the number of channels * @param nb_samples the number of samples in a single channel * @param sample_fmt the sample format * @param align buffer size alignment (0 = default, 1 = no alignment) * @return 0 on success or a negative error code on failure */ int av_samples_fill_arrays(uint8_t **audio_data, int *linesize, const uint8_t *buf, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align); /** * Allocate a samples buffer for nb_samples samples, and fill data pointers and * linesize accordingly. * The allocated samples buffer can be freed by using av_freep(&audio_data[0]) * * @see enum AVSampleFormat * The documentation for AVSampleFormat describes the data layout. * * @param[out] audio_data array to be filled with the pointer for each channel * @param[out] linesize aligned size for audio buffer(s), may be NULL * @param nb_channels number of audio channels * @param nb_samples number of samples per channel * @param align buffer size alignment (0 = default, 1 = no alignment) * @return 0 on success or a negative error code on failure * @see av_samples_fill_arrays() */ int av_samples_alloc(uint8_t **audio_data, int *linesize, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align); /** * Copy samples from src to dst. * * @param dst destination array of pointers to data planes * @param src source array of pointers to data planes * @param dst_offset offset in samples at which the data will be written to dst * @param src_offset offset in samples at which the data will be read from src * @param nb_samples number of samples to be copied * @param nb_channels number of audio channels * @param sample_fmt audio sample format */ int av_samples_copy(uint8_t **dst, uint8_t * const *src, int dst_offset, int src_offset, int nb_samples, int nb_channels, enum AVSampleFormat sample_fmt); /** * Fill an audio buffer with silence. * * @param audio_data array of pointers to data planes * @param offset offset in samples at which to start filling * @param nb_samples number of samples to fill * @param nb_channels number of audio channels * @param sample_fmt audio sample format */ int av_samples_set_silence(uint8_t **audio_data, int offset, int nb_samples, int nb_channels, enum AVSampleFormat sample_fmt); #endif /* AVUTIL_SAMPLEFMT_H */
9,129
37.686441
95
h
cba-pipeline-public
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libavutil/bprint.h
/* * Copyright (c) 2012 Nicolas George * * 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_BPRINT_H #define AVUTIL_BPRINT_H #include "attributes.h" /** * Define a structure with extra padding to a fixed size * This helps ensuring binary compatibility with future versions. */ #define FF_PAD_STRUCTURE(size, ...) \ __VA_ARGS__ \ char reserved_padding[size - sizeof(struct { __VA_ARGS__ })]; /** * Buffer to print data progressively * * The string buffer grows as necessary and is always 0-terminated. * The content of the string is never accessed, and thus is * encoding-agnostic and can even hold binary data. * * Small buffers are kept in the structure itself, and thus require no * memory allocation at all (unless the contents of the buffer is needed * after the structure goes out of scope). This is almost as lightweight as * declaring a local "char buf[512]". * * The length of the string can go beyond the allocated size: the buffer is * then truncated, but the functions still keep account of the actual total * length. * * In other words, buf->len can be greater than buf->size and records the * total length of what would have been to the buffer if there had been * enough memory. * * Append operations do not need to be tested for failure: if a memory * allocation fails, data stop being appended to the buffer, but the length * is still updated. This situation can be tested with * av_bprint_is_complete(). * * The size_max field determines several possible behaviours: * * size_max = -1 (= UINT_MAX) or any large value will let the buffer be * reallocated as necessary, with an amortized linear cost. * * size_max = 0 prevents writing anything to the buffer: only the total * length is computed. The write operations can then possibly be repeated in * a buffer with exactly the necessary size * (using size_init = size_max = len + 1). * * size_max = 1 is automatically replaced by the exact size available in the * structure itself, thus ensuring no dynamic memory allocation. The * internal buffer is large enough to hold a reasonable paragraph of text, * such as the current paragraph. */ typedef struct AVBPrint { FF_PAD_STRUCTURE(1024, char *str; /** string so far */ unsigned len; /** length so far */ unsigned size; /** allocated memory */ unsigned size_max; /** maximum allocated memory */ char reserved_internal_buffer[1]; ) } AVBPrint; /** * Convenience macros for special values for av_bprint_init() size_max * parameter. */ #define AV_BPRINT_SIZE_UNLIMITED ((unsigned)-1) #define AV_BPRINT_SIZE_AUTOMATIC 1 #define AV_BPRINT_SIZE_COUNT_ONLY 0 /** * Init a print buffer. * * @param buf buffer to init * @param size_init initial size (including the final 0) * @param size_max maximum size; * 0 means do not write anything, just count the length; * 1 is replaced by the maximum value for automatic storage; * any large value means that the internal buffer will be * reallocated as needed up to that limit; -1 is converted to * UINT_MAX, the largest limit possible. * Check also AV_BPRINT_SIZE_* macros. */ void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max); /** * Init a print buffer using a pre-existing buffer. * * The buffer will not be reallocated. * * @param buf buffer structure to init * @param buffer byte buffer to use for the string data * @param size size of buffer */ void av_bprint_init_for_buffer(AVBPrint *buf, char *buffer, unsigned size); /** * Append a formated string to a print buffer. */ void av_bprintf(AVBPrint *buf, const char *fmt, ...) av_printf_format(2, 3); /** * Append char c n times to a print buffer. */ void av_bprint_chars(AVBPrint *buf, char c, unsigned n); /** * Reset the string to "" but keep internal allocated data. */ void av_bprint_clear(AVBPrint *buf); /** * Test if the print buffer is complete (not truncated). * * It may have been truncated due to a memory allocation failure * or the size_max limit (compare size and size_max if necessary). */ static inline int av_bprint_is_complete(AVBPrint *buf) { return buf->len < buf->size; } /** * Finalize a print buffer. * * The print buffer can no longer be used afterwards, * but the len and size fields are still valid. * * @arg[out] ret_str if not NULL, used to return a permanent copy of the * buffer contents, or NULL if memory allocation fails; * if NULL, the buffer is discarded and freed * @return 0 for success or error code (probably AVERROR(ENOMEM)) */ int av_bprint_finalize(AVBPrint *buf, char **ret_str); #endif /* AVUTIL_BPRINT_H */
5,533
34.025316
79
h
cba-pipeline-public
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libavutil/timestamp.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 */ /** * @file * timestamp utils, mostly useful for debugging/logging purposes */ #ifndef AVUTIL_TIMESTAMP_H #define AVUTIL_TIMESTAMP_H #include "common.h" #define AV_TS_MAX_STRING_SIZE 32 /** * Fill the provided buffer with a string containing a timestamp * representation. * * @param buf a buffer with size in bytes of at least AV_TS_MAX_STRING_SIZE * @param ts the timestamp to represent * @return the buffer in input */ static inline char *av_ts_make_string(char *buf, int64_t ts) { if (ts == AV_NOPTS_VALUE) snprintf(buf, AV_TS_MAX_STRING_SIZE, "NOPTS"); else snprintf(buf, AV_TS_MAX_STRING_SIZE, "%"PRId64"", ts); return buf; } /** * Convenience macro, the return value should be used only directly in * function arguments but never stand-alone. */ #define av_ts2str(ts) av_ts_make_string((char[AV_TS_MAX_STRING_SIZE]){0}, ts) /** * Fill the provided buffer with a string containing a timestamp time * representation. * * @param buf a buffer with size in bytes of at least AV_TS_MAX_STRING_SIZE * @param ts the timestamp to represent * @param tb the timebase of the timestamp * @return the buffer in input */ static inline char *av_ts_make_time_string(char *buf, int64_t ts, AVRational *tb) { if (ts == AV_NOPTS_VALUE) snprintf(buf, AV_TS_MAX_STRING_SIZE, "NOPTS"); else snprintf(buf, AV_TS_MAX_STRING_SIZE, "%.6g", av_q2d(*tb) * ts); return buf; } /** * Convenience macro, the return value should be used only directly in * function arguments but never stand-alone. */ #define av_ts2timestr(ts, tb) av_ts_make_time_string((char[AV_TS_MAX_STRING_SIZE]){0}, ts, tb) #endif /* AVUTIL_TIMESTAMP_H */
2,462
31.84
94
h
cba-pipeline-public
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libavutil/version.h
/* * copyright (c) 2003 Fabrice Bellard * * 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_VERSION_H #define AVUTIL_VERSION_H #include "avutil.h" /** * @file * @ingroup lavu * Libavutil version macros */ /** * @defgroup lavu_ver Version and Build diagnostics * * Macros and function useful to check at compiletime and at runtime * which version of libavutil is in use. * * @{ */ #define LIBAVUTIL_VERSION_MAJOR 51 #define LIBAVUTIL_VERSION_MINOR 72 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ LIBAVUTIL_VERSION_MINOR, \ LIBAVUTIL_VERSION_MICRO) #define LIBAVUTIL_VERSION AV_VERSION(LIBAVUTIL_VERSION_MAJOR, \ LIBAVUTIL_VERSION_MINOR, \ LIBAVUTIL_VERSION_MICRO) #define LIBAVUTIL_BUILD LIBAVUTIL_VERSION_INT #define LIBAVUTIL_IDENT "Lavu" AV_STRINGIFY(LIBAVUTIL_VERSION) /** * @} * * @defgroup depr_guards Deprecation guards * 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_EVAL_NAMES #define FF_API_OLD_EVAL_NAMES (LIBAVUTIL_VERSION_MAJOR < 52) #endif #ifndef FF_API_GET_BITS_PER_SAMPLE_FMT #define FF_API_GET_BITS_PER_SAMPLE_FMT (LIBAVUTIL_VERSION_MAJOR < 52) #endif #ifndef FF_API_FIND_OPT #define FF_API_FIND_OPT (LIBAVUTIL_VERSION_MAJOR < 52) #endif #ifndef FF_API_AV_FIFO_PEEK #define FF_API_AV_FIFO_PEEK (LIBAVUTIL_VERSION_MAJOR < 52) #endif #ifndef FF_API_OLD_AVOPTIONS #define FF_API_OLD_AVOPTIONS (LIBAVUTIL_VERSION_MAJOR < 52) #endif #ifndef FF_API_OLD_TC_ADJUST_FRAMENUM #define FF_API_OLD_TC_ADJUST_FRAMENUM (LIBAVUTIL_VERSION_MAJOR < 52) #endif /** * @} */ #endif /* AVUTIL_VERSION_H */
2,784
29.604396
79
h
cba-pipeline-public
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libavutil/cpu.h
/* * Copyright (c) 2000, 2001, 2002 Fabrice Bellard * * 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_CPU_H #define AVUTIL_CPU_H #include "attributes.h" #define AV_CPU_FLAG_FORCE 0x80000000 /* force usage of selected flags (OR) */ /* lower 16 bits - CPU features */ #define AV_CPU_FLAG_MMX 0x0001 ///< standard MMX #define AV_CPU_FLAG_MMXEXT 0x0002 ///< SSE integer functions or AMD MMX ext #define AV_CPU_FLAG_MMX2 0x0002 ///< SSE integer functions or AMD MMX ext #define AV_CPU_FLAG_3DNOW 0x0004 ///< AMD 3DNOW #define AV_CPU_FLAG_SSE 0x0008 ///< SSE functions #define AV_CPU_FLAG_SSE2 0x0010 ///< PIV SSE2 functions #define AV_CPU_FLAG_SSE2SLOW 0x40000000 ///< SSE2 supported, but usually not faster #define AV_CPU_FLAG_3DNOWEXT 0x0020 ///< AMD 3DNowExt #define AV_CPU_FLAG_SSE3 0x0040 ///< Prescott SSE3 functions #define AV_CPU_FLAG_SSE3SLOW 0x20000000 ///< SSE3 supported, but usually not faster #define AV_CPU_FLAG_SSSE3 0x0080 ///< Conroe SSSE3 functions #define AV_CPU_FLAG_ATOM 0x10000000 ///< Atom processor, some SSSE3 instructions are slower #define AV_CPU_FLAG_SSE4 0x0100 ///< Penryn SSE4.1 functions #define AV_CPU_FLAG_SSE42 0x0200 ///< Nehalem SSE4.2 functions #define AV_CPU_FLAG_AVX 0x4000 ///< AVX functions: requires OS support even if YMM registers aren't used #define AV_CPU_FLAG_XOP 0x0400 ///< Bulldozer XOP functions #define AV_CPU_FLAG_FMA4 0x0800 ///< Bulldozer FMA4 functions // #if LIBAVUTIL_VERSION_MAJOR <52 #define AV_CPU_FLAG_CMOV 0x1001000 ///< supports cmov instruction // #else // #define AV_CPU_FLAG_CMOV 0x1000 ///< supports cmov instruction // #endif #define AV_CPU_FLAG_ALTIVEC 0x0001 ///< standard #define AV_CPU_FLAG_ARMV5TE (1 << 0) #define AV_CPU_FLAG_ARMV6 (1 << 1) #define AV_CPU_FLAG_ARMV6T2 (1 << 2) #define AV_CPU_FLAG_VFP (1 << 3) #define AV_CPU_FLAG_VFPV3 (1 << 4) #define AV_CPU_FLAG_NEON (1 << 5) /** * Return the flags which specify extensions supported by the CPU. */ int av_get_cpu_flags(void); /** * Disables cpu detection and forces the specified flags. * -1 is a special case that disables forcing of specific flags. */ void av_force_cpu_flags(int flags); /** * Set a mask on flags returned by av_get_cpu_flags(). * This function is mainly useful for testing. * Please use av_force_cpu_flags() and av_get_cpu_flags() instead which are more flexible * * @warning this function is not thread safe. */ attribute_deprecated void av_set_cpu_flags_mask(int mask); /** * Parse CPU flags from a string. * * The returned flags contain the specified flags as well as related unspecified flags. * * This function exists only for compatibility with libav. * Please use av_parse_cpu_caps() when possible. * @return a combination of AV_CPU_* flags, negative on error. */ attribute_deprecated int av_parse_cpu_flags(const char *s); /** * Parse CPU caps from a string and update the given AV_CPU_* flags based on that. * * @return negative on error. */ int av_parse_cpu_caps(unsigned *flags, const char *s); /* The following CPU-specific functions shall not be called directly. */ int ff_get_cpu_flags_arm(void); int ff_get_cpu_flags_ppc(void); int ff_get_cpu_flags_x86(void); #endif /* AVUTIL_CPU_H */
4,090
37.59434
113
h
cba-pipeline-public
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libavutil/base64.h
/* * Copyright (c) 2006 Ryan Martell. ([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_BASE64_H #define AVUTIL_BASE64_H #include <stdint.h> /** * @defgroup lavu_base64 Base64 * @ingroup lavu_crypto * @{ */ /** * Decode a base64-encoded string. * * @param out buffer for decoded data * @param in null-terminated input string * @param out_size size in bytes of the out buffer, must be at * least 3/4 of the length of in * @return number of bytes written, or a negative value in case of * invalid input */ int av_base64_decode(uint8_t *out, const char *in, int out_size); /** * Encode data to base64 and null-terminate. * * @param out buffer for encoded data * @param out_size size in bytes of the output buffer, must be at * least AV_BASE64_SIZE(in_size) * @param in_size size in bytes of the 'in' buffer * @return 'out' or NULL in case of error */ char *av_base64_encode(char *out, int out_size, const uint8_t *in, int in_size); /** * Calculate the output size needed to base64-encode x bytes. */ #define AV_BASE64_SIZE(x) (((x)+2) / 3 * 4 + 1) /** * @} */ #endif /* AVUTIL_BASE64_H */
1,961
28.727273
80
h
cba-pipeline-public
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libavutil/md5.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_MD5_H #define AVUTIL_MD5_H #include <stdint.h> /** * @defgroup lavu_md5 MD5 * @ingroup lavu_crypto * @{ */ extern const int av_md5_size; struct AVMD5; void av_md5_init(struct AVMD5 *ctx); void av_md5_update(struct AVMD5 *ctx, const uint8_t *src, const int len); void av_md5_final(struct AVMD5 *ctx, uint8_t *dst); void av_md5_sum(uint8_t *dst, const uint8_t *src, const int len); /** * @} */ #endif /* AVUTIL_MD5_H */
1,274
26.717391
79
h
cba-pipeline-public
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libavutil/mem.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 */ /** * @file * memory handling functions */ #ifndef AVUTIL_MEM_H #define AVUTIL_MEM_H #include <limits.h> #include "attributes.h" #include "error.h" #include "avutil.h" /** * @addtogroup lavu_mem * @{ */ #if defined(__INTEL_COMPILER) && __INTEL_COMPILER < 1110 || defined(__SUNPRO_C) #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v #define DECLARE_ASM_CONST(n,t,v) const t __attribute__ ((aligned (n))) v #elif defined(__TI_COMPILER_VERSION__) #define DECLARE_ALIGNED(n,t,v) \ AV_PRAGMA(DATA_ALIGN(v,n)) \ t __attribute__((aligned(n))) v #define DECLARE_ASM_CONST(n,t,v) \ AV_PRAGMA(DATA_ALIGN(v,n)) \ static const t __attribute__((aligned(n))) v #elif defined(__GNUC__) #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v #define DECLARE_ASM_CONST(n,t,v) static const t av_used __attribute__ ((aligned (n))) v #elif defined(_MSC_VER) #define DECLARE_ALIGNED(n,t,v) __declspec(align(n)) t v #define DECLARE_ASM_CONST(n,t,v) __declspec(align(n)) static const t v #else #define DECLARE_ALIGNED(n,t,v) t v #define DECLARE_ASM_CONST(n,t,v) static const t v #endif #if AV_GCC_VERSION_AT_LEAST(3,1) #define av_malloc_attrib __attribute__((__malloc__)) #else #define av_malloc_attrib #endif #if AV_GCC_VERSION_AT_LEAST(4,3) #define av_alloc_size(...) __attribute__((alloc_size(__VA_ARGS__))) #else #define av_alloc_size(...) #endif /** * Allocate a block of size bytes with alignment suitable for all * memory accesses (including vectors if available on the CPU). * @param size Size in bytes for the memory block to be allocated. * @return Pointer to the allocated block, NULL if the block cannot * be allocated. * @see av_mallocz() */ void *av_malloc(size_t size) av_malloc_attrib av_alloc_size(1); /** * Helper function to allocate a block of size * nmemb bytes with * using av_malloc() * @param nmemb Number of elements * @param size Size of the single element * @return Pointer to the allocated block, NULL if the block cannot * be allocated. * @see av_malloc() */ av_alloc_size(1,2) static inline void *av_malloc_array(size_t nmemb, size_t size) { if (size <= 0 || nmemb >= INT_MAX / size) return NULL; return av_malloc(nmemb * size); } /** * Allocate or reallocate a block of memory. * If ptr is NULL and size > 0, allocate a new block. If * size is zero, free the memory block pointed to by ptr. * @param ptr Pointer to a memory block already allocated with * av_malloc(z)() or av_realloc() or NULL. * @param size Size in bytes for the memory block to be allocated or * reallocated. * @return Pointer to a newly reallocated block or NULL if the block * cannot be reallocated or the function is used to free the memory block. * @see av_fast_realloc() */ void *av_realloc(void *ptr, size_t size) av_alloc_size(2); /** * Allocate or reallocate a block of memory. * This function does the same thing as av_realloc, except: * - It takes two arguments and checks the result of the multiplication for * integer overflow. * - It frees the input block in case of failure, thus avoiding the memory * leak with the classic "buf = realloc(buf); if (!buf) return -1;". */ void *av_realloc_f(void *ptr, size_t nelem, size_t elsize); /** * Free a memory block which has been allocated with av_malloc(z)() or * av_realloc(). * @param ptr Pointer to the memory block which should be freed. * @note ptr = NULL is explicitly allowed. * @note It is recommended that you use av_freep() instead. * @see av_freep() */ void av_free(void *ptr); /** * Allocate a block of size bytes with alignment suitable for all * memory accesses (including vectors if available on the CPU) and * zero all the bytes of the block. * @param size Size in bytes for the memory block to be allocated. * @return Pointer to the allocated block, NULL if it cannot be allocated. * @see av_malloc() */ void *av_mallocz(size_t size) av_malloc_attrib av_alloc_size(1); /** * Allocate a block of nmemb * size bytes with alignment suitable for all * memory accesses (including vectors if available on the CPU) and * zero all the bytes of the block. * The allocation will fail if nmemb * size is greater than or equal * to INT_MAX. * @param nmemb * @param size * @return Pointer to the allocated block, NULL if it cannot be allocated. */ void *av_calloc(size_t nmemb, size_t size) av_malloc_attrib; /** * Helper function to allocate a block of size * nmemb bytes with * using av_mallocz() * @param nmemb Number of elements * @param size Size of the single element * @return Pointer to the allocated block, NULL if the block cannot * be allocated. * @see av_mallocz() * @see av_malloc_array() */ av_alloc_size(1,2) static inline void *av_mallocz_array(size_t nmemb, size_t size) { if (size <= 0 || nmemb >= INT_MAX / size) return NULL; return av_mallocz(nmemb * size); } /** * Duplicate the string s. * @param s string to be duplicated * @return Pointer to a newly allocated string containing a * copy of s or NULL if the string cannot be allocated. */ char *av_strdup(const char *s) av_malloc_attrib; /** * Free a memory block which has been allocated with av_malloc(z)() or * av_realloc() and set the pointer pointing to it to NULL. * @param ptr Pointer to the pointer to the memory block which should * be freed. * @see av_free() */ void av_freep(void *ptr); /** * Add an element to a dynamic array. * * @param tab_ptr Pointer to the array. * @param nb_ptr Pointer to the number of elements in the array. * @param elem Element to be added. */ void av_dynarray_add(void *tab_ptr, int *nb_ptr, void *elem); /** * Multiply two size_t values checking for overflow. * @return 0 if success, AVERROR(EINVAL) if overflow. */ static inline int av_size_mult(size_t a, size_t b, size_t *r) { size_t t = a * b; /* Hack inspired from glibc: only try the division if nelem and elsize * are both greater than sqrt(SIZE_MAX). */ if ((a | b) >= ((size_t)1 << (sizeof(size_t) * 4)) && a && t / a != b) return AVERROR(EINVAL); *r = t; return 0; } /** * Set the maximum size that may me allocated in one block. */ void av_max_alloc(size_t max); /** * @} */ #endif /* AVUTIL_MEM_H */
7,261
31.419643
94
h
cba-pipeline-public
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libavutil/avstring.h
/* * Copyright (c) 2007 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_AVSTRING_H #define AVUTIL_AVSTRING_H #include <stddef.h> #include "attributes.h" /** * @addtogroup lavu_string * @{ */ /** * Return non-zero if pfx is a prefix of str. If it is, *ptr is set to * the address of the first character in str after the prefix. * * @param str input string * @param pfx prefix to test * @param ptr updated if the prefix is matched inside str * @return non-zero if the prefix matches, zero otherwise */ int av_strstart(const char *str, const char *pfx, const char **ptr); /** * Return non-zero if pfx is a prefix of str independent of case. If * it is, *ptr is set to the address of the first character in str * after the prefix. * * @param str input string * @param pfx prefix to test * @param ptr updated if the prefix is matched inside str * @return non-zero if the prefix matches, zero otherwise */ int av_stristart(const char *str, const char *pfx, const char **ptr); /** * Locate the first case-independent occurrence in the string haystack * of the string needle. A zero-length string needle is considered to * match at the start of haystack. * * This function is a case-insensitive version of the standard strstr(). * * @param haystack string to search in * @param needle string to search for * @return pointer to the located match within haystack * or a null pointer if no match */ char *av_stristr(const char *haystack, const char *needle); /** * Copy the string src to dst, but no more than size - 1 bytes, and * null-terminate dst. * * This function is the same as BSD strlcpy(). * * @param dst destination buffer * @param src source string * @param size size of destination buffer * @return the length of src * * @warning since the return value is the length of src, src absolutely * _must_ be a properly 0-terminated string, otherwise this will read beyond * the end of the buffer and possibly crash. */ size_t av_strlcpy(char *dst, const char *src, size_t size); /** * Append the string src to the string dst, but to a total length of * no more than size - 1 bytes, and null-terminate dst. * * This function is similar to BSD strlcat(), but differs when * size <= strlen(dst). * * @param dst destination buffer * @param src source string * @param size size of destination buffer * @return the total length of src and dst * * @warning since the return value use the length of src and dst, these * absolutely _must_ be a properly 0-terminated strings, otherwise this * will read beyond the end of the buffer and possibly crash. */ size_t av_strlcat(char *dst, const char *src, size_t size); /** * Append output to a string, according to a format. Never write out of * the destination buffer, and always put a terminating 0 within * the buffer. * @param dst destination buffer (string to which the output is * appended) * @param size total size of the destination buffer * @param fmt printf-compatible format string, specifying how the * following parameters are used * @return the length of the string that would have been generated * if enough space had been available */ size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...) av_printf_format(3, 4); /** * Print arguments following specified format into a large enough auto * allocated buffer. It is similar to GNU asprintf(). * @param fmt printf-compatible format string, specifying how the * following parameters are used. * @return the allocated string * @note You have to free the string yourself with av_free(). */ char *av_asprintf(const char *fmt, ...) av_printf_format(1, 2); /** * Convert a number to a av_malloced string. */ char *av_d2str(double d); /** * Unescape the given string until a non escaped terminating char, * and return the token corresponding to the unescaped string. * * The normal \ and ' escaping is supported. Leading and trailing * whitespaces are removed, unless they are escaped with '\' or are * enclosed between ''. * * @param buf the buffer to parse, buf will be updated to point to the * terminating char * @param term a 0-terminated list of terminating chars * @return the malloced unescaped string, which must be av_freed by * the user, NULL in case of allocation failure */ char *av_get_token(const char **buf, const char *term); /** * Split the string into several tokens which can be accessed by * successive calls to av_strtok(). * * A token is defined as a sequence of characters not belonging to the * set specified in delim. * * On the first call to av_strtok(), s should point to the string to * parse, and the value of saveptr is ignored. In subsequent calls, s * should be NULL, and saveptr should be unchanged since the previous * call. * * This function is similar to strtok_r() defined in POSIX.1. * * @param s the string to parse, may be NULL * @param delim 0-terminated list of token delimiters, must be non-NULL * @param saveptr user-provided pointer which points to stored * information necessary for av_strtok() to continue scanning the same * string. saveptr is updated to point to the next character after the * first delimiter found, or to NULL if the string was terminated * @return the found token, or NULL when no token is found */ char *av_strtok(char *s, const char *delim, char **saveptr); /** * Locale-independent conversion of ASCII characters to uppercase. */ static inline int av_toupper(int c) { if (c >= 'a' && c <= 'z') c ^= 0x20; return c; } /** * Locale-independent conversion of ASCII characters to lowercase. */ static inline int av_tolower(int c) { if (c >= 'A' && c <= 'Z') c ^= 0x20; return c; } /** * Locale-independent case-insensitive compare. * @note This means only ASCII-range characters are case-insensitive */ int av_strcasecmp(const char *a, const char *b); /** * Locale-independent case-insensitive compare. * @note This means only ASCII-range characters are case-insensitive */ int av_strncasecmp(const char *a, const char *b, size_t n); /** * @} */ #endif /* AVUTIL_AVSTRING_H */
6,906
31.890476
88
h
cba-pipeline-public
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libavutil/timecode.h
/* * Copyright (c) 2006 Smartjog S.A.S, Baptiste Coudurier <[email protected]> * Copyright (c) 2011-2012 Smartjog S.A.S, Clément Bœsch <[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 */ /** * @file * Timecode helpers header */ #ifndef AVUTIL_TIMECODE_H #define AVUTIL_TIMECODE_H #include <stdint.h> #include "rational.h" #define AV_TIMECODE_STR_SIZE 16 enum AVTimecodeFlag { AV_TIMECODE_FLAG_DROPFRAME = 1<<0, ///< timecode is drop frame AV_TIMECODE_FLAG_24HOURSMAX = 1<<1, ///< timecode wraps after 24 hours AV_TIMECODE_FLAG_ALLOWNEGATIVE = 1<<2, ///< negative time values are allowed }; typedef struct { int start; ///< timecode frame start (first base frame number) uint32_t flags; ///< flags such as drop frame, +24 hours support, ... AVRational rate; ///< frame rate in rational form unsigned fps; ///< frame per second; must be consistent with the rate field } AVTimecode; /** * Adjust frame number for NTSC drop frame time code. * * @param framenum frame number to adjust * @return adjusted frame number * @warning adjustment is only valid in NTSC 29.97 * @deprecated use av_timecode_adjust_ntsc_framenum2 instead */ attribute_deprecated int av_timecode_adjust_ntsc_framenum(int framenum); /** * Adjust frame number for NTSC drop frame time code. * * @param framenum frame number to adjust * @param fps frame per second, 30 or 60 * @return adjusted frame number * @warning adjustment is only valid in NTSC 29.97 and 59.94 */ int av_timecode_adjust_ntsc_framenum2(int framenum, int fps); /** * Convert frame number to SMPTE 12M binary representation. * * @param tc timecode data correctly initialized * @param framenum frame number * @return the SMPTE binary representation * * @note Frame number adjustment is automatically done in case of drop timecode, * you do NOT have to call av_timecode_adjust_ntsc_framenum(). * @note The frame number is relative to tc->start. * @note Color frame (CF), binary group flags (BGF) and biphase mark polarity * correction (PC) bits are set to zero. */ uint32_t av_timecode_get_smpte_from_framenum(const AVTimecode *tc, int framenum); /** * Load timecode string in buf. * * @param buf destination buffer, must be at least AV_TIMECODE_STR_SIZE long * @param tc timecode data correctly initialized * @param framenum frame number * @return the buf parameter * * @note Timecode representation can be a negative timecode and have more than * 24 hours, but will only be honored if the flags are correctly set. * @note The frame number is relative to tc->start. */ char *av_timecode_make_string(const AVTimecode *tc, char *buf, int framenum); /** * Get the timecode string from the SMPTE timecode format. * * @param buf destination buffer, must be at least AV_TIMECODE_STR_SIZE long * @param tcsmpte the 32-bit SMPTE timecode * @param prevent_df prevent the use of a drop flag when it is known the DF bit * is arbitrary * @return the buf parameter */ char *av_timecode_make_smpte_tc_string(char *buf, uint32_t tcsmpte, int prevent_df); /** * Get the timecode string from the 25-bit timecode format (MPEG GOP format). * * @param buf destination buffer, must be at least AV_TIMECODE_STR_SIZE long * @param tc25bit the 25-bits timecode * @return the buf parameter */ char *av_timecode_make_mpeg_tc_string(char *buf, uint32_t tc25bit); /** * Init a timecode struct with the passed parameters. * * @param log_ctx a pointer to an arbitrary struct of which the first field * is a pointer to an AVClass struct (used for av_log) * @param tc pointer to an allocated AVTimecode * @param rate frame rate in rational form * @param flags miscellaneous flags such as drop frame, +24 hours, ... * (see AVTimecodeFlag) * @param frame_start the first frame number * @return 0 on success, AVERROR otherwise */ int av_timecode_init(AVTimecode *tc, AVRational rate, int flags, int frame_start, void *log_ctx); /** * Parse timecode representation (hh:mm:ss[:;.]ff). * * @param log_ctx a pointer to an arbitrary struct of which the first field is a * pointer to an AVClass struct (used for av_log). * @param tc pointer to an allocated AVTimecode * @param rate frame rate in rational form * @param str timecode string which will determine the frame start * @return 0 on success, AVERROR otherwise */ int av_timecode_init_from_string(AVTimecode *tc, AVRational rate, const char *str, void *log_ctx); /** * Check if the timecode feature is available for the given frame rate * * @return 0 if supported, <0 otherwise */ int av_timecode_check_frame_rate(AVRational rate); #endif /* AVUTIL_TIMECODE_H */
5,667
36.536424
98
h
cba-pipeline-public
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libavutil/time.h
/* * Copyright (c) 2000-2003 Fabrice Bellard * * 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_TIME_H #define AVUTIL_TIME_H #include <stdint.h> /** * Get the current time in microseconds. */ int64_t av_gettime(void); /** * Sleep for a period of time. Although the duration is expressed in * microseconds, the actual delay may be rounded to the precision of the * system timer. * * @param usec Number of microseconds to sleep. * @return zero on success or (negative) error code. */ int av_usleep(unsigned usec); #endif /* AVUTIL_TIME_H */
1,283
29.571429
79
h
cba-pipeline-public
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libavutil/intfloat.h
/* * Copyright (c) 2011 Mans Rullgard * * 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 AVUTIL_INTFLOAT_H #define AVUTIL_INTFLOAT_H #include <stdint.h> #include "attributes.h" union av_intfloat32 { uint32_t i; float f; }; union av_intfloat64 { uint64_t i; double f; }; /** * Reinterpret a 32-bit integer as a float. */ static av_always_inline float av_int2float(uint32_t i) { union av_intfloat32 v; v.i = i; return v.f; } /** * Reinterpret a float as a 32-bit integer. */ static av_always_inline uint32_t av_float2int(float f) { union av_intfloat32 v; v.f = f; return v.i; } /** * Reinterpret a 64-bit integer as a double. */ static av_always_inline double av_int2double(uint64_t i) { union av_intfloat64 v; v.i = i; return v.f; } /** * Reinterpret a double as a 64-bit integer. */ static av_always_inline uint64_t av_double2int(double f) { union av_intfloat64 v; v.f = f; return v.i; } #endif /* AVUTIL_INTFLOAT_H */
1,722
21.089744
79
h
cba-pipeline-public
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libavutil/intreadwrite.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_INTREADWRITE_H #define AVUTIL_INTREADWRITE_H #include <stdint.h> #include "libavutil/avconfig.h" #include "attributes.h" #include "bswap.h" typedef union { uint64_t u64; uint32_t u32[2]; uint16_t u16[4]; uint8_t u8 [8]; double f64; float f32[2]; } av_alias av_alias64; typedef union { uint32_t u32; uint16_t u16[2]; uint8_t u8 [4]; float f32; } av_alias av_alias32; typedef union { uint16_t u16; uint8_t u8 [2]; } av_alias av_alias16; /* * Arch-specific headers can provide any combination of * AV_[RW][BLN](16|24|32|64) and AV_(COPY|SWAP|ZERO)(64|128) macros. * Preprocessor symbols must be defined, even if these are implemented * as inline functions. */ #ifdef HAVE_AV_CONFIG_H #include "config.h" #if ARCH_ARM # include "arm/intreadwrite.h" #elif ARCH_AVR32 # include "avr32/intreadwrite.h" #elif ARCH_MIPS # include "mips/intreadwrite.h" #elif ARCH_PPC # include "ppc/intreadwrite.h" #elif ARCH_TOMI # include "tomi/intreadwrite.h" #elif ARCH_X86 # include "x86/intreadwrite.h" #endif #endif /* HAVE_AV_CONFIG_H */ /* * Map AV_RNXX <-> AV_R[BL]XX for all variants provided by per-arch headers. */ #if AV_HAVE_BIGENDIAN # if defined(AV_RN16) && !defined(AV_RB16) # define AV_RB16(p) AV_RN16(p) # elif !defined(AV_RN16) && defined(AV_RB16) # define AV_RN16(p) AV_RB16(p) # endif # if defined(AV_WN16) && !defined(AV_WB16) # define AV_WB16(p, v) AV_WN16(p, v) # elif !defined(AV_WN16) && defined(AV_WB16) # define AV_WN16(p, v) AV_WB16(p, v) # endif # if defined(AV_RN24) && !defined(AV_RB24) # define AV_RB24(p) AV_RN24(p) # elif !defined(AV_RN24) && defined(AV_RB24) # define AV_RN24(p) AV_RB24(p) # endif # if defined(AV_WN24) && !defined(AV_WB24) # define AV_WB24(p, v) AV_WN24(p, v) # elif !defined(AV_WN24) && defined(AV_WB24) # define AV_WN24(p, v) AV_WB24(p, v) # endif # if defined(AV_RN32) && !defined(AV_RB32) # define AV_RB32(p) AV_RN32(p) # elif !defined(AV_RN32) && defined(AV_RB32) # define AV_RN32(p) AV_RB32(p) # endif # if defined(AV_WN32) && !defined(AV_WB32) # define AV_WB32(p, v) AV_WN32(p, v) # elif !defined(AV_WN32) && defined(AV_WB32) # define AV_WN32(p, v) AV_WB32(p, v) # endif # if defined(AV_RN64) && !defined(AV_RB64) # define AV_RB64(p) AV_RN64(p) # elif !defined(AV_RN64) && defined(AV_RB64) # define AV_RN64(p) AV_RB64(p) # endif # if defined(AV_WN64) && !defined(AV_WB64) # define AV_WB64(p, v) AV_WN64(p, v) # elif !defined(AV_WN64) && defined(AV_WB64) # define AV_WN64(p, v) AV_WB64(p, v) # endif #else /* AV_HAVE_BIGENDIAN */ # if defined(AV_RN16) && !defined(AV_RL16) # define AV_RL16(p) AV_RN16(p) # elif !defined(AV_RN16) && defined(AV_RL16) # define AV_RN16(p) AV_RL16(p) # endif # if defined(AV_WN16) && !defined(AV_WL16) # define AV_WL16(p, v) AV_WN16(p, v) # elif !defined(AV_WN16) && defined(AV_WL16) # define AV_WN16(p, v) AV_WL16(p, v) # endif # if defined(AV_RN24) && !defined(AV_RL24) # define AV_RL24(p) AV_RN24(p) # elif !defined(AV_RN24) && defined(AV_RL24) # define AV_RN24(p) AV_RL24(p) # endif # if defined(AV_WN24) && !defined(AV_WL24) # define AV_WL24(p, v) AV_WN24(p, v) # elif !defined(AV_WN24) && defined(AV_WL24) # define AV_WN24(p, v) AV_WL24(p, v) # endif # if defined(AV_RN32) && !defined(AV_RL32) # define AV_RL32(p) AV_RN32(p) # elif !defined(AV_RN32) && defined(AV_RL32) # define AV_RN32(p) AV_RL32(p) # endif # if defined(AV_WN32) && !defined(AV_WL32) # define AV_WL32(p, v) AV_WN32(p, v) # elif !defined(AV_WN32) && defined(AV_WL32) # define AV_WN32(p, v) AV_WL32(p, v) # endif # if defined(AV_RN64) && !defined(AV_RL64) # define AV_RL64(p) AV_RN64(p) # elif !defined(AV_RN64) && defined(AV_RL64) # define AV_RN64(p) AV_RL64(p) # endif # if defined(AV_WN64) && !defined(AV_WL64) # define AV_WL64(p, v) AV_WN64(p, v) # elif !defined(AV_WN64) && defined(AV_WL64) # define AV_WN64(p, v) AV_WL64(p, v) # endif #endif /* !AV_HAVE_BIGENDIAN */ /* * Define AV_[RW]N helper macros to simplify definitions not provided * by per-arch headers. */ #if defined(__GNUC__) && !defined(__TI_COMPILER_VERSION__) union unaligned_64 { uint64_t l; } __attribute__((packed)) av_alias; union unaligned_32 { uint32_t l; } __attribute__((packed)) av_alias; union unaligned_16 { uint16_t l; } __attribute__((packed)) av_alias; # define AV_RN(s, p) (((const union unaligned_##s *) (p))->l) # define AV_WN(s, p, v) ((((union unaligned_##s *) (p))->l) = (v)) #elif defined(__DECC) # define AV_RN(s, p) (*((const __unaligned uint##s##_t*)(p))) # define AV_WN(s, p, v) (*((__unaligned uint##s##_t*)(p)) = (v)) #elif AV_HAVE_FAST_UNALIGNED # define AV_RN(s, p) (((const av_alias##s*)(p))->u##s) # define AV_WN(s, p, v) (((av_alias##s*)(p))->u##s = (v)) #else #ifndef AV_RB16 # define AV_RB16(x) \ ((((const uint8_t*)(x))[0] << 8) | \ ((const uint8_t*)(x))[1]) #endif #ifndef AV_WB16 # define AV_WB16(p, darg) do { \ unsigned d = (darg); \ ((uint8_t*)(p))[1] = (d); \ ((uint8_t*)(p))[0] = (d)>>8; \ } while(0) #endif #ifndef AV_RL16 # define AV_RL16(x) \ ((((const uint8_t*)(x))[1] << 8) | \ ((const uint8_t*)(x))[0]) #endif #ifndef AV_WL16 # define AV_WL16(p, darg) do { \ unsigned d = (darg); \ ((uint8_t*)(p))[0] = (d); \ ((uint8_t*)(p))[1] = (d)>>8; \ } while(0) #endif #ifndef AV_RB32 # define AV_RB32(x) \ (((uint32_t)((const uint8_t*)(x))[0] << 24) | \ (((const uint8_t*)(x))[1] << 16) | \ (((const uint8_t*)(x))[2] << 8) | \ ((const uint8_t*)(x))[3]) #endif #ifndef AV_WB32 # define AV_WB32(p, darg) do { \ unsigned d = (darg); \ ((uint8_t*)(p))[3] = (d); \ ((uint8_t*)(p))[2] = (d)>>8; \ ((uint8_t*)(p))[1] = (d)>>16; \ ((uint8_t*)(p))[0] = (d)>>24; \ } while(0) #endif #ifndef AV_RL32 # define AV_RL32(x) \ (((uint32_t)((const uint8_t*)(x))[3] << 24) | \ (((const uint8_t*)(x))[2] << 16) | \ (((const uint8_t*)(x))[1] << 8) | \ ((const uint8_t*)(x))[0]) #endif #ifndef AV_WL32 # define AV_WL32(p, darg) do { \ unsigned d = (darg); \ ((uint8_t*)(p))[0] = (d); \ ((uint8_t*)(p))[1] = (d)>>8; \ ((uint8_t*)(p))[2] = (d)>>16; \ ((uint8_t*)(p))[3] = (d)>>24; \ } while(0) #endif #ifndef AV_RB64 # define AV_RB64(x) \ (((uint64_t)((const uint8_t*)(x))[0] << 56) | \ ((uint64_t)((const uint8_t*)(x))[1] << 48) | \ ((uint64_t)((const uint8_t*)(x))[2] << 40) | \ ((uint64_t)((const uint8_t*)(x))[3] << 32) | \ ((uint64_t)((const uint8_t*)(x))[4] << 24) | \ ((uint64_t)((const uint8_t*)(x))[5] << 16) | \ ((uint64_t)((const uint8_t*)(x))[6] << 8) | \ (uint64_t)((const uint8_t*)(x))[7]) #endif #ifndef AV_WB64 # define AV_WB64(p, darg) do { \ uint64_t d = (darg); \ ((uint8_t*)(p))[7] = (d); \ ((uint8_t*)(p))[6] = (d)>>8; \ ((uint8_t*)(p))[5] = (d)>>16; \ ((uint8_t*)(p))[4] = (d)>>24; \ ((uint8_t*)(p))[3] = (d)>>32; \ ((uint8_t*)(p))[2] = (d)>>40; \ ((uint8_t*)(p))[1] = (d)>>48; \ ((uint8_t*)(p))[0] = (d)>>56; \ } while(0) #endif #ifndef AV_RL64 # define AV_RL64(x) \ (((uint64_t)((const uint8_t*)(x))[7] << 56) | \ ((uint64_t)((const uint8_t*)(x))[6] << 48) | \ ((uint64_t)((const uint8_t*)(x))[5] << 40) | \ ((uint64_t)((const uint8_t*)(x))[4] << 32) | \ ((uint64_t)((const uint8_t*)(x))[3] << 24) | \ ((uint64_t)((const uint8_t*)(x))[2] << 16) | \ ((uint64_t)((const uint8_t*)(x))[1] << 8) | \ (uint64_t)((const uint8_t*)(x))[0]) #endif #ifndef AV_WL64 # define AV_WL64(p, darg) do { \ uint64_t d = (darg); \ ((uint8_t*)(p))[0] = (d); \ ((uint8_t*)(p))[1] = (d)>>8; \ ((uint8_t*)(p))[2] = (d)>>16; \ ((uint8_t*)(p))[3] = (d)>>24; \ ((uint8_t*)(p))[4] = (d)>>32; \ ((uint8_t*)(p))[5] = (d)>>40; \ ((uint8_t*)(p))[6] = (d)>>48; \ ((uint8_t*)(p))[7] = (d)>>56; \ } while(0) #endif #if AV_HAVE_BIGENDIAN # define AV_RN(s, p) AV_RB##s(p) # define AV_WN(s, p, v) AV_WB##s(p, v) #else # define AV_RN(s, p) AV_RL##s(p) # define AV_WN(s, p, v) AV_WL##s(p, v) #endif #endif /* HAVE_FAST_UNALIGNED */ #ifndef AV_RN16 # define AV_RN16(p) AV_RN(16, p) #endif #ifndef AV_RN32 # define AV_RN32(p) AV_RN(32, p) #endif #ifndef AV_RN64 # define AV_RN64(p) AV_RN(64, p) #endif #ifndef AV_WN16 # define AV_WN16(p, v) AV_WN(16, p, v) #endif #ifndef AV_WN32 # define AV_WN32(p, v) AV_WN(32, p, v) #endif #ifndef AV_WN64 # define AV_WN64(p, v) AV_WN(64, p, v) #endif #if AV_HAVE_BIGENDIAN # define AV_RB(s, p) AV_RN##s(p) # define AV_WB(s, p, v) AV_WN##s(p, v) # define AV_RL(s, p) av_bswap##s(AV_RN##s(p)) # define AV_WL(s, p, v) AV_WN##s(p, av_bswap##s(v)) #else # define AV_RB(s, p) av_bswap##s(AV_RN##s(p)) # define AV_WB(s, p, v) AV_WN##s(p, av_bswap##s(v)) # define AV_RL(s, p) AV_RN##s(p) # define AV_WL(s, p, v) AV_WN##s(p, v) #endif #define AV_RB8(x) (((const uint8_t*)(x))[0]) #define AV_WB8(p, d) do { ((uint8_t*)(p))[0] = (d); } while(0) #define AV_RL8(x) AV_RB8(x) #define AV_WL8(p, d) AV_WB8(p, d) #ifndef AV_RB16 # define AV_RB16(p) AV_RB(16, p) #endif #ifndef AV_WB16 # define AV_WB16(p, v) AV_WB(16, p, v) #endif #ifndef AV_RL16 # define AV_RL16(p) AV_RL(16, p) #endif #ifndef AV_WL16 # define AV_WL16(p, v) AV_WL(16, p, v) #endif #ifndef AV_RB32 # define AV_RB32(p) AV_RB(32, p) #endif #ifndef AV_WB32 # define AV_WB32(p, v) AV_WB(32, p, v) #endif #ifndef AV_RL32 # define AV_RL32(p) AV_RL(32, p) #endif #ifndef AV_WL32 # define AV_WL32(p, v) AV_WL(32, p, v) #endif #ifndef AV_RB64 # define AV_RB64(p) AV_RB(64, p) #endif #ifndef AV_WB64 # define AV_WB64(p, v) AV_WB(64, p, v) #endif #ifndef AV_RL64 # define AV_RL64(p) AV_RL(64, p) #endif #ifndef AV_WL64 # define AV_WL64(p, v) AV_WL(64, p, v) #endif #ifndef AV_RB24 # define AV_RB24(x) \ ((((const uint8_t*)(x))[0] << 16) | \ (((const uint8_t*)(x))[1] << 8) | \ ((const uint8_t*)(x))[2]) #endif #ifndef AV_WB24 # define AV_WB24(p, d) do { \ ((uint8_t*)(p))[2] = (d); \ ((uint8_t*)(p))[1] = (d)>>8; \ ((uint8_t*)(p))[0] = (d)>>16; \ } while(0) #endif #ifndef AV_RL24 # define AV_RL24(x) \ ((((const uint8_t*)(x))[2] << 16) | \ (((const uint8_t*)(x))[1] << 8) | \ ((const uint8_t*)(x))[0]) #endif #ifndef AV_WL24 # define AV_WL24(p, d) do { \ ((uint8_t*)(p))[0] = (d); \ ((uint8_t*)(p))[1] = (d)>>8; \ ((uint8_t*)(p))[2] = (d)>>16; \ } while(0) #endif /* * The AV_[RW]NA macros access naturally aligned data * in a type-safe way. */ #define AV_RNA(s, p) (((const av_alias##s*)(p))->u##s) #define AV_WNA(s, p, v) (((av_alias##s*)(p))->u##s = (v)) #ifndef AV_RN16A # define AV_RN16A(p) AV_RNA(16, p) #endif #ifndef AV_RN32A # define AV_RN32A(p) AV_RNA(32, p) #endif #ifndef AV_RN64A # define AV_RN64A(p) AV_RNA(64, p) #endif #ifndef AV_WN16A # define AV_WN16A(p, v) AV_WNA(16, p, v) #endif #ifndef AV_WN32A # define AV_WN32A(p, v) AV_WNA(32, p, v) #endif #ifndef AV_WN64A # define AV_WN64A(p, v) AV_WNA(64, p, v) #endif /* Parameters for AV_COPY*, AV_SWAP*, AV_ZERO* must be * naturally aligned. They may be implemented using MMX, * so emms_c() must be called before using any float code * afterwards. */ #define AV_COPY(n, d, s) \ (((av_alias##n*)(d))->u##n = ((const av_alias##n*)(s))->u##n) #ifndef AV_COPY16 # define AV_COPY16(d, s) AV_COPY(16, d, s) #endif #ifndef AV_COPY32 # define AV_COPY32(d, s) AV_COPY(32, d, s) #endif #ifndef AV_COPY64 # define AV_COPY64(d, s) AV_COPY(64, d, s) #endif #ifndef AV_COPY128 # define AV_COPY128(d, s) \ do { \ AV_COPY64(d, s); \ AV_COPY64((char*)(d)+8, (char*)(s)+8); \ } while(0) #endif #define AV_SWAP(n, a, b) FFSWAP(av_alias##n, *(av_alias##n*)(a), *(av_alias##n*)(b)) #ifndef AV_SWAP64 # define AV_SWAP64(a, b) AV_SWAP(64, a, b) #endif #define AV_ZERO(n, d) (((av_alias##n*)(d))->u##n = 0) #ifndef AV_ZERO16 # define AV_ZERO16(d) AV_ZERO(16, d) #endif #ifndef AV_ZERO32 # define AV_ZERO32(d) AV_ZERO(32, d) #endif #ifndef AV_ZERO64 # define AV_ZERO64(d) AV_ZERO(64, d) #endif #ifndef AV_ZERO128 # define AV_ZERO128(d) \ do { \ AV_ZERO64(d); \ AV_ZERO64((char*)(d)+8); \ } while(0) #endif #endif /* AVUTIL_INTREADWRITE_H */
14,818
27.013233
84
h
cba-pipeline-public
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libavutil/parseutils.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_PARSEUTILS_H #define AVUTIL_PARSEUTILS_H #include <time.h> #include "rational.h" /** * @file * misc parsing utilities */ /** * Parse str and store the parsed ratio in q. * * Note that a ratio with infinite (1/0) or negative value is * considered valid, so you should check on the returned value if you * want to exclude those values. * * The undefined value can be expressed using the "0:0" string. * * @param[in,out] q pointer to the AVRational which will contain the ratio * @param[in] str the string to parse: it has to be a string in the format * num:den, a float number or an expression * @param[in] max the maximum allowed numerator and denominator * @param[in] log_offset log level offset which is applied to the log * level of log_ctx * @param[in] log_ctx parent logging context * @return >= 0 on success, a negative error code otherwise */ int av_parse_ratio(AVRational *q, const char *str, int max, int log_offset, void *log_ctx); #define av_parse_ratio_quiet(rate, str, max) \ av_parse_ratio(rate, str, max, AV_LOG_MAX_OFFSET, NULL) /** * Parse str and put in width_ptr and height_ptr the detected values. * * @param[in,out] width_ptr pointer to the variable which will contain the detected * width value * @param[in,out] height_ptr pointer to the variable which will contain the detected * height value * @param[in] str the string to parse: it has to be a string in the format * width x height or a valid video size abbreviation. * @return >= 0 on success, a negative error code otherwise */ int av_parse_video_size(int *width_ptr, int *height_ptr, const char *str); /** * Parse str and store the detected values in *rate. * * @param[in,out] rate pointer to the AVRational which will contain the detected * frame rate * @param[in] str the string to parse: it has to be a string in the format * rate_num / rate_den, a float number or a valid video rate abbreviation * @return >= 0 on success, a negative error code otherwise */ int av_parse_video_rate(AVRational *rate, const char *str); /** * Put the RGBA values that correspond to color_string in rgba_color. * * @param color_string a string specifying a color. It can be the name of * a color (case insensitive match) or a [0x|#]RRGGBB[AA] sequence, * possibly followed by "@" and a string representing the alpha * component. * The alpha component may be a string composed by "0x" followed by an * hexadecimal number or a decimal number between 0.0 and 1.0, which * represents the opacity value (0x00/0.0 means completely transparent, * 0xff/1.0 completely opaque). * If the alpha component is not specified then 0xff is assumed. * The string "random" will result in a random color. * @param slen length of the initial part of color_string containing the * color. It can be set to -1 if color_string is a null terminated string * containing nothing else than the color. * @return >= 0 in case of success, a negative value in case of * failure (for example if color_string cannot be parsed). */ int av_parse_color(uint8_t *rgba_color, const char *color_string, int slen, void *log_ctx); /** * Parse timestr and return in *time a corresponding number of * microseconds. * * @param timeval puts here the number of microseconds corresponding * to the string in timestr. If the string represents a duration, it * is the number of microseconds contained in the time interval. If * the string is a date, is the number of microseconds since 1st of * January, 1970 up to the time of the parsed date. If timestr cannot * be successfully parsed, set *time to INT64_MIN. * @param timestr a string representing a date or a duration. * - If a date the syntax is: * @code * [{YYYY-MM-DD|YYYYMMDD}[T|t| ]]{{HH:MM:SS[.m...]]]}|{HHMMSS[.m...]]]}}[Z] * now * @endcode * If the value is "now" it takes the current time. * Time is local time unless Z is appended, in which case it is * interpreted as UTC. * If the year-month-day part is not specified it takes the current * year-month-day. * - If a duration the syntax is: * @code * [-]HH:MM:SS[.m...]]] * [-]S+[.m...] * @endcode * @param duration flag which tells how to interpret timestr, if not * zero timestr is interpreted as a duration, otherwise as a date * @return 0 in case of success, a negative value corresponding to an * AVERROR code otherwise */ int av_parse_time(int64_t *timeval, const char *timestr, int duration); /** * Parse the input string p according to the format string fmt and * store its results in the structure dt. * This implementation supports only a subset of the formats supported * by the standard strptime(). * * In particular it actually supports the parameters: * - %H: the hour as a decimal number, using a 24-hour clock, in the * range '00' through '23' * - %M: the minute as a decimal number, using a 24-hour clock, in the * range '00' through '59' * - %S: the second as a decimal number, using a 24-hour clock, in the * range '00' through '59' * - %Y: the year as a decimal number, using the Gregorian calendar * - %m: the month as a decimal number, in the range '1' through '12' * - %d: the day of the month as a decimal number, in the range '1' * through '31' * - %%: a literal '%' * * @return a pointer to the first character not processed in this * function call, or NULL in case the function fails to match all of * the fmt string and therefore an error occurred */ char *av_small_strptime(const char *p, const char *fmt, struct tm *dt); /** * Attempt to find a specific tag in a URL. * * syntax: '?tag1=val1&tag2=val2...'. Little URL decoding is done. * Return 1 if found. */ int av_find_info_tag(char *arg, int arg_size, const char *tag1, const char *info); /** * Convert the decomposed UTC time in tm to a time_t value. */ time_t av_timegm(struct tm *tm); #endif /* AVUTIL_PARSEUTILS_H */
6,683
37.413793
84
h
cba-pipeline-public
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libavutil/crc.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_CRC_H #define AVUTIL_CRC_H #include <stdint.h> #include <stddef.h> #include "attributes.h" typedef uint32_t AVCRC; typedef enum { AV_CRC_8_ATM, AV_CRC_16_ANSI, AV_CRC_16_CCITT, AV_CRC_32_IEEE, AV_CRC_32_IEEE_LE, /*< reversed bitorder version of AV_CRC_32_IEEE */ AV_CRC_MAX, /*< Not part of public API! Do not use outside libavutil. */ }AVCRCId; int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size); const AVCRC *av_crc_get_table(AVCRCId crc_id); uint32_t av_crc(const AVCRC *ctx, uint32_t start_crc, const uint8_t *buffer, size_t length) av_pure; #endif /* AVUTIL_CRC_H */
1,477
32.590909
100
h
cba-pipeline-public
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libavutil/common.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 */ /** * @file * common internal and external API header */ #ifndef AVUTIL_COMMON_H #define AVUTIL_COMMON_H #include <ctype.h> #include <errno.h> #include <inttypes.h> #include <limits.h> #include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include "attributes.h" #include "libavutil/avconfig.h" #if AV_HAVE_BIGENDIAN # define AV_NE(be, le) (be) #else # define AV_NE(be, le) (le) #endif //rounded division & shift #define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b)) /* assume b>0 */ #define ROUNDED_DIV(a,b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b)) #define FFUDIV(a,b) (((a)>0 ?(a):(a)-(b)+1) / (b)) #define FFUMOD(a,b) ((a)-(b)*FFUDIV(a,b)) #define FFABS(a) ((a) >= 0 ? (a) : (-(a))) #define FFSIGN(a) ((a) > 0 ? 1 : -1) #define FFMAX(a,b) ((a) > (b) ? (a) : (b)) #define FFMAX3(a,b,c) FFMAX(FFMAX(a,b),c) #define FFMIN(a,b) ((a) > (b) ? (b) : (a)) #define FFMIN3(a,b,c) FFMIN(FFMIN(a,b),c) #define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0) #define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0])) #define FFALIGN(x, a) (((x)+(a)-1)&~((a)-1)) /* misc math functions */ extern const uint8_t ff_log2_tab[256]; /** * Reverse the order of the bits of an 8-bits unsigned integer. */ extern const uint8_t av_reverse[256]; static av_always_inline av_const int av_log2_c(unsigned int v) { int n = 0; if (v & 0xffff0000) { v >>= 16; n += 16; } if (v & 0xff00) { v >>= 8; n += 8; } n += ff_log2_tab[v]; return n; } static av_always_inline av_const int av_log2_16bit_c(unsigned int v) { int n = 0; if (v & 0xff00) { v >>= 8; n += 8; } n += ff_log2_tab[v]; return n; } #ifdef HAVE_AV_CONFIG_H # include "config.h" # include "intmath.h" #endif /* Pull in unguarded fallback defines at the end of this file. */ #include "common.h" /** * Clip a signed integer value into the amin-amax range. * @param a value to clip * @param amin minimum value of the clip range * @param amax maximum value of the clip range * @return clipped value */ static av_always_inline av_const int av_clip_c(int a, int amin, int amax) { if (a < amin) return amin; else if (a > amax) return amax; else return a; } /** * Clip a signed integer value into the 0-255 range. * @param a value to clip * @return clipped value */ static av_always_inline av_const uint8_t av_clip_uint8_c(int a) { if (a&(~0xFF)) return (-a)>>31; else return a; } /** * Clip a signed integer value into the -128,127 range. * @param a value to clip * @return clipped value */ static av_always_inline av_const int8_t av_clip_int8_c(int a) { if ((a+0x80) & ~0xFF) return (a>>31) ^ 0x7F; else return a; } /** * Clip a signed integer value into the 0-65535 range. * @param a value to clip * @return clipped value */ static av_always_inline av_const uint16_t av_clip_uint16_c(int a) { if (a&(~0xFFFF)) return (-a)>>31; else return a; } /** * Clip a signed integer value into the -32768,32767 range. * @param a value to clip * @return clipped value */ static av_always_inline av_const int16_t av_clip_int16_c(int a) { if ((a+0x8000) & ~0xFFFF) return (a>>31) ^ 0x7FFF; else return a; } /** * Clip a signed 64-bit integer value into the -2147483648,2147483647 range. * @param a value to clip * @return clipped value */ static av_always_inline av_const int32_t av_clipl_int32_c(int64_t a) { if ((a+0x80000000u) & ~UINT64_C(0xFFFFFFFF)) return (a>>63) ^ 0x7FFFFFFF; else return (int32_t)a; } /** * Clip a signed integer to an unsigned power of two range. * @param a value to clip * @param p bit position to clip at * @return clipped value */ static av_always_inline av_const unsigned av_clip_uintp2_c(int a, int p) { if (a & ~((1<<p) - 1)) return -a >> 31 & ((1<<p) - 1); else return a; } /** * Add two signed 32-bit values with saturation. * * @param a one value * @param b another value * @return sum with signed saturation */ static av_always_inline int av_sat_add32_c(int a, int b) { return av_clipl_int32((int64_t)a + b); } /** * Add a doubled value to another value with saturation at both stages. * * @param a first value * @param b value doubled and added to a * @return sum with signed saturation */ static av_always_inline int av_sat_dadd32_c(int a, int b) { return av_sat_add32(a, av_sat_add32(b, b)); } /** * Clip a float value into the amin-amax range. * @param a value to clip * @param amin minimum value of the clip range * @param amax maximum value of the clip range * @return clipped value */ static av_always_inline av_const float av_clipf_c(float a, float amin, float amax) { if (a < amin) return amin; else if (a > amax) return amax; else return a; } /** Compute ceil(log2(x)). * @param x value used to compute ceil(log2(x)) * @return computed ceiling of log2(x) */ static av_always_inline av_const int av_ceil_log2_c(int x) { return av_log2((x - 1) << 1); } /** * Count number of bits set to one in x * @param x value to count bits of * @return the number of bits set to one in x */ static av_always_inline av_const int av_popcount_c(uint32_t x) { x -= (x >> 1) & 0x55555555; x = (x & 0x33333333) + ((x >> 2) & 0x33333333); x = (x + (x >> 4)) & 0x0F0F0F0F; x += x >> 8; return (x + (x >> 16)) & 0x3F; } /** * Count number of bits set to one in x * @param x value to count bits of * @return the number of bits set to one in x */ static av_always_inline av_const int av_popcount64_c(uint64_t x) { return av_popcount((uint32_t)x) + av_popcount(x >> 32); } #define MKTAG(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((unsigned)(d) << 24)) #define MKBETAG(a,b,c,d) ((d) | ((c) << 8) | ((b) << 16) | ((unsigned)(a) << 24)) /** * Convert a UTF-8 character (up to 4 bytes) to its 32-bit UCS-4 encoded form. * * @param val Output value, must be an lvalue of type uint32_t. * @param GET_BYTE Expression reading one byte from the input. * Evaluated up to 7 times (4 for the currently * assigned Unicode range). With a memory buffer * input, this could be *ptr++. * @param ERROR Expression to be evaluated on invalid input, * typically a goto statement. */ #define GET_UTF8(val, GET_BYTE, ERROR)\ val= GET_BYTE;\ {\ int ones= 7 - av_log2(val ^ 255);\ if(ones==1)\ ERROR\ val&= 127>>ones;\ while(--ones > 0){\ int tmp= GET_BYTE - 128;\ if(tmp>>6)\ ERROR\ val= (val<<6) + tmp;\ }\ } /** * Convert a UTF-16 character (2 or 4 bytes) to its 32-bit UCS-4 encoded form. * * @param val Output value, must be an lvalue of type uint32_t. * @param GET_16BIT Expression returning two bytes of UTF-16 data converted * to native byte order. Evaluated one or two times. * @param ERROR Expression to be evaluated on invalid input, * typically a goto statement. */ #define GET_UTF16(val, GET_16BIT, ERROR)\ val = GET_16BIT;\ {\ unsigned int hi = val - 0xD800;\ if (hi < 0x800) {\ val = GET_16BIT - 0xDC00;\ if (val > 0x3FFU || hi > 0x3FFU)\ ERROR\ val += (hi<<10) + 0x10000;\ }\ }\ /** * @def PUT_UTF8(val, tmp, PUT_BYTE) * Convert a 32-bit Unicode character to its UTF-8 encoded form (up to 4 bytes long). * @param val is an input-only argument and should be of type uint32_t. It holds * a UCS-4 encoded Unicode character that is to be converted to UTF-8. If * val is given as a function it is executed only once. * @param tmp is a temporary variable and should be of type uint8_t. It * represents an intermediate value during conversion that is to be * output by PUT_BYTE. * @param PUT_BYTE writes the converted UTF-8 bytes to any proper destination. * It could be a function or a statement, and uses tmp as the input byte. * For example, PUT_BYTE could be "*output++ = tmp;" PUT_BYTE will be * executed up to 4 times for values in the valid UTF-8 range and up to * 7 times in the general case, depending on the length of the converted * Unicode character. */ #define PUT_UTF8(val, tmp, PUT_BYTE)\ {\ int bytes, shift;\ uint32_t in = val;\ if (in < 0x80) {\ tmp = in;\ PUT_BYTE\ } else {\ bytes = (av_log2(in) + 4) / 5;\ shift = (bytes - 1) * 6;\ tmp = (256 - (256 >> bytes)) | (in >> shift);\ PUT_BYTE\ while (shift >= 6) {\ shift -= 6;\ tmp = 0x80 | ((in >> shift) & 0x3f);\ PUT_BYTE\ }\ }\ } /** * @def PUT_UTF16(val, tmp, PUT_16BIT) * Convert a 32-bit Unicode character to its UTF-16 encoded form (2 or 4 bytes). * @param val is an input-only argument and should be of type uint32_t. It holds * a UCS-4 encoded Unicode character that is to be converted to UTF-16. If * val is given as a function it is executed only once. * @param tmp is a temporary variable and should be of type uint16_t. It * represents an intermediate value during conversion that is to be * output by PUT_16BIT. * @param PUT_16BIT writes the converted UTF-16 data to any proper destination * in desired endianness. It could be a function or a statement, and uses tmp * as the input byte. For example, PUT_BYTE could be "*output++ = tmp;" * PUT_BYTE will be executed 1 or 2 times depending on input character. */ #define PUT_UTF16(val, tmp, PUT_16BIT)\ {\ uint32_t in = val;\ if (in < 0x10000) {\ tmp = in;\ PUT_16BIT\ } else {\ tmp = 0xD800 | ((in - 0x10000) >> 10);\ PUT_16BIT\ tmp = 0xDC00 | ((in - 0x10000) & 0x3FF);\ PUT_16BIT\ }\ }\ #include "mem.h" #ifdef HAVE_AV_CONFIG_H # include "internal.h" #endif /* HAVE_AV_CONFIG_H */ #endif /* AVUTIL_COMMON_H */ /* * The following definitions are outside the multiple inclusion guard * to ensure they are immediately available in intmath.h. */ #ifndef av_log2 # define av_log2 av_log2_c #endif #ifndef av_log2_16bit # define av_log2_16bit av_log2_16bit_c #endif #ifndef av_ceil_log2 # define av_ceil_log2 av_ceil_log2_c #endif #ifndef av_clip # define av_clip av_clip_c #endif #ifndef av_clip_uint8 # define av_clip_uint8 av_clip_uint8_c #endif #ifndef av_clip_int8 # define av_clip_int8 av_clip_int8_c #endif #ifndef av_clip_uint16 # define av_clip_uint16 av_clip_uint16_c #endif #ifndef av_clip_int16 # define av_clip_int16 av_clip_int16_c #endif #ifndef av_clipl_int32 # define av_clipl_int32 av_clipl_int32_c #endif #ifndef av_clip_uintp2 # define av_clip_uintp2 av_clip_uintp2_c #endif #ifndef av_sat_add32 # define av_sat_add32 av_sat_add32_c #endif #ifndef av_sat_dadd32 # define av_sat_dadd32 av_sat_dadd32_c #endif #ifndef av_clipf # define av_clipf av_clipf_c #endif #ifndef av_popcount # define av_popcount av_popcount_c #endif #ifndef av_popcount64 # define av_popcount64 av_popcount64_c #endif
12,310
27.366359
89
h
cba-pipeline-public
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libavutil/dict.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 */ /** * @file * Public dictionary API. * @deprecated * AVDictionary is provided for compatibility with libav. It is both in * implementation as well as API inefficient. It does not scale and is * extremely slow with large dictionaries. * It is recommended that new code uses our tree container from tree.c/h * where applicable, which uses AVL trees to achieve O(log n) performance. */ #ifndef AVUTIL_DICT_H #define AVUTIL_DICT_H /** * @addtogroup lavu_dict AVDictionary * @ingroup lavu_data * * @brief Simple key:value store * * @{ * Dictionaries are used for storing key:value pairs. To create * an AVDictionary, simply pass an address of a NULL pointer to * av_dict_set(). NULL can be used as an empty dictionary wherever * a pointer to an AVDictionary is required. * Use av_dict_get() to retrieve an entry or iterate over all * entries and finally av_dict_free() to free the dictionary * and all its contents. * * @code * AVDictionary *d = NULL; // "create" an empty dictionary * av_dict_set(&d, "foo", "bar", 0); // add an entry * * char *k = av_strdup("key"); // if your strings are already allocated, * char *v = av_strdup("value"); // you can avoid copying them like this * av_dict_set(&d, k, v, AV_DICT_DONT_STRDUP_KEY | AV_DICT_DONT_STRDUP_VAL); * * AVDictionaryEntry *t = NULL; * while (t = av_dict_get(d, "", t, AV_DICT_IGNORE_SUFFIX)) { * <....> // iterate over all entries in d * } * * av_dict_free(&d); * @endcode * */ #define AV_DICT_MATCH_CASE 1 #define AV_DICT_IGNORE_SUFFIX 2 #define AV_DICT_DONT_STRDUP_KEY 4 /**< Take ownership of a key that's been allocated with av_malloc() and children. */ #define AV_DICT_DONT_STRDUP_VAL 8 /**< Take ownership of a value that's been allocated with av_malloc() and chilren. */ #define AV_DICT_DONT_OVERWRITE 16 ///< Don't overwrite existing entries. #define AV_DICT_APPEND 32 /**< If the entry already exists, append to it. Note that no delimiter is added, the strings are simply concatenated. */ typedef struct { char *key; char *value; } AVDictionaryEntry; typedef struct AVDictionary AVDictionary; /** * Get a dictionary entry with matching key. * * @param prev Set to the previous matching element to find the next. * If set to NULL the first matching element is returned. * @param flags Allows case as well as suffix-insensitive comparisons. * @return Found entry or NULL, changing key or value leads to undefined behavior. */ AVDictionaryEntry * av_dict_get(AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags); /** * Get number of entries in dictionary. * * @param m dictionary * @return number of entries in dictionary */ int av_dict_count(const AVDictionary *m); /** * Set the given entry in *pm, overwriting an existing entry. * * @param pm pointer to a pointer to a dictionary struct. If *pm is NULL * a dictionary struct is allocated and put in *pm. * @param key entry key to add to *pm (will be av_strduped depending on flags) * @param value entry value to add to *pm (will be av_strduped depending on flags). * Passing a NULL value will cause an existing entry to be deleted. * @return >= 0 on success otherwise an error code <0 */ int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags); /** * Copy entries from one AVDictionary struct into another. * @param dst pointer to a pointer to a AVDictionary struct. If *dst is NULL, * this function will allocate a struct for you and put it in *dst * @param src pointer to source AVDictionary struct * @param flags flags to use when setting entries in *dst * @note metadata is read using the AV_DICT_IGNORE_SUFFIX flag */ void av_dict_copy(AVDictionary **dst, AVDictionary *src, int flags); /** * Free all the memory allocated for an AVDictionary struct * and all keys and values. */ void av_dict_free(AVDictionary **m); /** * @} */ #endif /* AVUTIL_DICT_H */
4,934
35.286765
97
h
cba-pipeline-public
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libavutil/rational.h
/* * rational numbers * Copyright (c) 2003 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 */ /** * @file * rational numbers * @author Michael Niedermayer <[email protected]> */ #ifndef AVUTIL_RATIONAL_H #define AVUTIL_RATIONAL_H #include <stdint.h> #include <limits.h> #include "attributes.h" /** * @addtogroup lavu_math * @{ */ /** * rational number numerator/denominator */ typedef struct AVRational{ int num; ///< numerator int den; ///< denominator } AVRational; /** * Compare two rationals. * @param a first rational * @param b second rational * @return 0 if a==b, 1 if a>b, -1 if a<b, and INT_MIN if one of the * values is of the form 0/0 */ static inline int av_cmp_q(AVRational a, AVRational b){ const int64_t tmp= a.num * (int64_t)b.den - b.num * (int64_t)a.den; if(tmp) return ((tmp ^ a.den ^ b.den)>>63)|1; else if(b.den && a.den) return 0; else if(a.num && b.num) return (a.num>>31) - (b.num>>31); else return INT_MIN; } /** * Convert rational to double. * @param a rational to convert * @return (double) a */ static inline double av_q2d(AVRational a){ return a.num / (double) a.den; } /** * Reduce a fraction. * This is useful for framerate calculations. * @param dst_num destination numerator * @param dst_den destination denominator * @param num source numerator * @param den source denominator * @param max the maximum allowed for dst_num & dst_den * @return 1 if exact, 0 otherwise */ int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max); /** * Multiply two rationals. * @param b first rational * @param c second rational * @return b*c */ AVRational av_mul_q(AVRational b, AVRational c) av_const; /** * Divide one rational by another. * @param b first rational * @param c second rational * @return b/c */ AVRational av_div_q(AVRational b, AVRational c) av_const; /** * Add two rationals. * @param b first rational * @param c second rational * @return b+c */ AVRational av_add_q(AVRational b, AVRational c) av_const; /** * Subtract one rational from another. * @param b first rational * @param c second rational * @return b-c */ AVRational av_sub_q(AVRational b, AVRational c) av_const; /** * Invert a rational. * @param q value * @return 1 / q */ static av_always_inline AVRational av_inv_q(AVRational q) { AVRational r = { q.den, q.num }; return r; } /** * Convert a double precision floating point number to a rational. * inf is expressed as {1,0} or {-1,0} depending on the sign. * * @param d double to convert * @param max the maximum allowed numerator and denominator * @return (AVRational) d */ AVRational av_d2q(double d, int max) av_const; /** * @return 1 if q1 is nearer to q than q2, -1 if q2 is nearer * than q1, 0 if they have the same distance. */ int av_nearer_q(AVRational q, AVRational q1, AVRational q2); /** * Find the nearest value in q_list to q. * @param q_list an array of rationals terminated by {0, 0} * @return the index of the nearest value found in the array */ int av_find_nearest_q_idx(AVRational q, const AVRational* q_list); /** * @} */ #endif /* AVUTIL_RATIONAL_H */
3,943
24.282051
81
h
cba-pipeline-public
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libavutil/fifo.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 */ /** * @file * a very simple circular buffer FIFO implementation */ #ifndef AVUTIL_FIFO_H #define AVUTIL_FIFO_H #include <stdint.h> #include "avutil.h" #include "attributes.h" typedef struct AVFifoBuffer { uint8_t *buffer; uint8_t *rptr, *wptr, *end; uint32_t rndx, wndx; } AVFifoBuffer; /** * Initialize an AVFifoBuffer. * @param size of FIFO * @return AVFifoBuffer or NULL in case of memory allocation failure */ AVFifoBuffer *av_fifo_alloc(unsigned int size); /** * Free an AVFifoBuffer. * @param f AVFifoBuffer to free */ void av_fifo_free(AVFifoBuffer *f); /** * Reset the AVFifoBuffer to the state right after av_fifo_alloc, in particular it is emptied. * @param f AVFifoBuffer to reset */ void av_fifo_reset(AVFifoBuffer *f); /** * Return the amount of data in bytes in the AVFifoBuffer, that is the * amount of data you can read from it. * @param f AVFifoBuffer to read from * @return size */ int av_fifo_size(AVFifoBuffer *f); /** * Return the amount of space in bytes in the AVFifoBuffer, that is the * amount of data you can write into it. * @param f AVFifoBuffer to write into * @return size */ int av_fifo_space(AVFifoBuffer *f); /** * Feed data from an AVFifoBuffer to a user-supplied callback. * @param f AVFifoBuffer to read from * @param buf_size number of bytes to read * @param func generic read function * @param dest data destination */ int av_fifo_generic_read(AVFifoBuffer *f, void *dest, int buf_size, void (*func)(void*, void*, int)); /** * Feed data from a user-supplied callback to an AVFifoBuffer. * @param f AVFifoBuffer to write to * @param src data source; non-const since it may be used as a * modifiable context by the function defined in func * @param size number of bytes to write * @param func generic write function; the first parameter is src, * the second is dest_buf, the third is dest_buf_size. * func must return the number of bytes written to dest_buf, or <= 0 to * indicate no more data available to write. * If func is NULL, src is interpreted as a simple byte array for source data. * @return the number of bytes written to the FIFO */ int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int (*func)(void*, void*, int)); /** * Resize an AVFifoBuffer. * In case of reallocation failure, the old FIFO is kept unchanged. * * @param f AVFifoBuffer to resize * @param size new AVFifoBuffer size in bytes * @return <0 for failure, >=0 otherwise */ int av_fifo_realloc2(AVFifoBuffer *f, unsigned int size); /** * Enlarge an AVFifoBuffer. * In case of reallocation failure, the old FIFO is kept unchanged. * The new fifo size may be larger than the requested size. * * @param f AVFifoBuffer to resize * @param additional_space the amount of space in bytes to allocate in addition to av_fifo_size() * @return <0 for failure, >=0 otherwise */ int av_fifo_grow(AVFifoBuffer *f, unsigned int additional_space); /** * Read and discard the specified amount of data from an AVFifoBuffer. * @param f AVFifoBuffer to read from * @param size amount of data to read in bytes */ void av_fifo_drain(AVFifoBuffer *f, int size); /** * Return a pointer to the data stored in a FIFO buffer at a certain offset. * The FIFO buffer is not modified. * * @param f AVFifoBuffer to peek at, f must be non-NULL * @param offs an offset in bytes, its absolute value must be less * than the used buffer size or the returned pointer will * point outside to the buffer data. * The used buffer size can be checked with av_fifo_size(). */ static inline uint8_t *av_fifo_peek2(const AVFifoBuffer *f, int offs) { uint8_t *ptr = f->rptr + offs; if (ptr >= f->end) ptr = f->buffer + (ptr - f->end); else if (ptr < f->buffer) ptr = f->end - (f->buffer - ptr); return ptr; } #if FF_API_AV_FIFO_PEEK /** * @deprecated Use av_fifo_peek2() instead. */ attribute_deprecated static inline uint8_t av_fifo_peek(AVFifoBuffer *f, int offs) { return *av_fifo_peek2(f, offs); } #endif #endif /* AVUTIL_FIFO_H */
4,851
30.102564
101
h
cba-pipeline-public
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libavutil/mathematics.h
/* * copyright (c) 2005 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_MATHEMATICS_H #define AVUTIL_MATHEMATICS_H #include <stdint.h> #include <math.h> #include "attributes.h" #include "rational.h" #include "intfloat.h" #ifndef M_E #define M_E 2.7182818284590452354 /* e */ #endif #ifndef M_LN2 #define M_LN2 0.69314718055994530942 /* log_e 2 */ #endif #ifndef M_LN10 #define M_LN10 2.30258509299404568402 /* log_e 10 */ #endif #ifndef M_LOG2_10 #define M_LOG2_10 3.32192809488736234787 /* log_2 10 */ #endif #ifndef M_PHI #define M_PHI 1.61803398874989484820 /* phi / golden ratio */ #endif #ifndef M_PI #define M_PI 3.14159265358979323846 /* pi */ #endif #ifndef M_SQRT1_2 #define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ #endif #ifndef M_SQRT2 #define M_SQRT2 1.41421356237309504880 /* sqrt(2) */ #endif #ifndef NAN #define NAN av_int2float(0x7fc00000) #endif #ifndef INFINITY #define INFINITY av_int2float(0x7f800000) #endif /** * @addtogroup lavu_math * @{ */ enum AVRounding { AV_ROUND_ZERO = 0, ///< Round toward zero. AV_ROUND_INF = 1, ///< Round away from zero. AV_ROUND_DOWN = 2, ///< Round toward -infinity. AV_ROUND_UP = 3, ///< Round toward +infinity. AV_ROUND_NEAR_INF = 5, ///< Round to nearest and halfway cases away from zero. }; /** * Return the greatest common divisor of a and b. * If both a and b are 0 or either or both are <0 then behavior is * undefined. */ int64_t av_const av_gcd(int64_t a, int64_t b); /** * Rescale a 64-bit integer with rounding to nearest. * A simple a*b/c isn't possible as it can overflow. */ int64_t av_rescale(int64_t a, int64_t b, int64_t c) av_const; /** * Rescale a 64-bit integer with specified rounding. * A simple a*b/c isn't possible as it can overflow. */ int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding) av_const; /** * Rescale a 64-bit integer by 2 rational numbers. */ int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) av_const; /** * Rescale a 64-bit integer by 2 rational numbers with specified rounding. */ int64_t av_rescale_q_rnd(int64_t a, AVRational bq, AVRational cq, enum AVRounding) av_const; /** * Compare 2 timestamps each in its own timebases. * The result of the function is undefined if one of the timestamps * is outside the int64_t range when represented in the others timebase. * @return -1 if ts_a is before ts_b, 1 if ts_a is after ts_b or 0 if they represent the same position */ int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b); /** * Compare 2 integers modulo mod. * That is we compare integers a and b for which only the least * significant log2(mod) bits are known. * * @param mod must be a power of 2 * @return a negative value if a is smaller than b * a positive value if a is greater than b * 0 if a equals b */ int64_t av_compare_mod(uint64_t a, uint64_t b, uint64_t mod); /** * @} */ #endif /* AVUTIL_MATHEMATICS_H */
3,898
28.992308
102
h
cba-pipeline-public
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libavutil/error.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 */ /** * @file * error code definitions */ #ifndef AVUTIL_ERROR_H #define AVUTIL_ERROR_H #include <errno.h> #include <stddef.h> /** * @addtogroup lavu_error * * @{ */ /* error handling */ #if EDOM > 0 #define AVERROR(e) (-(e)) ///< Returns a negative error code from a POSIX error code, to return from library functions. #define AVUNERROR(e) (-(e)) ///< Returns a POSIX error code from a library function error return value. #else /* Some platforms have E* and errno already negated. */ #define AVERROR(e) (e) #define AVUNERROR(e) (e) #endif #define FFERRTAG(a, b, c, d) (-(int)MKTAG(a, b, c, d)) #define AVERROR_BSF_NOT_FOUND FFERRTAG(0xF8,'B','S','F') ///< Bitstream filter not found #define AVERROR_BUG FFERRTAG( 'B','U','G','!') ///< Internal bug, also see AVERROR_BUG2 #define AVERROR_BUFFER_TOO_SMALL FFERRTAG( 'B','U','F','S') ///< Buffer too small #define AVERROR_DECODER_NOT_FOUND FFERRTAG(0xF8,'D','E','C') ///< Decoder not found #define AVERROR_DEMUXER_NOT_FOUND FFERRTAG(0xF8,'D','E','M') ///< Demuxer not found #define AVERROR_ENCODER_NOT_FOUND FFERRTAG(0xF8,'E','N','C') ///< Encoder not found #define AVERROR_EOF FFERRTAG( 'E','O','F',' ') ///< End of file #define AVERROR_EXIT FFERRTAG( 'E','X','I','T') ///< Immediate exit was requested; the called function should not be restarted #define AVERROR_EXTERNAL FFERRTAG( 'E','X','T',' ') ///< Generic error in an external library #define AVERROR_FILTER_NOT_FOUND FFERRTAG(0xF8,'F','I','L') ///< Filter not found #define AVERROR_INVALIDDATA FFERRTAG( 'I','N','D','A') ///< Invalid data found when processing input #define AVERROR_MUXER_NOT_FOUND FFERRTAG(0xF8,'M','U','X') ///< Muxer not found #define AVERROR_OPTION_NOT_FOUND FFERRTAG(0xF8,'O','P','T') ///< Option not found #define AVERROR_PATCHWELCOME FFERRTAG( 'P','A','W','E') ///< Not yet implemented in FFmpeg, patches welcome #define AVERROR_PROTOCOL_NOT_FOUND FFERRTAG(0xF8,'P','R','O') ///< Protocol not found #define AVERROR_STREAM_NOT_FOUND FFERRTAG(0xF8,'S','T','R') ///< Stream not found /** * This is semantically identical to AVERROR_BUG * it has been introduced in Libav after our AVERROR_BUG and with a modified value. */ #define AVERROR_BUG2 FFERRTAG( 'B','U','G',' ') #define AVERROR_UNKNOWN FFERRTAG( 'U','N','K','N') ///< Unknown error, typically from an external library #define AV_ERROR_MAX_STRING_SIZE 64 /** * Put a description of the AVERROR code errnum in errbuf. * In case of failure the global variable errno is set to indicate the * error. Even in case of failure av_strerror() will print a generic * error message indicating the errnum provided to errbuf. * * @param errnum error code to describe * @param errbuf buffer to which description is written * @param errbuf_size the size in bytes of errbuf * @return 0 on success, a negative value if a description for errnum * cannot be found */ int av_strerror(int errnum, char *errbuf, size_t errbuf_size); /** * Fill the provided buffer with a string containing an error string * corresponding to the AVERROR code errnum. * * @param errbuf a buffer * @param errbuf_size size in bytes of errbuf * @param errnum error code to describe * @return the buffer in input, filled with the error description * @see av_strerror() */ static inline char *av_make_error_string(char *errbuf, size_t errbuf_size, int errnum) { av_strerror(errnum, errbuf, errbuf_size); return errbuf; } /** * Convenience macro, the return value should be used only directly in * function arguments but never stand-alone. */ #define av_err2str(errnum) \ av_make_error_string((char[AV_ERROR_MAX_STRING_SIZE]){0}, AV_ERROR_MAX_STRING_SIZE, errnum) /** * @} */ #endif /* AVUTIL_ERROR_H */
4,608
38.393162
140
h
cba-pipeline-public
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libavutil/pixdesc.h
/* * pixel format descriptor * Copyright (c) 2009 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_PIXDESC_H #define AVUTIL_PIXDESC_H #include <inttypes.h> #include "pixfmt.h" typedef struct AVComponentDescriptor{ uint16_t plane :2; ///< which of the 4 planes contains the component /** * Number of elements between 2 horizontally consecutive pixels minus 1. * Elements are bits for bitstream formats, bytes otherwise. */ uint16_t step_minus1 :3; /** * Number of elements before the component of the first pixel plus 1. * Elements are bits for bitstream formats, bytes otherwise. */ uint16_t offset_plus1 :3; uint16_t shift :3; ///< number of least significant bits that must be shifted away to get the value uint16_t depth_minus1 :4; ///< number of bits in the component minus 1 }AVComponentDescriptor; /** * Descriptor that unambiguously describes how the bits of a pixel are * stored in the up to 4 data planes of an image. It also stores the * subsampling factors and number of components. * * @note This is separate of the colorspace (RGB, YCbCr, YPbPr, JPEG-style YUV * and all the YUV variants) AVPixFmtDescriptor just stores how values * are stored not what these values represent. */ typedef struct AVPixFmtDescriptor{ const char *name; uint8_t nb_components; ///< The number of components each pixel has, (1-4) /** * Amount to shift the luma width right to find the chroma width. * For YV12 this is 1 for example. * chroma_width = -((-luma_width) >> log2_chroma_w) * The note above is needed to ensure rounding up. * This value only refers to the chroma components. */ uint8_t log2_chroma_w; ///< chroma_width = -((-luma_width )>>log2_chroma_w) /** * Amount to shift the luma height right to find the chroma height. * For YV12 this is 1 for example. * chroma_height= -((-luma_height) >> log2_chroma_h) * The note above is needed to ensure rounding up. * This value only refers to the chroma components. */ uint8_t log2_chroma_h; uint8_t flags; /** * Parameters that describe how pixels are packed. * If the format has 2 or 4 components, then alpha is last. * If the format has 1 or 2 components, then luma is 0. * If the format has 3 or 4 components, * if the RGB flag is set then 0 is red, 1 is green and 2 is blue; * otherwise 0 is luma, 1 is chroma-U and 2 is chroma-V. */ AVComponentDescriptor comp[4]; }AVPixFmtDescriptor; #define PIX_FMT_BE 1 ///< Pixel format is big-endian. #define PIX_FMT_PAL 2 ///< Pixel format has a palette in data[1], values are indexes in this palette. #define PIX_FMT_BITSTREAM 4 ///< All values of a component are bit-wise packed end to end. #define PIX_FMT_HWACCEL 8 ///< Pixel format is an HW accelerated format. #define PIX_FMT_PLANAR 16 ///< At least one pixel component is not in the first data plane #define PIX_FMT_RGB 32 ///< The pixel format contains RGB-like data (as opposed to YUV/grayscale) /** * The pixel format is "pseudo-paletted". This means that FFmpeg treats it as * paletted internally, but the palette is generated by the decoder and is not * stored in the file. */ #define PIX_FMT_PSEUDOPAL 64 /** * The array of all the pixel format descriptors. */ extern const AVPixFmtDescriptor av_pix_fmt_descriptors[]; /** * Read a line from an image, and write the values of the * pixel format component c to dst. * * @param data the array containing the pointers to the planes of the image * @param linesize the array containing the linesizes of the image * @param desc the pixel format descriptor for the image * @param x the horizontal coordinate of the first pixel to read * @param y the vertical coordinate of the first pixel to read * @param w the width of the line to read, that is the number of * values to write to dst * @param read_pal_component if not zero and the format is a paletted * format writes the values corresponding to the palette * component c in data[1] to dst, rather than the palette indexes in * data[0]. The behavior is undefined if the format is not paletted. */ void av_read_image_line(uint16_t *dst, const uint8_t *data[4], const int linesize[4], const AVPixFmtDescriptor *desc, int x, int y, int c, int w, int read_pal_component); /** * Write the values from src to the pixel format component c of an * image line. * * @param src array containing the values to write * @param data the array containing the pointers to the planes of the * image to write into. It is supposed to be zeroed. * @param linesize the array containing the linesizes of the image * @param desc the pixel format descriptor for the image * @param x the horizontal coordinate of the first pixel to write * @param y the vertical coordinate of the first pixel to write * @param w the width of the line to write, that is the number of * values to write to the image line */ void av_write_image_line(const uint16_t *src, uint8_t *data[4], const int linesize[4], const AVPixFmtDescriptor *desc, int x, int y, int c, int w); /** * Return the pixel format corresponding to name. * * If there is no pixel format with name name, then looks for a * pixel format with the name corresponding to the native endian * format of name. * For example in a little-endian system, first looks for "gray16", * then for "gray16le". * * Finally if no pixel format has been found, returns PIX_FMT_NONE. */ enum PixelFormat av_get_pix_fmt(const char *name); /** * Return the short name for a pixel format, NULL in case pix_fmt is * unknown. * * @see av_get_pix_fmt(), av_get_pix_fmt_string() */ const char *av_get_pix_fmt_name(enum PixelFormat pix_fmt); /** * Print in buf the string corresponding to the pixel format with * number pix_fmt, or an header if pix_fmt is negative. * * @param buf the buffer where to write the string * @param buf_size the size of buf * @param pix_fmt the number of the pixel format to print the * corresponding info string, or a negative value to print the * corresponding header. */ char *av_get_pix_fmt_string (char *buf, int buf_size, enum PixelFormat pix_fmt); /** * Return the number of bits per pixel used by the pixel format * described by pixdesc. * * The returned number of bits refers to the number of bits actually * used for storing the pixel information, that is padding bits are * not counted. */ int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc); #endif /* AVUTIL_PIXDESC_H */
7,457
38.882353
121
h
cba-pipeline-public
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libavutil/eval.h
/* * Copyright (c) 2002 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 */ /** * @file * simple arithmetic expression evaluator */ #ifndef AVUTIL_EVAL_H #define AVUTIL_EVAL_H #include "avutil.h" typedef struct AVExpr AVExpr; /** * Parse and evaluate an expression. * Note, this is significantly slower than av_expr_eval(). * * @param res a pointer to a double where is put the result value of * the expression, or NAN in case of error * @param s expression as a zero terminated string, for example "1+2^3+5*5+sin(2/3)" * @param const_names NULL terminated array of zero terminated strings of constant identifiers, for example {"PI", "E", 0} * @param const_values a zero terminated array of values for the identifiers from const_names * @param func1_names NULL terminated array of zero terminated strings of funcs1 identifiers * @param funcs1 NULL terminated array of function pointers for functions which take 1 argument * @param func2_names NULL terminated array of zero terminated strings of funcs2 identifiers * @param funcs2 NULL terminated array of function pointers for functions which take 2 arguments * @param opaque a pointer which will be passed to all functions from funcs1 and funcs2 * @param log_ctx parent logging context * @return 0 in case of success, a negative value corresponding to an * AVERROR code otherwise */ int av_expr_parse_and_eval(double *res, const char *s, const char * const *const_names, const double *const_values, const char * const *func1_names, double (* const *funcs1)(void *, double), const char * const *func2_names, double (* const *funcs2)(void *, double, double), void *opaque, int log_offset, void *log_ctx); /** * Parse an expression. * * @param expr a pointer where is put an AVExpr containing the parsed * value in case of successful parsing, or NULL otherwise. * The pointed to AVExpr must be freed with av_expr_free() by the user * when it is not needed anymore. * @param s expression as a zero terminated string, for example "1+2^3+5*5+sin(2/3)" * @param const_names NULL terminated array of zero terminated strings of constant identifiers, for example {"PI", "E", 0} * @param func1_names NULL terminated array of zero terminated strings of funcs1 identifiers * @param funcs1 NULL terminated array of function pointers for functions which take 1 argument * @param func2_names NULL terminated array of zero terminated strings of funcs2 identifiers * @param funcs2 NULL terminated array of function pointers for functions which take 2 arguments * @param log_ctx parent logging context * @return 0 in case of success, a negative value corresponding to an * AVERROR code otherwise */ int av_expr_parse(AVExpr **expr, const char *s, const char * const *const_names, const char * const *func1_names, double (* const *funcs1)(void *, double), const char * const *func2_names, double (* const *funcs2)(void *, double, double), int log_offset, void *log_ctx); /** * Evaluate a previously parsed expression. * * @param const_values a zero terminated array of values for the identifiers from av_expr_parse() const_names * @param opaque a pointer which will be passed to all functions from funcs1 and funcs2 * @return the value of the expression */ double av_expr_eval(AVExpr *e, const double *const_values, void *opaque); /** * Free a parsed expression previously created with av_expr_parse(). */ void av_expr_free(AVExpr *e); #if FF_API_OLD_EVAL_NAMES /** * @deprecated Deprecated in favor of av_expr_parse_and_eval(). */ attribute_deprecated int av_parse_and_eval_expr(double *res, const char *s, const char * const *const_names, const double *const_values, const char * const *func1_names, double (* const *funcs1)(void *, double), const char * const *func2_names, double (* const *funcs2)(void *, double, double), void *opaque, int log_offset, void *log_ctx); /** * @deprecated Deprecated in favor of av_expr_parse(). */ attribute_deprecated int av_parse_expr(AVExpr **expr, const char *s, const char * const *const_names, const char * const *func1_names, double (* const *funcs1)(void *, double), const char * const *func2_names, double (* const *funcs2)(void *, double, double), int log_offset, void *log_ctx); /** * @deprecated Deprecated in favor of av_expr_eval(). */ attribute_deprecated double av_eval_expr(AVExpr *e, const double *const_values, void *opaque); /** * @deprecated Deprecated in favor of av_expr_free(). */ attribute_deprecated void av_free_expr(AVExpr *e); #endif /* FF_API_OLD_EVAL_NAMES */ /** * Parse the string in numstr and return its value as a double. If * the string is empty, contains only whitespaces, or does not contain * an initial substring that has the expected syntax for a * floating-point number, no conversion is performed. In this case, * returns a value of zero and the value returned in tail is the value * of numstr. * * @param numstr a string representing a number, may contain one of * the International System number postfixes, for example 'K', 'M', * 'G'. If 'i' is appended after the postfix, powers of 2 are used * instead of powers of 10. The 'B' postfix multiplies the value for * 8, and can be appended after another postfix or used alone. This * allows using for example 'KB', 'MiB', 'G' and 'B' as postfix. * @param tail if non-NULL puts here the pointer to the char next * after the last parsed character */ double av_strtod(const char *numstr, char **tail); #endif /* AVUTIL_EVAL_H */
6,579
43.761905
122
h
cba-pipeline-public
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libavutil/audioconvert.h
/* * Copyright (c) 2006 Michael Niedermayer <[email protected]> * Copyright (c) 2008 Peter Ross * * 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_AUDIOCONVERT_H #define AVUTIL_AUDIOCONVERT_H #include <stdint.h> /** * @file * audio conversion routines */ /** * @addtogroup lavu_audio * @{ */ /** * @defgroup channel_masks Audio channel masks * @{ */ #define AV_CH_FRONT_LEFT 0x00000001 #define AV_CH_FRONT_RIGHT 0x00000002 #define AV_CH_FRONT_CENTER 0x00000004 #define AV_CH_LOW_FREQUENCY 0x00000008 #define AV_CH_BACK_LEFT 0x00000010 #define AV_CH_BACK_RIGHT 0x00000020 #define AV_CH_FRONT_LEFT_OF_CENTER 0x00000040 #define AV_CH_FRONT_RIGHT_OF_CENTER 0x00000080 #define AV_CH_BACK_CENTER 0x00000100 #define AV_CH_SIDE_LEFT 0x00000200 #define AV_CH_SIDE_RIGHT 0x00000400 #define AV_CH_TOP_CENTER 0x00000800 #define AV_CH_TOP_FRONT_LEFT 0x00001000 #define AV_CH_TOP_FRONT_CENTER 0x00002000 #define AV_CH_TOP_FRONT_RIGHT 0x00004000 #define AV_CH_TOP_BACK_LEFT 0x00008000 #define AV_CH_TOP_BACK_CENTER 0x00010000 #define AV_CH_TOP_BACK_RIGHT 0x00020000 #define AV_CH_STEREO_LEFT 0x20000000 ///< Stereo downmix. #define AV_CH_STEREO_RIGHT 0x40000000 ///< See AV_CH_STEREO_LEFT. #define AV_CH_WIDE_LEFT 0x0000000080000000ULL #define AV_CH_WIDE_RIGHT 0x0000000100000000ULL #define AV_CH_SURROUND_DIRECT_LEFT 0x0000000200000000ULL #define AV_CH_SURROUND_DIRECT_RIGHT 0x0000000400000000ULL /** Channel mask value used for AVCodecContext.request_channel_layout to indicate that the user requests the channel order of the decoder output to be the native codec channel order. */ #define AV_CH_LAYOUT_NATIVE 0x8000000000000000ULL /** * @} * @defgroup channel_mask_c Audio channel convenience macros * @{ * */ #define AV_CH_LAYOUT_MONO (AV_CH_FRONT_CENTER) #define AV_CH_LAYOUT_STEREO (AV_CH_FRONT_LEFT|AV_CH_FRONT_RIGHT) #define AV_CH_LAYOUT_2POINT1 (AV_CH_LAYOUT_STEREO|AV_CH_LOW_FREQUENCY) #define AV_CH_LAYOUT_2_1 (AV_CH_LAYOUT_STEREO|AV_CH_BACK_CENTER) #define AV_CH_LAYOUT_SURROUND (AV_CH_LAYOUT_STEREO|AV_CH_FRONT_CENTER) #define AV_CH_LAYOUT_3POINT1 (AV_CH_LAYOUT_SURROUND|AV_CH_LOW_FREQUENCY) #define AV_CH_LAYOUT_4POINT0 (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_CENTER) #define AV_CH_LAYOUT_4POINT1 (AV_CH_LAYOUT_4POINT0|AV_CH_LOW_FREQUENCY) #define AV_CH_LAYOUT_2_2 (AV_CH_LAYOUT_STEREO|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT) #define AV_CH_LAYOUT_QUAD (AV_CH_LAYOUT_STEREO|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT) #define AV_CH_LAYOUT_5POINT0 (AV_CH_LAYOUT_SURROUND|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT) #define AV_CH_LAYOUT_5POINT1 (AV_CH_LAYOUT_5POINT0|AV_CH_LOW_FREQUENCY) #define AV_CH_LAYOUT_5POINT0_BACK (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT) #define AV_CH_LAYOUT_5POINT1_BACK (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_LOW_FREQUENCY) #define AV_CH_LAYOUT_6POINT0 (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_CENTER) #define AV_CH_LAYOUT_6POINT0_FRONT (AV_CH_LAYOUT_2_2|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER) #define AV_CH_LAYOUT_HEXAGONAL (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_BACK_CENTER) #define AV_CH_LAYOUT_6POINT1 (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_CENTER) #define AV_CH_LAYOUT_6POINT1_BACK (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_BACK_CENTER) #define AV_CH_LAYOUT_6POINT1_FRONT (AV_CH_LAYOUT_6POINT0_FRONT|AV_CH_LOW_FREQUENCY) #define AV_CH_LAYOUT_7POINT0 (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT) #define AV_CH_LAYOUT_7POINT0_FRONT (AV_CH_LAYOUT_5POINT0|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER) #define AV_CH_LAYOUT_7POINT1 (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT) #define AV_CH_LAYOUT_7POINT1_WIDE (AV_CH_LAYOUT_5POINT1|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER) #define AV_CH_LAYOUT_7POINT1_WIDE_BACK (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER) #define AV_CH_LAYOUT_OCTAGONAL (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_CENTER|AV_CH_BACK_RIGHT) #define AV_CH_LAYOUT_STEREO_DOWNMIX (AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT) enum AVMatrixEncoding { AV_MATRIX_ENCODING_NONE, AV_MATRIX_ENCODING_DOLBY, AV_MATRIX_ENCODING_DPLII, AV_MATRIX_ENCODING_NB }; /** * @} */ /** * Return a channel layout id that matches name, or 0 if no match is found. * * name can be one or several of the following notations, * separated by '+' or '|': * - the name of an usual channel layout (mono, stereo, 4.0, quad, 5.0, * 5.0(side), 5.1, 5.1(side), 7.1, 7.1(wide), downmix); * - the name of a single channel (FL, FR, FC, LFE, BL, BR, FLC, FRC, BC, * SL, SR, TC, TFL, TFC, TFR, TBL, TBC, TBR, DL, DR); * - a number of channels, in decimal, optionally followed by 'c', yielding * the default channel layout for that number of channels (@see * av_get_default_channel_layout); * - a channel layout mask, in hexadecimal starting with "0x" (see the * AV_CH_* macros). * * Example: "stereo+FC" = "2+FC" = "2c+1c" = "0x7" */ uint64_t av_get_channel_layout(const char *name); /** * Return a description of a channel layout. * If nb_channels is <= 0, it is guessed from the channel_layout. * * @param buf put here the string containing the channel layout * @param buf_size size in bytes of the buffer */ void av_get_channel_layout_string(char *buf, int buf_size, int nb_channels, uint64_t channel_layout); struct AVBPrint; /** * Append a description of a channel layout to a bprint buffer. */ void av_bprint_channel_layout(struct AVBPrint *bp, int nb_channels, uint64_t channel_layout); /** * Return the number of channels in the channel layout. */ int av_get_channel_layout_nb_channels(uint64_t channel_layout); /** * Return default channel layout for a given number of channels. */ int64_t av_get_default_channel_layout(int nb_channels); /** * Get the index of a channel in channel_layout. * * @param channel a channel layout describing exactly one channel which must be * present in channel_layout. * * @return index of channel in channel_layout on success, a negative AVERROR * on error. */ int av_get_channel_layout_channel_index(uint64_t channel_layout, uint64_t channel); /** * Get the channel with the given index in channel_layout. */ uint64_t av_channel_layout_extract_channel(uint64_t channel_layout, int index); /** * Get the name of a given channel. * * @return channel name on success, NULL on error. */ const char *av_get_channel_name(uint64_t channel); /** * Get the description of a given channel. * * @param channel a channel layout with a single channel * @return channel description on success, NULL on error */ const char *av_get_channel_description(uint64_t channel); /** * Get the value and name of a standard channel layout. * * @param[in] index index in an internal list, starting at 0 * @param[out] layout channel layout mask * @param[out] name name of the layout * @return 0 if the layout exists, * <0 if index is beyond the limits */ int av_get_standard_channel_layout(unsigned index, uint64_t *layout, const char **name); /** * @} */ #endif /* AVUTIL_AUDIOCONVERT_H */
8,275
38.788462
121
h
cba-pipeline-public
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libavutil/avconfig.h
/* Generated by ffconf */ #ifndef AVUTIL_AVCONFIG_H #define AVUTIL_AVCONFIG_H #define AV_HAVE_BIGENDIAN 0 #define AV_HAVE_FAST_UNALIGNED 1 #define AV_HAVE_INCOMPATIBLE_FORK_ABI 0 #endif /* AVUTIL_AVCONFIG_H */
210
25.375
39
h
cba-pipeline-public
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libavutil/xtea.h
/* * A 32-bit implementation of the XTEA 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_XTEA_H #define AVUTIL_XTEA_H #include <stdint.h> /** * @defgroup lavu_xtea XTEA * @ingroup lavu_crypto * @{ */ typedef struct AVXTEA { uint32_t key[16]; } AVXTEA; /** * Initialize an AVXTEA context. * * @param ctx an AVXTEA context * @param key a key of 16 bytes used for encryption/decryption */ void av_xtea_init(struct AVXTEA *ctx, const uint8_t key[16]); /** * Encrypt or decrypt a buffer using a previously initialized context. * * @param ctx an AVXTEA 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 then ECB will be used * @param decrypt 0 for encryption, 1 for decryption */ void av_xtea_crypt(struct AVXTEA *ctx, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt); /** * @} */ #endif /* AVUTIL_XTEA_H */
1,806
27.68254
79
h
cba-pipeline-public
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libavdevice/avdevice.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 AVDEVICE_AVDEVICE_H #define AVDEVICE_AVDEVICE_H #include "version.h" /** * @file * @ingroup lavd * Main libavdevice API header */ /** * @defgroup lavd Special devices muxing/demuxing library * @{ * Libavdevice is a complementary library to @ref libavf "libavformat". It * provides various "special" platform-specific muxers and demuxers, e.g. for * grabbing devices, audio capture and playback etc. As a consequence, the * (de)muxers in libavdevice are of the AVFMT_NOFILE type (they use their own * I/O functions). The filename passed to avformat_open_input() often does not * refer to an actually existing file, but has some special device-specific * meaning - e.g. for x11grab it is the display name. * * To use libavdevice, simply call avdevice_register_all() to register all * compiled muxers and demuxers. They all use standard libavformat API. * @} */ #include "libavformat/avformat.h" /** * Return the LIBAVDEVICE_VERSION_INT constant. */ unsigned avdevice_version(void); /** * Return the libavdevice build-time configuration. */ const char *avdevice_configuration(void); /** * Return the libavdevice license. */ const char *avdevice_license(void); /** * Initialize libavdevice and register all the input and output devices. * @warning This function is not thread safe. */ void avdevice_register_all(void); #endif /* AVDEVICE_AVDEVICE_H */
2,156
29.814286
79
h
cba-pipeline-public
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libavdevice/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 AVDEVICE_VERSION_H #define AVDEVICE_VERSION_H /** * @file * @ingroup lavd * Libavdevice version macros */ #include "libavutil/avutil.h" #define LIBAVDEVICE_VERSION_MAJOR 54 #define LIBAVDEVICE_VERSION_MINOR 2 #define LIBAVDEVICE_VERSION_MICRO 100 #define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \ LIBAVDEVICE_VERSION_MINOR, \ LIBAVDEVICE_VERSION_MICRO) #define LIBAVDEVICE_VERSION AV_VERSION(LIBAVDEVICE_VERSION_MAJOR, \ LIBAVDEVICE_VERSION_MINOR, \ LIBAVDEVICE_VERSION_MICRO) #define LIBAVDEVICE_BUILD LIBAVDEVICE_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. */ #endif /* AVDEVICE_VERSION_H */
1,786
35.469388
79
h
cba-pipeline-public
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libavformat/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 AVFORMAT_VERSION_H #define AVFORMAT_VERSION_H /** * @file * @ingroup libavf * Libavformat version macros */ #include "libavutil/avutil.h" #define LIBAVFORMAT_VERSION_MAJOR 54 #define LIBAVFORMAT_VERSION_MINOR 25 #define LIBAVFORMAT_VERSION_MICRO 105 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ LIBAVFORMAT_VERSION_MINOR, \ LIBAVFORMAT_VERSION_MICRO) #define LIBAVFORMAT_VERSION AV_VERSION(LIBAVFORMAT_VERSION_MAJOR, \ LIBAVFORMAT_VERSION_MINOR, \ LIBAVFORMAT_VERSION_MICRO) #define LIBAVFORMAT_BUILD LIBAVFORMAT_VERSION_INT #define LIBAVFORMAT_IDENT "Lavf" AV_STRINGIFY(LIBAVFORMAT_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_OLD_AVIO #define FF_API_OLD_AVIO (LIBAVFORMAT_VERSION_MAJOR < 55) #endif #ifndef FF_API_PKT_DUMP #define FF_API_PKT_DUMP (LIBAVFORMAT_VERSION_MAJOR < 54) #endif #ifndef FF_API_ALLOC_OUTPUT_CONTEXT #define FF_API_ALLOC_OUTPUT_CONTEXT (LIBAVFORMAT_VERSION_MAJOR < 55) #endif #ifndef FF_API_FORMAT_PARAMETERS #define FF_API_FORMAT_PARAMETERS (LIBAVFORMAT_VERSION_MAJOR < 55) #endif #ifndef FF_API_NEW_STREAM #define FF_API_NEW_STREAM (LIBAVFORMAT_VERSION_MAJOR < 55) #endif #ifndef FF_API_SET_PTS_INFO #define FF_API_SET_PTS_INFO (LIBAVFORMAT_VERSION_MAJOR < 55) #endif #ifndef FF_API_CLOSE_INPUT_FILE #define FF_API_CLOSE_INPUT_FILE (LIBAVFORMAT_VERSION_MAJOR < 55) #endif #ifndef FF_API_APPLEHTTP_PROTO #define FF_API_APPLEHTTP_PROTO (LIBAVFORMAT_VERSION_MAJOR < 55) #endif #ifndef FF_API_READ_PACKET #define FF_API_READ_PACKET (LIBAVFORMAT_VERSION_MAJOR < 55) #endif #ifndef FF_API_INTERLEAVE_PACKET #define FF_API_INTERLEAVE_PACKET (LIBAVFORMAT_VERSION_MAJOR < 55) #endif #ifndef FF_API_AV_GETTIME #define FF_API_AV_GETTIME (LIBAVFORMAT_VERSION_MAJOR < 55) #endif #ifndef FF_API_R_FRAME_RATE #define FF_API_R_FRAME_RATE (LIBAVFORMAT_VERSION_MAJOR < 55) #endif #endif /* AVFORMAT_VERSION_H */
3,183
34.377778
79
h
cba-pipeline-public
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libavformat/avformat.h
/* * copyright (c) 2001 Fabrice Bellard * * 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 AVFORMAT_AVFORMAT_H #define AVFORMAT_AVFORMAT_H /** * @file * @ingroup libavf * Main libavformat public API header */ /** * @defgroup libavf I/O and Muxing/Demuxing Library * @{ * * Libavformat (lavf) is a library for dealing with various media container * formats. Its main two purposes are demuxing - i.e. splitting a media file * into component streams, and the reverse process of muxing - writing supplied * data in a specified container format. It also has an @ref lavf_io * "I/O module" which supports a number of protocols for accessing the data (e.g. * file, tcp, http and others). Before using lavf, you need to call * av_register_all() to register all compiled muxers, demuxers and protocols. * Unless you are absolutely sure you won't use libavformat's network * capabilities, you should also call avformat_network_init(). * * A supported input format is described by an AVInputFormat struct, conversely * an output format is described by AVOutputFormat. You can iterate over all * registered input/output formats using the av_iformat_next() / * av_oformat_next() functions. The protocols layer is not part of the public * API, so you can only get the names of supported protocols with the * avio_enum_protocols() function. * * Main lavf structure used for both muxing and demuxing is AVFormatContext, * which exports all information about the file being read or written. As with * most Libavformat structures, its size is not part of public ABI, so it cannot be * allocated on stack or directly with av_malloc(). To create an * AVFormatContext, use avformat_alloc_context() (some functions, like * avformat_open_input() might do that for you). * * Most importantly an AVFormatContext contains: * @li the @ref AVFormatContext.iformat "input" or @ref AVFormatContext.oformat * "output" format. It is either autodetected or set by user for input; * always set by user for output. * @li an @ref AVFormatContext.streams "array" of AVStreams, which describe all * elementary streams stored in the file. AVStreams are typically referred to * using their index in this array. * @li an @ref AVFormatContext.pb "I/O context". It is either opened by lavf or * set by user for input, always set by user for output (unless you are dealing * with an AVFMT_NOFILE format). * * @section lavf_options Passing options to (de)muxers * Lavf allows to configure muxers and demuxers using the @ref avoptions * mechanism. Generic (format-independent) libavformat options are provided by * AVFormatContext, they can be examined from a user program by calling * av_opt_next() / av_opt_find() on an allocated AVFormatContext (or its AVClass * from avformat_get_class()). Private (format-specific) options are provided by * AVFormatContext.priv_data if and only if AVInputFormat.priv_class / * AVOutputFormat.priv_class of the corresponding format struct is non-NULL. * Further options may be provided by the @ref AVFormatContext.pb "I/O context", * if its AVClass is non-NULL, and the protocols layer. See the discussion on * nesting in @ref avoptions documentation to learn how to access those. * * @defgroup lavf_decoding Demuxing * @{ * Demuxers read a media file and split it into chunks of data (@em packets). A * @ref AVPacket "packet" contains one or more encoded frames which belongs to a * single elementary stream. In the lavf API this process is represented by the * avformat_open_input() function for opening a file, av_read_frame() for * reading a single packet and finally avformat_close_input(), which does the * cleanup. * * @section lavf_decoding_open Opening a media file * The minimum information required to open a file is its URL or filename, which * is passed to avformat_open_input(), as in the following code: * @code * const char *url = "in.mp3"; * AVFormatContext *s = NULL; * int ret = avformat_open_input(&s, url, NULL, NULL); * if (ret < 0) * abort(); * @endcode * The above code attempts to allocate an AVFormatContext, open the * specified file (autodetecting the format) and read the header, exporting the * information stored there into s. Some formats do not have a header or do not * store enough information there, so it is recommended that you call the * avformat_find_stream_info() function which tries to read and decode a few * frames to find missing information. * * In some cases you might want to preallocate an AVFormatContext yourself with * avformat_alloc_context() and do some tweaking on it before passing it to * avformat_open_input(). One such case is when you want to use custom functions * for reading input data instead of lavf internal I/O layer. * To do that, create your own AVIOContext with avio_alloc_context(), passing * your reading callbacks to it. Then set the @em pb field of your * AVFormatContext to newly created AVIOContext. * * Since the format of the opened file is in general not known until after * avformat_open_input() has returned, it is not possible to set demuxer private * options on a preallocated context. Instead, the options should be passed to * avformat_open_input() wrapped in an AVDictionary: * @code * AVDictionary *options = NULL; * av_dict_set(&options, "video_size", "640x480", 0); * av_dict_set(&options, "pixel_format", "rgb24", 0); * * if (avformat_open_input(&s, url, NULL, &options) < 0) * abort(); * av_dict_free(&options); * @endcode * This code passes the private options 'video_size' and 'pixel_format' to the * demuxer. They would be necessary for e.g. the rawvideo demuxer, since it * cannot know how to interpret raw video data otherwise. If the format turns * out to be something different than raw video, those options will not be * recognized by the demuxer and therefore will not be applied. Such unrecognized * options are then returned in the options dictionary (recognized options are * consumed). The calling program can handle such unrecognized options as it * wishes, e.g. * @code * AVDictionaryEntry *e; * if (e = av_dict_get(options, "", NULL, AV_DICT_IGNORE_SUFFIX)) { * fprintf(stderr, "Option %s not recognized by the demuxer.\n", e->key); * abort(); * } * @endcode * * After you have finished reading the file, you must close it with * avformat_close_input(). It will free everything associated with the file. * * @section lavf_decoding_read Reading from an opened file * Reading data from an opened AVFormatContext is done by repeatedly calling * av_read_frame() on it. Each call, if successful, will return an AVPacket * containing encoded data for one AVStream, identified by * AVPacket.stream_index. This packet may be passed straight into the libavcodec * decoding functions avcodec_decode_video2(), avcodec_decode_audio4() or * avcodec_decode_subtitle2() if the caller wishes to decode the data. * * AVPacket.pts, AVPacket.dts and AVPacket.duration timing information will be * set if known. They may also be unset (i.e. AV_NOPTS_VALUE for * pts/dts, 0 for duration) if the stream does not provide them. The timing * information will be in AVStream.time_base units, i.e. it has to be * multiplied by the timebase to convert them to seconds. * * The packet data belongs to the demuxer and is invalid after the next call to * av_read_frame(). The user must free the packet with av_free_packet() before * calling av_read_frame() again or closing the file. * * @section lavf_decoding_seek Seeking * @} * * @defgroup lavf_encoding Muxing * @{ * @} * * @defgroup lavf_io I/O Read/Write * @{ * @} * * @defgroup lavf_codec Demuxers * @{ * @defgroup lavf_codec_native Native Demuxers * @{ * @} * @defgroup lavf_codec_wrappers External library wrappers * @{ * @} * @} * @defgroup lavf_protos I/O Protocols * @{ * @} * @defgroup lavf_internal Internal * @{ * @} * @} * */ #include <time.h> #include <stdio.h> /* FILE */ #include "libavcodec/avcodec.h" #include "libavutil/dict.h" #include "libavutil/log.h" #include "avio.h" #include "libavformat/version.h" #if FF_API_AV_GETTIME #include "libavutil/time.h" #endif struct AVFormatContext; /** * @defgroup metadata_api Public Metadata API * @{ * @ingroup libavf * The metadata API allows libavformat to export metadata tags to a client * application when demuxing. Conversely it allows a client application to * set metadata when muxing. * * Metadata is exported or set as pairs of key/value strings in the 'metadata' * fields of the AVFormatContext, AVStream, AVChapter and AVProgram structs * using the @ref lavu_dict "AVDictionary" API. Like all strings in FFmpeg, * metadata is assumed to be UTF-8 encoded Unicode. Note that metadata * exported by demuxers isn't checked to be valid UTF-8 in most cases. * * Important concepts to keep in mind: * - Keys are unique; there can never be 2 tags with the same key. This is * also meant semantically, i.e., a demuxer should not knowingly produce * several keys that are literally different but semantically identical. * E.g., key=Author5, key=Author6. In this example, all authors must be * placed in the same tag. * - Metadata is flat, not hierarchical; there are no subtags. If you * want to store, e.g., the email address of the child of producer Alice * and actor Bob, that could have key=alice_and_bobs_childs_email_address. * - Several modifiers can be applied to the tag name. This is done by * appending a dash character ('-') and the modifier name in the order * they appear in the list below -- e.g. foo-eng-sort, not foo-sort-eng. * - language -- a tag whose value is localized for a particular language * is appended with the ISO 639-2/B 3-letter language code. * For example: Author-ger=Michael, Author-eng=Mike * The original/default language is in the unqualified "Author" tag. * A demuxer should set a default if it sets any translated tag. * - sorting -- a modified version of a tag that should be used for * sorting will have '-sort' appended. E.g. artist="The Beatles", * artist-sort="Beatles, The". * * - Demuxers attempt to export metadata in a generic format, however tags * with no generic equivalents are left as they are stored in the container. * Follows a list of generic tag names: * @verbatim album -- name of the set this work belongs to album_artist -- main creator of the set/album, if different from artist. e.g. "Various Artists" for compilation albums. artist -- main creator of the work comment -- any additional description of the file. composer -- who composed the work, if different from artist. copyright -- name of copyright holder. creation_time-- date when the file was created, preferably in ISO 8601. date -- date when the work was created, preferably in ISO 8601. disc -- number of a subset, e.g. disc in a multi-disc collection. encoder -- name/settings of the software/hardware that produced the file. encoded_by -- person/group who created the file. filename -- original name of the file. genre -- <self-evident>. language -- main language in which the work is performed, preferably in ISO 639-2 format. Multiple languages can be specified by separating them with commas. performer -- artist who performed the work, if different from artist. E.g for "Also sprach Zarathustra", artist would be "Richard Strauss" and performer "London Philharmonic Orchestra". publisher -- name of the label/publisher. service_name -- name of the service in broadcasting (channel name). service_provider -- name of the service provider in broadcasting. title -- name of the work. track -- number of this work in the set, can be in form current/total. variant_bitrate -- the total bitrate of the bitrate variant that the current stream is part of @endverbatim * * Look in the examples section for an application example how to use the Metadata API. * * @} */ /* packet functions */ /** * Allocate and read the payload of a packet and initialize its * fields with default values. * * @param pkt packet * @param size desired payload size * @return >0 (read size) if OK, AVERROR_xxx otherwise */ int av_get_packet(AVIOContext *s, AVPacket *pkt, int size); /** * Read data and append it to the current content of the AVPacket. * If pkt->size is 0 this is identical to av_get_packet. * Note that this uses av_grow_packet and thus involves a realloc * which is inefficient. Thus this function should only be used * when there is no reasonable way to know (an upper bound of) * the final size. * * @param pkt packet * @param size amount of data to read * @return >0 (read size) if OK, AVERROR_xxx otherwise, previous data * will not be lost even if an error occurs. */ int av_append_packet(AVIOContext *s, AVPacket *pkt, int size); /*************************************************/ /* fractional numbers for exact pts handling */ /** * The exact value of the fractional number is: 'val + num / den'. * num is assumed to be 0 <= num < den. */ typedef struct AVFrac { int64_t val, num, den; } AVFrac; /*************************************************/ /* input/output formats */ struct AVCodecTag; /** * This structure contains the data a format has to probe a file. */ typedef struct AVProbeData { const char *filename; unsigned char *buf; /**< Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero. */ int buf_size; /**< Size of buf except extra allocated bytes */ } AVProbeData; #define AVPROBE_SCORE_MAX 100 ///< maximum score, half of that is used for file-extension-based detection #define AVPROBE_PADDING_SIZE 32 ///< extra allocated bytes at the end of the probe buffer /// Demuxer will use avio_open, no opened file should be provided by the caller. #define AVFMT_NOFILE 0x0001 #define AVFMT_NEEDNUMBER 0x0002 /**< Needs '%d' in filename. */ #define AVFMT_SHOW_IDS 0x0008 /**< Show format stream IDs numbers. */ #define AVFMT_RAWPICTURE 0x0020 /**< Format wants AVPicture structure for raw picture data. */ #define AVFMT_GLOBALHEADER 0x0040 /**< Format wants global header. */ #define AVFMT_NOTIMESTAMPS 0x0080 /**< Format does not need / have any timestamps. */ #define AVFMT_GENERIC_INDEX 0x0100 /**< Use generic index building code. */ #define AVFMT_TS_DISCONT 0x0200 /**< Format allows timestamp discontinuities. Note, muxers always require valid (monotone) timestamps */ #define AVFMT_VARIABLE_FPS 0x0400 /**< Format allows variable fps. */ #define AVFMT_NODIMENSIONS 0x0800 /**< Format does not need width/height */ #define AVFMT_NOSTREAMS 0x1000 /**< Format does not require any streams */ #define AVFMT_NOBINSEARCH 0x2000 /**< Format does not allow to fallback to binary search via read_timestamp */ #define AVFMT_NOGENSEARCH 0x4000 /**< Format does not allow to fallback to generic search */ #define AVFMT_NO_BYTE_SEEK 0x8000 /**< Format does not allow seeking by bytes */ #define AVFMT_ALLOW_FLUSH 0x10000 /**< Format allows flushing. If not set, the muxer will not receive a NULL packet in the write_packet function. */ #if LIBAVFORMAT_VERSION_MAJOR <= 54 #define AVFMT_TS_NONSTRICT 0x8020000 //we try to be compatible to the ABIs of ffmpeg and major forks #else #define AVFMT_TS_NONSTRICT 0x20000 #endif /**< Format does not require strictly increasing timestamps, but they must still be monotonic */ #define AVFMT_SEEK_TO_PTS 0x4000000 /**< Seeking is based on PTS */ /** * @addtogroup lavf_encoding * @{ */ typedef struct AVOutputFormat { const char *name; /** * Descriptive name for the format, meant to be more human-readable * than name. You should use the NULL_IF_CONFIG_SMALL() macro * to define it. */ const char *long_name; const char *mime_type; const char *extensions; /**< comma-separated filename extensions */ /* output support */ enum AVCodecID audio_codec; /**< default audio codec */ enum AVCodecID video_codec; /**< default video codec */ enum AVCodecID subtitle_codec; /**< default subtitle codec */ /** * can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_RAWPICTURE, * AVFMT_GLOBALHEADER, AVFMT_NOTIMESTAMPS, AVFMT_VARIABLE_FPS, * AVFMT_NODIMENSIONS, AVFMT_NOSTREAMS, AVFMT_ALLOW_FLUSH, * AVFMT_TS_NONSTRICT */ int flags; /** * List of supported codec_id-codec_tag pairs, ordered by "better * choice first". The arrays are all terminated by AV_CODEC_ID_NONE. */ const struct AVCodecTag * const *codec_tag; const AVClass *priv_class; ///< AVClass for the private context /***************************************************************** * No fields below this line are part of the public API. They * may not be used outside of libavformat and can be changed and * removed at will. * New public fields should be added right above. ***************************************************************** */ struct AVOutputFormat *next; /** * size of private data so that it can be allocated in the wrapper */ int priv_data_size; int (*write_header)(struct AVFormatContext *); /** * Write a packet. If AVFMT_ALLOW_FLUSH is set in flags, * pkt can be NULL in order to flush data buffered in the muxer. * When flushing, return 0 if there still is more data to flush, * or 1 if everything was flushed and there is no more buffered * data. */ int (*write_packet)(struct AVFormatContext *, AVPacket *pkt); int (*write_trailer)(struct AVFormatContext *); /** * Currently only used to set pixel format if not YUV420P. */ int (*interleave_packet)(struct AVFormatContext *, AVPacket *out, AVPacket *in, int flush); /** * Test if the given codec can be stored in this container. * * @return 1 if the codec is supported, 0 if it is not. * A negative number if unknown. * MKTAG('A', 'P', 'I', 'C') if the codec is only supported as AV_DISPOSITION_ATTACHED_PIC */ int (*query_codec)(enum AVCodecID id, int std_compliance); void (*get_output_timestamp)(struct AVFormatContext *s, int stream, int64_t *dts, int64_t *wall); } AVOutputFormat; /** * @} */ /** * @addtogroup lavf_decoding * @{ */ typedef struct AVInputFormat { /** * A comma separated list of short names for the format. New names * may be appended with a minor bump. */ const char *name; /** * Descriptive name for the format, meant to be more human-readable * than name. You should use the NULL_IF_CONFIG_SMALL() macro * to define it. */ const char *long_name; /** * Can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_SHOW_IDS, * AVFMT_GENERIC_INDEX, AVFMT_TS_DISCONT, AVFMT_NOBINSEARCH, * AVFMT_NOGENSEARCH, AVFMT_NO_BYTE_SEEK, AVFMT_SEEK_TO_PTS. */ int flags; /** * If extensions are defined, then no probe is done. You should * usually not use extension format guessing because it is not * reliable enough */ const char *extensions; const struct AVCodecTag * const *codec_tag; const AVClass *priv_class; ///< AVClass for the private context /***************************************************************** * No fields below this line are part of the public API. They * may not be used outside of libavformat and can be changed and * removed at will. * New public fields should be added right above. ***************************************************************** */ struct AVInputFormat *next; /** * Raw demuxers store their codec ID here. */ int raw_codec_id; /** * Size of private data so that it can be allocated in the wrapper. */ int priv_data_size; /** * Tell if a given file has a chance of being parsed as this format. * The buffer provided is guaranteed to be AVPROBE_PADDING_SIZE bytes * big so you do not have to check for that unless you need more. */ int (*read_probe)(AVProbeData *); /** * Read the format header and initialize the AVFormatContext * structure. Return 0 if OK. Only used in raw format right * now. 'avformat_new_stream' should be called to create new streams. */ int (*read_header)(struct AVFormatContext *); /** * Read one packet and put it in 'pkt'. pts and flags are also * set. 'avformat_new_stream' can be called only if the flag * AVFMTCTX_NOHEADER is used and only in the calling thread (not in a * background thread). * @return 0 on success, < 0 on error. * When returning an error, pkt must not have been allocated * or must be freed before returning */ int (*read_packet)(struct AVFormatContext *, AVPacket *pkt); /** * Close the stream. The AVFormatContext and AVStreams are not * freed by this function */ int (*read_close)(struct AVFormatContext *); /** * Seek to a given timestamp relative to the frames in * stream component stream_index. * @param stream_index Must not be -1. * @param flags Selects which direction should be preferred if no exact * match is available. * @return >= 0 on success (but not necessarily the new offset) */ int (*read_seek)(struct AVFormatContext *, int stream_index, int64_t timestamp, int flags); /** * Get the next timestamp in stream[stream_index].time_base units. * @return the timestamp or AV_NOPTS_VALUE if an error occurred */ int64_t (*read_timestamp)(struct AVFormatContext *s, int stream_index, int64_t *pos, int64_t pos_limit); /** * Start/resume playing - only meaningful if using a network-based format * (RTSP). */ int (*read_play)(struct AVFormatContext *); /** * Pause playing - only meaningful if using a network-based format * (RTSP). */ int (*read_pause)(struct AVFormatContext *); /** * Seek to timestamp ts. * Seeking will be done so that the point from which all active streams * can be presented successfully will be closest to ts and within min/max_ts. * Active streams are all streams that have AVStream.discard < AVDISCARD_ALL. */ int (*read_seek2)(struct AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags); } AVInputFormat; /** * @} */ enum AVStreamParseType { AVSTREAM_PARSE_NONE, AVSTREAM_PARSE_FULL, /**< full parsing and repack */ AVSTREAM_PARSE_HEADERS, /**< Only parse headers, do not repack. */ AVSTREAM_PARSE_TIMESTAMPS, /**< full parsing and interpolation of timestamps for frames not starting on a packet boundary */ AVSTREAM_PARSE_FULL_ONCE, /**< full parsing and repack of the first frame only, only implemented for H.264 currently */ AVSTREAM_PARSE_FULL_RAW=MKTAG(0,'R','A','W'), /**< full parsing and repack with timestamp and position generation by parser for raw this assumes that each packet in the file contains no demuxer level headers and just codec level data, otherwise position generaion would fail */ }; typedef struct AVIndexEntry { int64_t pos; int64_t timestamp; /**< * Timestamp in AVStream.time_base units, preferably the time from which on correctly decoded frames are available * when seeking to this entry. That means preferable PTS on keyframe based formats. * But demuxers can choose to store a different timestamp, if it is more convenient for the implementation or nothing better * is known */ #define AVINDEX_KEYFRAME 0x0001 int flags:2; int size:30; //Yeah, trying to keep the size of this small to reduce memory requirements (it is 24 vs. 32 bytes due to possible 8-byte alignment). int min_distance; /**< Minimum distance between this and the previous keyframe, used to avoid unneeded searching. */ } AVIndexEntry; #define AV_DISPOSITION_DEFAULT 0x0001 #define AV_DISPOSITION_DUB 0x0002 #define AV_DISPOSITION_ORIGINAL 0x0004 #define AV_DISPOSITION_COMMENT 0x0008 #define AV_DISPOSITION_LYRICS 0x0010 #define AV_DISPOSITION_KARAOKE 0x0020 /** * Track should be used during playback by default. * Useful for subtitle track that should be displayed * even when user did not explicitly ask for subtitles. */ #define AV_DISPOSITION_FORCED 0x0040 #define AV_DISPOSITION_HEARING_IMPAIRED 0x0080 /**< stream for hearing impaired audiences */ #define AV_DISPOSITION_VISUAL_IMPAIRED 0x0100 /**< stream for visual impaired audiences */ #define AV_DISPOSITION_CLEAN_EFFECTS 0x0200 /**< stream without voice */ /** * The stream is stored in the file as an attached picture/"cover art" (e.g. * APIC frame in ID3v2). The single packet associated with it will be returned * among the first few packets read from the file unless seeking takes place. * It can also be accessed at any time in AVStream.attached_pic. */ #define AV_DISPOSITION_ATTACHED_PIC 0x0400 /** * Stream structure. * New fields can be added to the end with minor version bumps. * Removal, reordering and changes to existing fields require a major * version bump. * sizeof(AVStream) must not be used outside libav*. */ typedef struct AVStream { int index; /**< stream index in AVFormatContext */ /** * Format-specific stream ID. * decoding: set by libavformat * encoding: set by the user */ int id; /** * Codec context associated with this stream. Allocated and freed by * libavformat. * * - decoding: The demuxer exports codec information stored in the headers * here. * - encoding: The user sets codec information, the muxer writes it to the * output. Mandatory fields as specified in AVCodecContext * documentation must be set even if this AVCodecContext is * not actually used for encoding. */ AVCodecContext *codec; #if FF_API_R_FRAME_RATE /** * Real base framerate of the stream. * This is the lowest framerate with which all timestamps can be * represented accurately (it is the least common multiple of all * framerates in the stream). Note, this value is just a guess! * For example, if the time base is 1/90000 and all frames have either * approximately 3600 or 1800 timer ticks, then r_frame_rate will be 50/1. */ AVRational r_frame_rate; #endif void *priv_data; /** * encoding: pts generation when outputting stream */ struct AVFrac pts; /** * This is the fundamental unit of time (in seconds) in terms * of which frame timestamps are represented. * * decoding: set by libavformat * encoding: set by libavformat in av_write_header. The muxer may use the * user-provided value of @ref AVCodecContext.time_base "codec->time_base" * as a hint. */ AVRational time_base; /** * Decoding: pts of the first frame of the stream in presentation order, in stream time base. * Only set this if you are absolutely 100% sure that the value you set * it to really is the pts of the first frame. * This may be undefined (AV_NOPTS_VALUE). * @note The ASF header does NOT contain a correct start_time the ASF * demuxer must NOT set this. */ int64_t start_time; /** * Decoding: duration of the stream, in stream time base. * If a source file does not specify a duration, but does specify * a bitrate, this value will be estimated from bitrate and file size. */ int64_t duration; int64_t nb_frames; ///< number of frames in this stream if known or 0 int disposition; /**< AV_DISPOSITION_* bit field */ enum AVDiscard discard; ///< Selects which packets can be discarded at will and do not need to be demuxed. /** * sample aspect ratio (0 if unknown) * - encoding: Set by user. * - decoding: Set by libavformat. */ AVRational sample_aspect_ratio; AVDictionary *metadata; /** * Average framerate */ AVRational avg_frame_rate; /** * For streams with AV_DISPOSITION_ATTACHED_PIC disposition, this packet * will contain the attached picture. * * decoding: set by libavformat, must not be modified by the caller. * encoding: unused */ AVPacket attached_pic; /***************************************************************** * All fields below this line are not part of the public API. They * may not be used outside of libavformat and can be changed and * removed at will. * New public fields should be added right above. ***************************************************************** */ /** * Stream information used internally by av_find_stream_info() */ #define MAX_STD_TIMEBASES (60*12+6) struct { int64_t last_dts; int64_t duration_gcd; int duration_count; double duration_error[2][2][MAX_STD_TIMEBASES]; int64_t codec_info_duration; int found_decoder; /** * Those are used for average framerate estimation. */ int64_t fps_first_dts; int fps_first_dts_idx; int64_t fps_last_dts; int fps_last_dts_idx; } *info; int pts_wrap_bits; /**< number of bits in pts (used for wrapping control) */ // Timestamp generation support: /** * Timestamp corresponding to the last dts sync point. * * Initialized when AVCodecParserContext.dts_sync_point >= 0 and * a DTS is received from the underlying container. Otherwise set to * AV_NOPTS_VALUE by default. */ int64_t reference_dts; int64_t first_dts; int64_t cur_dts; int64_t last_IP_pts; int last_IP_duration; /** * Number of packets to buffer for codec probing */ #define MAX_PROBE_PACKETS 2500 int probe_packets; /** * Number of frames that have been demuxed during av_find_stream_info() */ int codec_info_nb_frames; /** * Stream Identifier * This is the MPEG-TS stream identifier +1 * 0 means unknown */ int stream_identifier; int64_t interleaver_chunk_size; int64_t interleaver_chunk_duration; /* av_read_frame() support */ enum AVStreamParseType need_parsing; struct AVCodecParserContext *parser; /** * last packet in packet_buffer for this stream when muxing. */ struct AVPacketList *last_in_packet_buffer; AVProbeData probe_data; #define MAX_REORDER_DELAY 16 int64_t pts_buffer[MAX_REORDER_DELAY+1]; AVIndexEntry *index_entries; /**< Only used if the format does not support seeking natively. */ int nb_index_entries; unsigned int index_entries_allocated_size; /** * flag to indicate that probing is requested * NOT PART OF PUBLIC API */ int request_probe; /** * Indicates that everything up to the next keyframe * should be discarded. */ int skip_to_keyframe; /** * Number of samples to skip at the start of the frame decoded from the next packet. */ int skip_samples; /** * Number of internally decoded frames, used internally in libavformat, do not access * its lifetime differs from info which is why its not in that structure. */ int nb_decoded_frames; } AVStream; #define AV_PROGRAM_RUNNING 1 /** * New fields can be added to the end with minor version bumps. * Removal, reordering and changes to existing fields require a major * version bump. * sizeof(AVProgram) must not be used outside libav*. */ typedef struct AVProgram { int id; int flags; enum AVDiscard discard; ///< selects which program to discard and which to feed to the caller unsigned int *stream_index; unsigned int nb_stream_indexes; AVDictionary *metadata; int program_num; int pmt_pid; int pcr_pid; } AVProgram; #define AVFMTCTX_NOHEADER 0x0001 /**< signal that no header is present (streams are added dynamically) */ typedef struct AVChapter { int id; ///< unique ID to identify the chapter AVRational time_base; ///< time base in which the start/end timestamps are specified int64_t start, end; ///< chapter start/end time in time_base units AVDictionary *metadata; } AVChapter; /** * The duration of a video can be estimated through various ways, and this enum can be used * to know how the duration was estimated. */ enum AVDurationEstimationMethod { AVFMT_DURATION_FROM_PTS, ///< Duration accurately estimated from PTSes AVFMT_DURATION_FROM_STREAM, ///< Duration estimated from a stream with a known duration AVFMT_DURATION_FROM_BITRATE ///< Duration estimated from bitrate (less accurate) }; /** * Format I/O context. * New fields can be added to the end with minor version bumps. * Removal, reordering and changes to existing fields require a major * version bump. * sizeof(AVFormatContext) must not be used outside libav*, use * avformat_alloc_context() to create an AVFormatContext. */ typedef struct AVFormatContext { /** * A class for logging and AVOptions. Set by avformat_alloc_context(). * Exports (de)muxer private options if they exist. */ const AVClass *av_class; /** * Can only be iformat or oformat, not both at the same time. * * decoding: set by avformat_open_input(). * encoding: set by the user. */ struct AVInputFormat *iformat; struct AVOutputFormat *oformat; /** * Format private data. This is an AVOptions-enabled struct * if and only if iformat/oformat.priv_class is not NULL. */ void *priv_data; /** * I/O context. * * decoding: either set by the user before avformat_open_input() (then * the user must close it manually) or set by avformat_open_input(). * encoding: set by the user. * * Do NOT set this field if AVFMT_NOFILE flag is set in * iformat/oformat.flags. In such a case, the (de)muxer will handle * I/O in some other way and this field will be NULL. */ AVIOContext *pb; /* stream info */ int ctx_flags; /**< Format-specific flags, see AVFMTCTX_xx */ /** * A list of all streams in the file. New streams are created with * avformat_new_stream(). * * decoding: streams are created by libavformat in avformat_open_input(). * If AVFMTCTX_NOHEADER is set in ctx_flags, then new streams may also * appear in av_read_frame(). * encoding: streams are created by the user before avformat_write_header(). */ unsigned int nb_streams; AVStream **streams; char filename[1024]; /**< input or output filename */ /** * Decoding: position of the first frame of the component, in * AV_TIME_BASE fractional seconds. NEVER set this value directly: * It is deduced from the AVStream values. */ int64_t start_time; /** * Decoding: duration of the stream, in AV_TIME_BASE fractional * seconds. Only set this value if you know none of the individual stream * durations and also do not set any of them. This is deduced from the * AVStream values if not set. */ int64_t duration; /** * Decoding: total stream bitrate in bit/s, 0 if not * available. Never set it directly if the file_size and the * duration are known as FFmpeg can compute it automatically. */ int bit_rate; unsigned int packet_size; int max_delay; int flags; #define AVFMT_FLAG_GENPTS 0x0001 ///< Generate missing pts even if it requires parsing future frames. #define AVFMT_FLAG_IGNIDX 0x0002 ///< Ignore index. #define AVFMT_FLAG_NONBLOCK 0x0004 ///< Do not block when reading packets from input. #define AVFMT_FLAG_IGNDTS 0x0008 ///< Ignore DTS on frames that contain both DTS & PTS #define AVFMT_FLAG_NOFILLIN 0x0010 ///< Do not infer any values from other values, just return what is stored in the container #define AVFMT_FLAG_NOPARSE 0x0020 ///< Do not use AVParsers, you also must set AVFMT_FLAG_NOFILLIN as the fillin code works on frames and no parsing -> no frames. Also seeking to frames can not work if parsing to find frame boundaries has been disabled #define AVFMT_FLAG_NOBUFFER 0x0040 ///< Do not buffer frames when possible #define AVFMT_FLAG_CUSTOM_IO 0x0080 ///< The caller has supplied a custom AVIOContext, don't avio_close() it. #define AVFMT_FLAG_DISCARD_CORRUPT 0x0100 ///< Discard frames marked corrupted #define AVFMT_FLAG_MP4A_LATM 0x8000 ///< Enable RTP MP4A-LATM payload #define AVFMT_FLAG_SORT_DTS 0x10000 ///< try to interleave outputted packets by dts (using this flag can slow demuxing down) #define AVFMT_FLAG_PRIV_OPT 0x20000 ///< Enable use of private options by delaying codec open (this could be made default once all code is converted) #define AVFMT_FLAG_KEEP_SIDE_DATA 0x40000 ///< Don't merge side data but keep it separate. /** * decoding: size of data to probe; encoding: unused. */ unsigned int probesize; /** * decoding: maximum time (in AV_TIME_BASE units) during which the input should * be analyzed in avformat_find_stream_info(). */ int max_analyze_duration; const uint8_t *key; int keylen; unsigned int nb_programs; AVProgram **programs; /** * Forced video codec_id. * Demuxing: Set by user. */ enum AVCodecID video_codec_id; /** * Forced audio codec_id. * Demuxing: Set by user. */ enum AVCodecID audio_codec_id; /** * Forced subtitle codec_id. * Demuxing: Set by user. */ enum AVCodecID subtitle_codec_id; /** * Maximum amount of memory in bytes to use for the index of each stream. * If the index exceeds this size, entries will be discarded as * needed to maintain a smaller size. This can lead to slower or less * accurate seeking (depends on demuxer). * Demuxers for which a full in-memory index is mandatory will ignore * this. * muxing : unused * demuxing: set by user */ unsigned int max_index_size; /** * Maximum amount of memory in bytes to use for buffering frames * obtained from realtime capture devices. */ unsigned int max_picture_buffer; unsigned int nb_chapters; AVChapter **chapters; AVDictionary *metadata; /** * Start time of the stream in real world time, in microseconds * since the unix epoch (00:00 1st January 1970). That is, pts=0 * in the stream was captured at this real world time. * - encoding: Set by user. * - decoding: Unused. */ int64_t start_time_realtime; /** * decoding: number of frames used to probe fps */ int fps_probe_size; /** * Error recognition; higher values will detect more errors but may * misdetect some more or less valid parts as errors. * - encoding: unused * - decoding: Set by user. */ int error_recognition; /** * Custom interrupt callbacks for the I/O layer. * * decoding: set by the user before avformat_open_input(). * encoding: set by the user before avformat_write_header() * (mainly useful for AVFMT_NOFILE formats). The callback * should also be passed to avio_open2() if it's used to * open the file. */ AVIOInterruptCB interrupt_callback; /** * Flags to enable debugging. */ int debug; #define FF_FDEBUG_TS 0x0001 /** * Transport stream id. * This will be moved into demuxer private options. Thus no API/ABI compatibility */ int ts_id; /** * Audio preload in microseconds. * Note, not all formats support this and unpredictable things may happen if it is used when not supported. * - encoding: Set by user via AVOptions (NO direct access) * - decoding: unused */ int audio_preload; /** * Max chunk time in microseconds. * Note, not all formats support this and unpredictable things may happen if it is used when not supported. * - encoding: Set by user via AVOptions (NO direct access) * - decoding: unused */ int max_chunk_duration; /** * Max chunk size in bytes * Note, not all formats support this and unpredictable things may happen if it is used when not supported. * - encoding: Set by user via AVOptions (NO direct access) * - decoding: unused */ int max_chunk_size; /** * forces the use of wallclock timestamps as pts/dts of packets * This has undefined results in the presence of B frames. * - encoding: unused * - decoding: Set by user via AVOptions (NO direct access) */ int use_wallclock_as_timestamps; /***************************************************************** * All fields below this line are not part of the public API. They * may not be used outside of libavformat and can be changed and * removed at will. * New public fields should be added right above. ***************************************************************** */ /** * This buffer is only needed when packets were already buffered but * not decoded, for example to get the codec parameters in MPEG * streams. */ struct AVPacketList *packet_buffer; struct AVPacketList *packet_buffer_end; /* av_seek_frame() support */ int64_t data_offset; /**< offset of the first packet */ /** * Raw packets from the demuxer, prior to parsing and decoding. * This buffer is used for buffering packets until the codec can * be identified, as parsing cannot be done without knowing the * codec. */ struct AVPacketList *raw_packet_buffer; struct AVPacketList *raw_packet_buffer_end; /** * Packets split by the parser get queued here. */ struct AVPacketList *parse_queue; struct AVPacketList *parse_queue_end; /** * Remaining size available for raw_packet_buffer, in bytes. */ #define RAW_PACKET_BUFFER_SIZE 2500000 int raw_packet_buffer_remaining_size; int avio_flags; /** * The duration field can be estimated through various ways, and this field can be used * to know how the duration was estimated. */ enum AVDurationEstimationMethod duration_estimation_method; } AVFormatContext; /** * Returns the method used to set ctx->duration. * * @return AVFMT_DURATION_FROM_PTS, AVFMT_DURATION_FROM_STREAM, or AVFMT_DURATION_FROM_BITRATE. */ enum AVDurationEstimationMethod av_fmt_ctx_get_duration_estimation_method(const AVFormatContext* ctx); typedef struct AVPacketList { AVPacket pkt; struct AVPacketList *next; } AVPacketList; /** * @defgroup lavf_core Core functions * @ingroup libavf * * Functions for querying libavformat capabilities, allocating core structures, * etc. * @{ */ /** * Return the LIBAVFORMAT_VERSION_INT constant. */ unsigned avformat_version(void); /** * Return the libavformat build-time configuration. */ const char *avformat_configuration(void); /** * Return the libavformat license. */ const char *avformat_license(void); /** * Initialize libavformat and register all the muxers, demuxers and * protocols. If you do not call this function, then you can select * exactly which formats you want to support. * * @see av_register_input_format() * @see av_register_output_format() * @see av_register_protocol() */ void av_register_all(void); void av_register_input_format(AVInputFormat *format); void av_register_output_format(AVOutputFormat *format); /** * Do global initialization of network components. This is optional, * but recommended, since it avoids the overhead of implicitly * doing the setup for each session. * * Calling this function will become mandatory if using network * protocols at some major version bump. */ int avformat_network_init(void); /** * Undo the initialization done by avformat_network_init. */ int avformat_network_deinit(void); /** * If f is NULL, returns the first registered input format, * if f is non-NULL, returns the next registered input format after f * or NULL if f is the last one. */ AVInputFormat *av_iformat_next(AVInputFormat *f); /** * If f is NULL, returns the first registered output format, * if f is non-NULL, returns the next registered output format after f * or NULL if f is the last one. */ AVOutputFormat *av_oformat_next(AVOutputFormat *f); /** * Allocate an AVFormatContext. * avformat_free_context() can be used to free the context and everything * allocated by the framework within it. */ AVFormatContext *avformat_alloc_context(void); /** * Free an AVFormatContext and all its streams. * @param s context to free */ void avformat_free_context(AVFormatContext *s); /** * Get the AVClass for AVFormatContext. It can be used in combination with * AV_OPT_SEARCH_FAKE_OBJ for examining options. * * @see av_opt_find(). */ const AVClass *avformat_get_class(void); /** * Add a new stream to a media file. * * When demuxing, it is called by the demuxer in read_header(). If the * flag AVFMTCTX_NOHEADER is set in s.ctx_flags, then it may also * be called in read_packet(). * * When muxing, should be called by the user before avformat_write_header(). * * @param c If non-NULL, the AVCodecContext corresponding to the new stream * will be initialized to use this codec. This is needed for e.g. codec-specific * defaults to be set, so codec should be provided if it is known. * * @return newly created stream or NULL on error. */ AVStream *avformat_new_stream(AVFormatContext *s, AVCodec *c); AVProgram *av_new_program(AVFormatContext *s, int id); /** * @} */ #if FF_API_PKT_DUMP attribute_deprecated void av_pkt_dump(FILE *f, AVPacket *pkt, int dump_payload); attribute_deprecated void av_pkt_dump_log(void *avcl, int level, AVPacket *pkt, int dump_payload); #endif #if FF_API_ALLOC_OUTPUT_CONTEXT /** * @deprecated deprecated in favor of avformat_alloc_output_context2() */ attribute_deprecated AVFormatContext *avformat_alloc_output_context(const char *format, AVOutputFormat *oformat, const char *filename); #endif /** * Allocate an AVFormatContext for an output format. * avformat_free_context() can be used to free the context and * everything allocated by the framework within it. * * @param *ctx is set to the created format context, or to NULL in * case of failure * @param oformat format to use for allocating the context, if NULL * format_name and filename are used instead * @param format_name the name of output format to use for allocating the * context, if NULL filename is used instead * @param filename the name of the filename to use for allocating the * context, may be NULL * @return >= 0 in case of success, a negative AVERROR code in case of * failure */ int avformat_alloc_output_context2(AVFormatContext **ctx, AVOutputFormat *oformat, const char *format_name, const char *filename); /** * @addtogroup lavf_decoding * @{ */ /** * Find AVInputFormat based on the short name of the input format. */ AVInputFormat *av_find_input_format(const char *short_name); /** * Guess the file format. * * @param is_opened Whether the file is already opened; determines whether * demuxers with or without AVFMT_NOFILE are probed. */ AVInputFormat *av_probe_input_format(AVProbeData *pd, int is_opened); /** * Guess the file format. * * @param is_opened Whether the file is already opened; determines whether * demuxers with or without AVFMT_NOFILE are probed. * @param score_max A probe score larger that this is required to accept a * detection, the variable is set to the actual detection * score afterwards. * If the score is <= AVPROBE_SCORE_MAX / 4 it is recommended * to retry with a larger probe buffer. */ AVInputFormat *av_probe_input_format2(AVProbeData *pd, int is_opened, int *score_max); /** * Guess the file format. * * @param is_opened Whether the file is already opened; determines whether * demuxers with or without AVFMT_NOFILE are probed. * @param score_ret The score of the best detection. */ AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened, int *score_ret); /** * Probe a bytestream to determine the input format. Each time a probe returns * with a score that is too low, the probe buffer size is increased and another * attempt is made. When the maximum probe size is reached, the input format * with the highest score is returned. * * @param pb the bytestream to probe * @param fmt the input format is put here * @param filename the filename of the stream * @param logctx the log context * @param offset the offset within the bytestream to probe from * @param max_probe_size the maximum probe buffer size (zero for default) * @return 0 in case of success, a negative value corresponding to an * AVERROR code otherwise */ int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt, const char *filename, void *logctx, unsigned int offset, unsigned int max_probe_size); /** * Open an input stream and read the header. The codecs are not opened. * The stream must be closed with av_close_input_file(). * * @param ps Pointer to user-supplied AVFormatContext (allocated by avformat_alloc_context). * May be a pointer to NULL, in which case an AVFormatContext is allocated by this * function and written into ps. * Note that a user-supplied AVFormatContext will be freed on failure. * @param filename Name of the stream to open. * @param fmt If non-NULL, this parameter forces a specific input format. * Otherwise the format is autodetected. * @param options A dictionary filled with AVFormatContext and demuxer-private options. * On return this parameter will be destroyed and replaced with a dict containing * options that were not found. May be NULL. * * @return 0 on success, a negative AVERROR on failure. * * @note If you want to use custom IO, preallocate the format context and set its pb field. */ int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputFormat *fmt, AVDictionary **options); attribute_deprecated int av_demuxer_open(AVFormatContext *ic); #if FF_API_FORMAT_PARAMETERS /** * Read packets of a media file to get stream information. This * is useful for file formats with no headers such as MPEG. This * function also computes the real framerate in case of MPEG-2 repeat * frame mode. * The logical file position is not changed by this function; * examined packets may be buffered for later processing. * * @param ic media file handle * @return >=0 if OK, AVERROR_xxx on error * @todo Let the user decide somehow what information is needed so that * we do not waste time getting stuff the user does not need. * * @deprecated use avformat_find_stream_info. */ attribute_deprecated int av_find_stream_info(AVFormatContext *ic); #endif /** * Read packets of a media file to get stream information. This * is useful for file formats with no headers such as MPEG. This * function also computes the real framerate in case of MPEG-2 repeat * frame mode. * The logical file position is not changed by this function; * examined packets may be buffered for later processing. * * @param ic media file handle * @param options If non-NULL, an ic.nb_streams long array of pointers to * dictionaries, where i-th member contains options for * codec corresponding to i-th stream. * On return each dictionary will be filled with options that were not found. * @return >=0 if OK, AVERROR_xxx on error * * @note this function isn't guaranteed to open all the codecs, so * options being non-empty at return is a perfectly normal behavior. * * @todo Let the user decide somehow what information is needed so that * we do not waste time getting stuff the user does not need. */ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options); /** * Find the programs which belong to a given stream. * * @param ic media file handle * @param last the last found program, the search will start after this * program, or from the beginning if it is NULL * @param s stream index * @return the next program which belongs to s, NULL if no program is found or * the last program is not among the programs of ic. */ AVProgram *av_find_program_from_stream(AVFormatContext *ic, AVProgram *last, int s); /** * Find the "best" stream in the file. * The best stream is determined according to various heuristics as the most * likely to be what the user expects. * If the decoder parameter is non-NULL, av_find_best_stream will find the * default decoder for the stream's codec; streams for which no decoder can * be found are ignored. * * @param ic media file handle * @param type stream type: video, audio, subtitles, etc. * @param wanted_stream_nb user-requested stream number, * or -1 for automatic selection * @param related_stream try to find a stream related (eg. in the same * program) to this one, or -1 if none * @param decoder_ret if non-NULL, returns the decoder for the * selected stream * @param flags flags; none are currently defined * @return the non-negative stream number in case of success, * AVERROR_STREAM_NOT_FOUND if no stream with the requested type * could be found, * AVERROR_DECODER_NOT_FOUND if streams were found but no decoder * @note If av_find_best_stream returns successfully and decoder_ret is not * NULL, then *decoder_ret is guaranteed to be set to a valid AVCodec. */ int av_find_best_stream(AVFormatContext *ic, enum AVMediaType type, int wanted_stream_nb, int related_stream, AVCodec **decoder_ret, int flags); #if FF_API_READ_PACKET /** * @deprecated use AVFMT_FLAG_NOFILLIN | AVFMT_FLAG_NOPARSE to read raw * unprocessed packets * * Read a transport packet from a media file. * * This function is obsolete and should never be used. * Use av_read_frame() instead. * * @param s media file handle * @param pkt is filled * @return 0 if OK, AVERROR_xxx on error */ attribute_deprecated int av_read_packet(AVFormatContext *s, AVPacket *pkt); #endif /** * Return the next frame of a stream. * This function returns what is stored in the file, and does not validate * that what is there are valid frames for the decoder. It will split what is * stored in the file into frames and return one for each call. It will not * omit invalid data between valid frames so as to give the decoder the maximum * information possible for decoding. * * The returned packet is valid * until the next av_read_frame() or until av_close_input_file() and * must be freed with av_free_packet. For video, the packet contains * exactly one frame. For audio, it contains an integer number of * frames if each frame has a known fixed size (e.g. PCM or ADPCM * data). If the audio frames have a variable size (e.g. MPEG audio), * then it contains one frame. * * pkt->pts, pkt->dts and pkt->duration are always set to correct * values in AVStream.time_base units (and guessed if the format cannot * provide them). pkt->pts can be AV_NOPTS_VALUE if the video format * has B-frames, so it is better to rely on pkt->dts if you do not * decompress the payload. * * @return 0 if OK, < 0 on error or end of file */ int av_read_frame(AVFormatContext *s, AVPacket *pkt); /** * Seek to the keyframe at timestamp. * 'timestamp' in 'stream_index'. * @param stream_index If stream_index is (-1), a default * stream is selected, and timestamp is automatically converted * from AV_TIME_BASE units to the stream specific time_base. * @param timestamp Timestamp in AVStream.time_base units * or, if no stream is specified, in AV_TIME_BASE units. * @param flags flags which select direction and seeking mode * @return >= 0 on success */ int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, int flags); /** * Seek to timestamp ts. * Seeking will be done so that the point from which all active streams * can be presented successfully will be closest to ts and within min/max_ts. * Active streams are all streams that have AVStream.discard < AVDISCARD_ALL. * * If flags contain AVSEEK_FLAG_BYTE, then all timestamps are in bytes and * are the file position (this may not be supported by all demuxers). * If flags contain AVSEEK_FLAG_FRAME, then all timestamps are in frames * in the stream with stream_index (this may not be supported by all demuxers). * Otherwise all timestamps are in units of the stream selected by stream_index * or if stream_index is -1, in AV_TIME_BASE units. * If flags contain AVSEEK_FLAG_ANY, then non-keyframes are treated as * keyframes (this may not be supported by all demuxers). * * @param stream_index index of the stream which is used as time base reference * @param min_ts smallest acceptable timestamp * @param ts target timestamp * @param max_ts largest acceptable timestamp * @param flags flags * @return >=0 on success, error code otherwise * * @note This is part of the new seek API which is still under construction. * Thus do not use this yet. It may change at any time, do not expect * ABI compatibility yet! */ int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags); /** * Start playing a network-based stream (e.g. RTSP stream) at the * current position. */ int av_read_play(AVFormatContext *s); /** * Pause a network-based stream (e.g. RTSP stream). * * Use av_read_play() to resume it. */ int av_read_pause(AVFormatContext *s); #if FF_API_CLOSE_INPUT_FILE /** * @deprecated use avformat_close_input() * Close a media file (but not its codecs). * * @param s media file handle */ attribute_deprecated void av_close_input_file(AVFormatContext *s); #endif /** * Close an opened input AVFormatContext. Free it and all its contents * and set *s to NULL. */ void avformat_close_input(AVFormatContext **s); /** * @} */ #if FF_API_NEW_STREAM /** * Add a new stream to a media file. * * Can only be called in the read_header() function. If the flag * AVFMTCTX_NOHEADER is in the format context, then new streams * can be added in read_packet too. * * @param s media file handle * @param id file-format-dependent stream ID */ attribute_deprecated AVStream *av_new_stream(AVFormatContext *s, int id); #endif #if FF_API_SET_PTS_INFO /** * @deprecated this function is not supposed to be called outside of lavf */ attribute_deprecated void av_set_pts_info(AVStream *s, int pts_wrap_bits, unsigned int pts_num, unsigned int pts_den); #endif #define AVSEEK_FLAG_BACKWARD 1 ///< seek backward #define AVSEEK_FLAG_BYTE 2 ///< seeking based on position in bytes #define AVSEEK_FLAG_ANY 4 ///< seek to any frame, even non-keyframes #define AVSEEK_FLAG_FRAME 8 ///< seeking based on frame number /** * @addtogroup lavf_encoding * @{ */ /** * Allocate the stream private data and write the stream header to * an output media file. * * @param s Media file handle, must be allocated with avformat_alloc_context(). * Its oformat field must be set to the desired output format; * Its pb field must be set to an already openened AVIOContext. * @param options An AVDictionary filled with AVFormatContext and muxer-private options. * On return this parameter will be destroyed and replaced with a dict containing * options that were not found. May be NULL. * * @return 0 on success, negative AVERROR on failure. * * @see av_opt_find, av_dict_set, avio_open, av_oformat_next. */ int avformat_write_header(AVFormatContext *s, AVDictionary **options); /** * Write a packet to an output media file. * * The packet shall contain one audio or video frame. * The packet must be correctly interleaved according to the container * specification, if not then av_interleaved_write_frame must be used. * * @param s media file handle * @param pkt The packet, which contains the stream_index, buf/buf_size, * dts/pts, ... * This can be NULL (at any time, not just at the end), in * order to immediately flush data buffered within the muxer, * for muxers that buffer up data internally before writing it * to the output. * @return < 0 on error, = 0 if OK, 1 if flushed and there is no more data to flush */ int av_write_frame(AVFormatContext *s, AVPacket *pkt); /** * Write a packet to an output media file ensuring correct interleaving. * * The packet must contain one audio or video frame. * If the packets are already correctly interleaved, the application should * call av_write_frame() instead as it is slightly faster. It is also important * to keep in mind that completely non-interleaved input will need huge amounts * of memory to interleave with this, so it is preferable to interleave at the * demuxer level. * * @param s media file handle * @param pkt The packet containing the data to be written. Libavformat takes * ownership of the data and will free it when it sees fit using the packet's * This can be NULL (at any time, not just at the end), to flush the * interleaving queues. * @ref AVPacket.destruct "destruct" field. The caller must not access the data * after this function returns, as it may already be freed. * Packet's @ref AVPacket.stream_index "stream_index" field must be set to the * index of the corresponding stream in @ref AVFormatContext.streams * "s.streams". * It is very strongly recommended that timing information (@ref AVPacket.pts * "pts", @ref AVPacket.dts "dts" @ref AVPacket.duration "duration") is set to * correct values. * * @return 0 on success, a negative AVERROR on error. */ int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt); #if FF_API_INTERLEAVE_PACKET /** * @deprecated this function was never meant to be called by the user * programs. */ attribute_deprecated int av_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int flush); #endif /** * Write the stream trailer to an output media file and free the * file private data. * * May only be called after a successful call to av_write_header. * * @param s media file handle * @return 0 if OK, AVERROR_xxx on error */ int av_write_trailer(AVFormatContext *s); /** * Return the output format in the list of registered output formats * which best matches the provided parameters, or return NULL if * there is no match. * * @param short_name if non-NULL checks if short_name matches with the * names of the registered formats * @param filename if non-NULL checks if filename terminates with the * extensions of the registered formats * @param mime_type if non-NULL checks if mime_type matches with the * MIME type of the registered formats */ AVOutputFormat *av_guess_format(const char *short_name, const char *filename, const char *mime_type); /** * Guess the codec ID based upon muxer and filename. */ enum AVCodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name, const char *filename, const char *mime_type, enum AVMediaType type); /** * Get timing information for the data currently output. * The exact meaning of "currently output" depends on the format. * It is mostly relevant for devices that have an internal buffer and/or * work in real time. * @param s media file handle * @param stream stream in the media file * @param dts[out] DTS of the last packet output for the stream, in stream * time_base units * @param wall[out] absolute time when that packet whas output, * in microsecond * @return 0 if OK, AVERROR(ENOSYS) if the format does not support it * Note: some formats or devices may not allow to measure dts and wall * atomically. */ int av_get_output_timestamp(struct AVFormatContext *s, int stream, int64_t *dts, int64_t *wall); /** * @} */ /** * @defgroup lavf_misc Utility functions * @ingroup libavf * @{ * * Miscellaneous utility functions related to both muxing and demuxing * (or neither). */ /** * Send a nice hexadecimal dump of a buffer to the specified file stream. * * @param f The file stream pointer where the dump should be sent to. * @param buf buffer * @param size buffer size * * @see av_hex_dump_log, av_pkt_dump2, av_pkt_dump_log2 */ void av_hex_dump(FILE *f, uint8_t *buf, int size); /** * Send a nice hexadecimal dump of a buffer to the log. * * @param avcl A pointer to an arbitrary struct of which the first field is a * pointer to an AVClass struct. * @param level The importance level of the message, lower values signifying * higher importance. * @param buf buffer * @param size buffer size * * @see av_hex_dump, av_pkt_dump2, av_pkt_dump_log2 */ void av_hex_dump_log(void *avcl, int level, uint8_t *buf, int size); /** * Send a nice dump of a packet to the specified file stream. * * @param f The file stream pointer where the dump should be sent to. * @param pkt packet to dump * @param dump_payload True if the payload must be displayed, too. * @param st AVStream that the packet belongs to */ void av_pkt_dump2(FILE *f, AVPacket *pkt, int dump_payload, AVStream *st); /** * Send a nice dump of a packet to the log. * * @param avcl A pointer to an arbitrary struct of which the first field is a * pointer to an AVClass struct. * @param level The importance level of the message, lower values signifying * higher importance. * @param pkt packet to dump * @param dump_payload True if the payload must be displayed, too. * @param st AVStream that the packet belongs to */ void av_pkt_dump_log2(void *avcl, int level, AVPacket *pkt, int dump_payload, AVStream *st); /** * Get the AVCodecID for the given codec tag tag. * If no codec id is found returns AV_CODEC_ID_NONE. * * @param tags list of supported codec_id-codec_tag pairs, as stored * in AVInputFormat.codec_tag and AVOutputFormat.codec_tag */ enum AVCodecID av_codec_get_id(const struct AVCodecTag * const *tags, unsigned int tag); /** * Get the codec tag for the given codec id id. * If no codec tag is found returns 0. * * @param tags list of supported codec_id-codec_tag pairs, as stored * in AVInputFormat.codec_tag and AVOutputFormat.codec_tag */ unsigned int av_codec_get_tag(const struct AVCodecTag * const *tags, enum AVCodecID id); int av_find_default_stream_index(AVFormatContext *s); /** * Get the index for a specific timestamp. * @param flags if AVSEEK_FLAG_BACKWARD then the returned index will correspond * to the timestamp which is <= the requested one, if backward * is 0, then it will be >= * if AVSEEK_FLAG_ANY seek to any frame, only keyframes otherwise * @return < 0 if no such timestamp could be found */ int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags); /** * Add an index entry into a sorted list. Update the entry if the list * already contains it. * * @param timestamp timestamp in the time base of the given stream */ int av_add_index_entry(AVStream *st, int64_t pos, int64_t timestamp, int size, int distance, int flags); /** * Split a URL string into components. * * The pointers to buffers for storing individual components may be null, * in order to ignore that component. Buffers for components not found are * set to empty strings. If the port is not found, it is set to a negative * value. * * @param proto the buffer for the protocol * @param proto_size the size of the proto buffer * @param authorization the buffer for the authorization * @param authorization_size the size of the authorization buffer * @param hostname the buffer for the host name * @param hostname_size the size of the hostname buffer * @param port_ptr a pointer to store the port number in * @param path the buffer for the path * @param path_size the size of the path buffer * @param url the URL to split */ void av_url_split(char *proto, int proto_size, char *authorization, int authorization_size, char *hostname, int hostname_size, int *port_ptr, char *path, int path_size, const char *url); void av_dump_format(AVFormatContext *ic, int index, const char *url, int is_output); /** * Return in 'buf' the path with '%d' replaced by a number. * * Also handles the '%0nd' format where 'n' is the total number * of digits and '%%'. * * @param buf destination buffer * @param buf_size destination buffer size * @param path numbered sequence string * @param number frame number * @return 0 if OK, -1 on format error */ int av_get_frame_filename(char *buf, int buf_size, const char *path, int number); /** * Check whether filename actually is a numbered sequence generator. * * @param filename possible numbered sequence string * @return 1 if a valid numbered sequence string, 0 otherwise */ int av_filename_number_test(const char *filename); /** * Generate an SDP for an RTP session. * * @param ac array of AVFormatContexts describing the RTP streams. If the * array is composed by only one context, such context can contain * multiple AVStreams (one AVStream per RTP stream). Otherwise, * all the contexts in the array (an AVCodecContext per RTP stream) * must contain only one AVStream. * @param n_files number of AVCodecContexts contained in ac * @param buf buffer where the SDP will be stored (must be allocated by * the caller) * @param size the size of the buffer * @return 0 if OK, AVERROR_xxx on error */ int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size); /** * Return a positive value if the given filename has one of the given * extensions, 0 otherwise. * * @param extensions a comma-separated list of filename extensions */ int av_match_ext(const char *filename, const char *extensions); /** * Test if the given container can store a codec. * * @param std_compliance standards compliance level, one of FF_COMPLIANCE_* * * @return 1 if codec with ID codec_id can be stored in ofmt, 0 if it cannot. * A negative number if this information is not available. */ int avformat_query_codec(AVOutputFormat *ofmt, enum AVCodecID codec_id, int std_compliance); /** * @defgroup riff_fourcc RIFF FourCCs * @{ * Get the tables mapping RIFF FourCCs to libavcodec AVCodecIDs. The tables are * meant to be passed to av_codec_get_id()/av_codec_get_tag() as in the * following code: * @code * uint32_t tag = MKTAG('H', '2', '6', '4'); * const struct AVCodecTag *table[] = { avformat_get_riff_video_tags(), 0 }; * enum AVCodecID id = av_codec_get_id(table, tag); * @endcode */ /** * @return the table mapping RIFF FourCCs for video to libavcodec AVCodecID. */ const struct AVCodecTag *avformat_get_riff_video_tags(void); /** * @return the table mapping RIFF FourCCs for audio to AVCodecID. */ const struct AVCodecTag *avformat_get_riff_audio_tags(void); /** * @} */ /** * Guess the sample aspect ratio of a frame, based on both the stream and the * frame aspect ratio. * * Since the frame aspect ratio is set by the codec but the stream aspect ratio * is set by the demuxer, these two may not be equal. This function tries to * return the value that you should use if you would like to display the frame. * * Basic logic is to use the stream aspect ratio if it is set to something sane * otherwise use the frame aspect ratio. This way a container setting, which is * usually easy to modify can override the coded value in the frames. * * @param format the format context which the stream is part of * @param stream the stream which the frame is part of * @param frame the frame with the aspect ratio to be determined * @return the guessed (valid) sample_aspect_ratio, 0/1 if no idea */ AVRational av_guess_sample_aspect_ratio(AVFormatContext *format, AVStream *stream, AVFrame *frame); /** * Check if the stream st contained in s is matched by the stream specifier * spec. * * See the "stream specifiers" chapter in the documentation for the syntax * of spec. * * @return >0 if st is matched by spec; * 0 if st is not matched by spec; * AVERROR code if spec is invalid * * @note A stream specifier can match several streams in the format. */ int avformat_match_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec); void avformat_queue_attached_pictures(AVFormatContext *s); /** * @} */ #endif /* AVFORMAT_AVFORMAT_H */
75,568
36.299605
257
h
cba-pipeline-public
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libavformat/avio.h
/* * copyright (c) 2001 Fabrice Bellard * * 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 AVFORMAT_AVIO_H #define AVFORMAT_AVIO_H /** * @file * @ingroup lavf_io * Buffered I/O operations */ #include <stdint.h> #include "libavutil/common.h" #include "libavutil/dict.h" #include "libavutil/log.h" #include "libavformat/version.h" #define AVIO_SEEKABLE_NORMAL 0x0001 /**< Seeking works like for a local file */ /** * Callback for checking whether to abort blocking functions. * AVERROR_EXIT is returned in this case by the interrupted * function. During blocking operations, callback is called with * opaque as parameter. If the callback returns 1, the * blocking operation will be aborted. * * No members can be added to this struct without a major bump, if * new elements have been added after this struct in AVFormatContext * or AVIOContext. */ typedef struct { int (*callback)(void*); void *opaque; } AVIOInterruptCB; /** * Bytestream IO Context. * New fields can be added to the end with minor version bumps. * Removal, reordering and changes to existing fields require a major * version bump. * sizeof(AVIOContext) must not be used outside libav*. * * @note None of the function pointers in AVIOContext should be called * directly, they should only be set by the client application * when implementing custom I/O. Normally these are set to the * function pointers specified in avio_alloc_context() */ typedef struct { /** * A class for private options. * * If this AVIOContext is created by avio_open2(), av_class is set and * passes the options down to protocols. * * If this AVIOContext is manually allocated, then av_class may be set by * the caller. * * warning -- this field can be NULL, be sure to not pass this AVIOContext * to any av_opt_* functions in that case. */ const AVClass *av_class; unsigned char *buffer; /**< Start of the buffer. */ int buffer_size; /**< Maximum buffer size */ unsigned char *buf_ptr; /**< Current position in the buffer */ unsigned char *buf_end; /**< End of the data, may be less than buffer+buffer_size if the read function returned less data than requested, e.g. for streams where no more data has been received yet. */ void *opaque; /**< A private pointer, passed to the read/write/seek/... functions. */ int (*read_packet)(void *opaque, uint8_t *buf, int buf_size); int (*write_packet)(void *opaque, uint8_t *buf, int buf_size); int64_t (*seek)(void *opaque, int64_t offset, int whence); int64_t pos; /**< position in the file of the current buffer */ int must_flush; /**< true if the next seek should flush */ int eof_reached; /**< true if eof reached */ int write_flag; /**< true if open for writing */ int max_packet_size; unsigned long checksum; unsigned char *checksum_ptr; unsigned long (*update_checksum)(unsigned long checksum, const uint8_t *buf, unsigned int size); int error; /**< contains the error code or 0 if no error happened */ /** * Pause or resume playback for network streaming protocols - e.g. MMS. */ int (*read_pause)(void *opaque, int pause); /** * Seek to a given timestamp in stream with the specified stream_index. * Needed for some network streaming protocols which don't support seeking * to byte position. */ int64_t (*read_seek)(void *opaque, int stream_index, int64_t timestamp, int flags); /** * A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable. */ int seekable; /** * max filesize, used to limit allocations * This field is internal to libavformat and access from outside is not allowed. */ int64_t maxsize; /** * avio_read and avio_write should if possible be satisfied directly * instead of going through a buffer, and avio_seek will always * call the underlying seek function directly. */ int direct; /** * Bytes read statistic * This field is internal to libavformat and access from outside is not allowed. */ int64_t bytes_read; /** * seek statistic * This field is internal to libavformat and access from outside is not allowed. */ int seek_count; } AVIOContext; /* unbuffered I/O */ /** * Return AVIO_FLAG_* access flags corresponding to the access permissions * of the resource in url, or a negative value corresponding to an * AVERROR code in case of failure. The returned access flags are * masked by the value in flags. * * @note This function is intrinsically unsafe, in the sense that the * checked resource may change its existence or permission status from * one call to another. Thus you should not trust the returned value, * unless you are sure that no other processes are accessing the * checked resource. */ int avio_check(const char *url, int flags); /** * Allocate and initialize an AVIOContext for buffered I/O. It must be later * freed with av_free(). * * @param buffer Memory block for input/output operations via AVIOContext. * The buffer must be allocated with av_malloc() and friends. * @param buffer_size The buffer size is very important for performance. * For protocols with fixed blocksize it should be set to this blocksize. * For others a typical size is a cache page, e.g. 4kb. * @param write_flag Set to 1 if the buffer should be writable, 0 otherwise. * @param opaque An opaque pointer to user-specific data. * @param read_packet A function for refilling the buffer, may be NULL. * @param write_packet A function for writing the buffer contents, may be NULL. * The function may not change the input buffers content. * @param seek A function for seeking to specified byte position, may be NULL. * * @return Allocated AVIOContext or NULL on failure. */ AVIOContext *avio_alloc_context( unsigned char *buffer, int buffer_size, int write_flag, void *opaque, int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), int64_t (*seek)(void *opaque, int64_t offset, int whence)); void avio_w8(AVIOContext *s, int b); void avio_write(AVIOContext *s, const unsigned char *buf, int size); void avio_wl64(AVIOContext *s, uint64_t val); void avio_wb64(AVIOContext *s, uint64_t val); void avio_wl32(AVIOContext *s, unsigned int val); void avio_wb32(AVIOContext *s, unsigned int val); void avio_wl24(AVIOContext *s, unsigned int val); void avio_wb24(AVIOContext *s, unsigned int val); void avio_wl16(AVIOContext *s, unsigned int val); void avio_wb16(AVIOContext *s, unsigned int val); /** * Write a NULL-terminated string. * @return number of bytes written. */ int avio_put_str(AVIOContext *s, const char *str); /** * Convert an UTF-8 string to UTF-16LE and write it. * @return number of bytes written. */ int avio_put_str16le(AVIOContext *s, const char *str); /** * Passing this as the "whence" parameter to a seek function causes it to * return the filesize without seeking anywhere. Supporting this is optional. * If it is not supported then the seek function will return <0. */ #define AVSEEK_SIZE 0x10000 /** * Oring this flag as into the "whence" parameter to a seek function causes it to * seek by any means (like reopening and linear reading) or other normally unreasonble * means that can be extreemly slow. * This may be ignored by the seek code. */ #define AVSEEK_FORCE 0x20000 /** * fseek() equivalent for AVIOContext. * @return new position or AVERROR. */ int64_t avio_seek(AVIOContext *s, int64_t offset, int whence); /** * Skip given number of bytes forward * @return new position or AVERROR. */ int64_t avio_skip(AVIOContext *s, int64_t offset); /** * ftell() equivalent for AVIOContext. * @return position or AVERROR. */ static av_always_inline int64_t avio_tell(AVIOContext *s) { return avio_seek(s, 0, SEEK_CUR); } /** * Get the filesize. * @return filesize or AVERROR */ int64_t avio_size(AVIOContext *s); /** * feof() equivalent for AVIOContext. * @return non zero if and only if end of file */ int url_feof(AVIOContext *s); /** @warning currently size is limited */ int avio_printf(AVIOContext *s, const char *fmt, ...) av_printf_format(2, 3); /** * Force flushing of buffered data to the output s. * * Force the buffered data to be immediately written to the output, * without to wait to fill the internal buffer. */ void avio_flush(AVIOContext *s); /** * Read size bytes from AVIOContext into buf. * @return number of bytes read or AVERROR */ int avio_read(AVIOContext *s, unsigned char *buf, int size); /** * @name Functions for reading from AVIOContext * @{ * * @note return 0 if EOF, so you cannot use it if EOF handling is * necessary */ int avio_r8 (AVIOContext *s); unsigned int avio_rl16(AVIOContext *s); unsigned int avio_rl24(AVIOContext *s); unsigned int avio_rl32(AVIOContext *s); uint64_t avio_rl64(AVIOContext *s); unsigned int avio_rb16(AVIOContext *s); unsigned int avio_rb24(AVIOContext *s); unsigned int avio_rb32(AVIOContext *s); uint64_t avio_rb64(AVIOContext *s); /** * @} */ /** * Read a string from pb into buf. The reading will terminate when either * a NULL character was encountered, maxlen bytes have been read, or nothing * more can be read from pb. The result is guaranteed to be NULL-terminated, it * will be truncated if buf is too small. * Note that the string is not interpreted or validated in any way, it * might get truncated in the middle of a sequence for multi-byte encodings. * * @return number of bytes read (is always <= maxlen). * If reading ends on EOF or error, the return value will be one more than * bytes actually read. */ int avio_get_str(AVIOContext *pb, int maxlen, char *buf, int buflen); /** * Read a UTF-16 string from pb and convert it to UTF-8. * The reading will terminate when either a null or invalid character was * encountered or maxlen bytes have been read. * @return number of bytes read (is always <= maxlen) */ int avio_get_str16le(AVIOContext *pb, int maxlen, char *buf, int buflen); int avio_get_str16be(AVIOContext *pb, int maxlen, char *buf, int buflen); /** * @name URL open modes * The flags argument to avio_open must be one of the following * constants, optionally ORed with other flags. * @{ */ #define AVIO_FLAG_READ 1 /**< read-only */ #define AVIO_FLAG_WRITE 2 /**< write-only */ #define AVIO_FLAG_READ_WRITE (AVIO_FLAG_READ|AVIO_FLAG_WRITE) /**< read-write pseudo flag */ /** * @} */ /** * Use non-blocking mode. * If this flag is set, operations on the context will return * AVERROR(EAGAIN) if they can not be performed immediately. * If this flag is not set, operations on the context will never return * AVERROR(EAGAIN). * Note that this flag does not affect the opening/connecting of the * context. Connecting a protocol will always block if necessary (e.g. on * network protocols) but never hang (e.g. on busy devices). * Warning: non-blocking protocols is work-in-progress; this flag may be * silently ignored. */ #define AVIO_FLAG_NONBLOCK 8 /** * Use direct mode. * avio_read and avio_write should if possible be satisfied directly * instead of going through a buffer, and avio_seek will always * call the underlying seek function directly. */ #define AVIO_FLAG_DIRECT 0x8000 /** * Create and initialize a AVIOContext for accessing the * resource indicated by url. * @note When the resource indicated by url has been opened in * read+write mode, the AVIOContext can be used only for writing. * * @param s Used to return the pointer to the created AVIOContext. * In case of failure the pointed to value is set to NULL. * @param flags flags which control how the resource indicated by url * is to be opened * @return 0 in case of success, a negative value corresponding to an * AVERROR code in case of failure */ int avio_open(AVIOContext **s, const char *url, int flags); /** * Create and initialize a AVIOContext for accessing the * resource indicated by url. * @note When the resource indicated by url has been opened in * read+write mode, the AVIOContext can be used only for writing. * * @param s Used to return the pointer to the created AVIOContext. * In case of failure the pointed to value is set to NULL. * @param flags flags which control how the resource indicated by url * is to be opened * @param int_cb an interrupt callback to be used at the protocols level * @param options A dictionary filled with protocol-private options. On return * this parameter will be destroyed and replaced with a dict containing options * that were not found. May be NULL. * @return 0 in case of success, a negative value corresponding to an * AVERROR code in case of failure */ int avio_open2(AVIOContext **s, const char *url, int flags, const AVIOInterruptCB *int_cb, AVDictionary **options); /** * Close the resource accessed by the AVIOContext s and free it. * This function can only be used if s was opened by avio_open(). * * The internal buffer is automatically flushed before closing the * resource. * * @return 0 on success, an AVERROR < 0 on error. */ int avio_close(AVIOContext *s); /** * Open a write only memory stream. * * @param s new IO context * @return zero if no error. */ int avio_open_dyn_buf(AVIOContext **s); /** * Return the written size and a pointer to the buffer. The buffer * must be freed with av_free(). * Padding of FF_INPUT_BUFFER_PADDING_SIZE is added to the buffer. * * @param s IO context * @param pbuffer pointer to a byte buffer * @return the length of the byte buffer */ int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer); /** * Iterate through names of available protocols. * * @param opaque A private pointer representing current protocol. * It must be a pointer to NULL on first iteration and will * be updated by successive calls to avio_enum_protocols. * @param output If set to 1, iterate over output protocols, * otherwise over input protocols. * * @return A static string containing the name of current protocol or NULL */ const char *avio_enum_protocols(void **opaque, int output); /** * Pause and resume playing - only meaningful if using a network streaming * protocol (e.g. MMS). * @param pause 1 for pause, 0 for resume */ int avio_pause(AVIOContext *h, int pause); /** * Seek to a given timestamp relative to some component stream. * Only meaningful if using a network streaming protocol (e.g. MMS.). * @param stream_index The stream index that the timestamp is relative to. * If stream_index is (-1) the timestamp should be in AV_TIME_BASE * units from the beginning of the presentation. * If a stream_index >= 0 is used and the protocol does not support * seeking based on component streams, the call will fail. * @param timestamp timestamp in AVStream.time_base units * or if there is no stream specified then in AV_TIME_BASE units. * @param flags Optional combination of AVSEEK_FLAG_BACKWARD, AVSEEK_FLAG_BYTE * and AVSEEK_FLAG_ANY. The protocol may silently ignore * AVSEEK_FLAG_BACKWARD and AVSEEK_FLAG_ANY, but AVSEEK_FLAG_BYTE will * fail if used and not supported. * @return >= 0 on success * @see AVInputFormat::read_seek */ int64_t avio_seek_time(AVIOContext *h, int stream_index, int64_t timestamp, int flags); #endif /* AVFORMAT_AVIO_H */
16,725
35.281996
100
h
cba-pipeline-public
cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/code/ndn-dash/libdash/libav/include/libavcodec/vdpau.h
/* * The Video Decode and Presentation API for UNIX (VDPAU) is used for * hardware-accelerated decoding of MPEG-1/2, H.264 and VC-1. * * Copyright (C) 2008 NVIDIA * * 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 AVCODEC_VDPAU_H #define AVCODEC_VDPAU_H /** * @file * @ingroup lavc_codec_hwaccel_vdpau * Public libavcodec VDPAU header. */ /** * @defgroup lavc_codec_hwaccel_vdpau VDPAU Decoder and Renderer * @ingroup lavc_codec_hwaccel * * VDPAU hardware acceleration has two modules * - VDPAU decoding * - VDPAU presentation * * The VDPAU decoding module parses all headers using FFmpeg * parsing mechanisms and uses VDPAU for the actual decoding. * * As per the current implementation, the actual decoding * and rendering (API calls) are done as part of the VDPAU * presentation (vo_vdpau.c) module. * * @{ */ #include <vdpau/vdpau.h> #include <vdpau/vdpau_x11.h> /** @brief The videoSurface is used for rendering. */ #define FF_VDPAU_STATE_USED_FOR_RENDER 1 /** * @brief The videoSurface is needed for reference/prediction. * The codec manipulates this. */ #define FF_VDPAU_STATE_USED_FOR_REFERENCE 2 /** * @brief This structure is used as a callback between the FFmpeg * decoder (vd_) and presentation (vo_) module. * This is used for defining a video frame containing surface, * picture parameter, bitstream information etc which are passed * between the FFmpeg decoder and its clients. */ struct vdpau_render_state { VdpVideoSurface surface; ///< Used as rendered surface, never changed. int state; ///< Holds FF_VDPAU_STATE_* values. /** Describe size/location of the compressed video data. Set to 0 when freeing bitstream_buffers. */ int bitstream_buffers_allocated; int bitstream_buffers_used; /** The user is responsible for freeing this buffer using av_freep(). */ VdpBitstreamBuffer *bitstream_buffers; /** picture parameter information for all supported codecs */ union VdpPictureInfo { VdpPictureInfoH264 h264; VdpPictureInfoMPEG1Or2 mpeg; VdpPictureInfoVC1 vc1; VdpPictureInfoMPEG4Part2 mpeg4; } info; }; /* @}*/ #endif /* AVCODEC_VDPAU_H */
2,923
29.778947
79
h