Various fixes and improvements, backported from Pro version. Code by Erik Zandvliet.
This commit is contained in:
parent
5cce37c521
commit
b28a619fc6
13 changed files with 383 additions and 550 deletions
52
lib/nal.h
52
lib/nal.h
|
@ -1,45 +1,19 @@
|
|||
#pragma once
|
||||
#include <deque>
|
||||
#include <string>
|
||||
#include <cstdio>
|
||||
#include <deque>
|
||||
#include "dtsc.h"
|
||||
|
||||
namespace h264 {
|
||||
|
||||
///Struct containing pre-calculated metadata of an SPS nal unit. Width and height in pixels, fps in Hz
|
||||
struct SPSMeta {
|
||||
unsigned int width;
|
||||
unsigned int height;
|
||||
double fps;
|
||||
namespace nalu {
|
||||
struct nalData {
|
||||
unsigned char nalType;
|
||||
unsigned long nalSize;
|
||||
};
|
||||
|
||||
///Class for analyzing generic nal units
|
||||
class NAL {
|
||||
public:
|
||||
NAL();
|
||||
NAL(std::string & InputData);
|
||||
bool ReadData(std::string & InputData, bool raw = false);
|
||||
std::string AnnexB(bool LongIntro = false);
|
||||
std::string SizePrepended();
|
||||
int Type();
|
||||
std::string getData();
|
||||
protected:
|
||||
unsigned int chroma_format_idc;///<the value of chroma_format_idc
|
||||
std::string MyData;///<The h264 nal unit data
|
||||
};
|
||||
//NAL class
|
||||
std::deque<int> parseNalSizes(DTSC::Packet & pack);
|
||||
std::string removeEmulationPrevention(const std::string & data);
|
||||
|
||||
///Special instance of NAL class for analyzing SPS nal units
|
||||
class SPS: public NAL {
|
||||
public:
|
||||
SPS(): NAL() {};
|
||||
SPS(std::string & InputData, bool raw = false);
|
||||
SPSMeta getCharacteristics();
|
||||
void analyzeSPS();
|
||||
};
|
||||
|
||||
///Special instance of NAL class for analyzing PPS nal units
|
||||
class PPS: public NAL {
|
||||
public:
|
||||
PPS(): NAL() {};
|
||||
PPS(std::string & InputData): NAL(InputData) {};
|
||||
void analyzePPS();
|
||||
};
|
||||
}//ns h264
|
||||
unsigned long toAnnexB(const char * data, unsigned long dataSize, char *& result);
|
||||
unsigned long fromAnnexB(const char * data, unsigned long dataSize, char *& result);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue