Working HLS video (not audio) for bipbop video
This commit is contained in:
parent
942c7d69ba
commit
cddf0192f6
4 changed files with 19 additions and 4 deletions
|
@ -2055,6 +2055,7 @@ namespace MP4 {
|
||||||
|
|
||||||
void AVCC::setPayload(std::string newPayload){
|
void AVCC::setPayload(std::string newPayload){
|
||||||
if ( !reserve(0, payloadSize(), newPayload.size())){
|
if ( !reserve(0, payloadSize(), newPayload.size())){
|
||||||
|
std::cerr << "Cannot allocate enough memory for payload" << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
memcpy((char*)payload(), (char*)newPayload.c_str(), newPayload.size());
|
memcpy((char*)payload(), (char*)newPayload.c_str(), newPayload.size());
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <iomanip>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
|
@ -48,6 +48,9 @@ int TS::Packet::PID(){
|
||||||
/// Sets the Continuity Counter of a single TS::Packet.
|
/// Sets the Continuity Counter of a single TS::Packet.
|
||||||
/// \param NewContinuity The new Continuity Counter of the packet.
|
/// \param NewContinuity The new Continuity Counter of the packet.
|
||||||
void TS::Packet::ContinuityCounter(int NewContinuity){
|
void TS::Packet::ContinuityCounter(int NewContinuity){
|
||||||
|
if (strBuf.size() < 4){
|
||||||
|
strBuf.resize(4);
|
||||||
|
}
|
||||||
strBuf[3] = (strBuf[3] & 0xF0) + (NewContinuity & 0x0F);
|
strBuf[3] = (strBuf[3] & 0xF0) + (NewContinuity & 0x0F);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,16 +214,16 @@ void TS::Packet::RandomAccess(int NewVal){
|
||||||
void TS::Packet::DefaultPAT(){
|
void TS::Packet::DefaultPAT(){
|
||||||
static int MyCntr = 0;
|
static int MyCntr = 0;
|
||||||
strBuf = std::string(TS::PAT, 188);
|
strBuf = std::string(TS::PAT, 188);
|
||||||
ContinuityCounter(MyCntr);
|
ContinuityCounter(MyCntr++);
|
||||||
MyCntr = ((MyCntr + 1) % 0x10);
|
MyCntr %= 0x10;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Transforms the TS::Packet into a standard Program Mapping Table
|
/// Transforms the TS::Packet into a standard Program Mapping Table
|
||||||
void TS::Packet::DefaultPMT(){
|
void TS::Packet::DefaultPMT(){
|
||||||
static int MyCntr = 0;
|
static int MyCntr = 0;
|
||||||
strBuf = std::string(TS::PMT, 188);
|
strBuf = std::string(TS::PMT, 188);
|
||||||
ContinuityCounter(MyCntr);
|
ContinuityCounter(MyCntr++);
|
||||||
MyCntr = ((MyCntr + 1) % 0x10);
|
MyCntr %= 0x10;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Generates a string from the contents of the TS::Packet
|
/// Generates a string from the contents of the TS::Packet
|
||||||
|
@ -298,6 +301,15 @@ void TS::Packet::FillFree(std::string & NewVal){
|
||||||
NewVal.erase(0, toWrite);
|
NewVal.erase(0, toWrite);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Fills the free bytes of the TS::Packet.
|
||||||
|
/// Stores as many bytes from NewVal as possible in the packet.
|
||||||
|
/// \param NewVal The data to store in the packet.
|
||||||
|
int TS::Packet::FillFree(const char* NewVal, int maxLen){
|
||||||
|
int toWrite = std::min((int)(188 - strBuf.size()), maxLen);
|
||||||
|
strBuf += std::string(NewVal, toWrite);
|
||||||
|
return toWrite;
|
||||||
|
}
|
||||||
|
|
||||||
/// Adds NumBytes of stuffing to the TS::Packet.
|
/// Adds NumBytes of stuffing to the TS::Packet.
|
||||||
/// \param NumBytes the amount of stuffing bytes.
|
/// \param NumBytes the amount of stuffing bytes.
|
||||||
void TS::Packet::AddStuffing(int NumBytes){
|
void TS::Packet::AddStuffing(int NumBytes){
|
||||||
|
|
|
@ -43,6 +43,7 @@ namespace TS {
|
||||||
void PESVideoLeadIn(int NewLen, long long unsigned int PTS = 1);
|
void PESVideoLeadIn(int NewLen, long long unsigned int PTS = 1);
|
||||||
void PESAudioLeadIn(int NewLen, uint64_t PTS = 0);
|
void PESAudioLeadIn(int NewLen, uint64_t PTS = 0);
|
||||||
void FillFree(std::string & PackageData);
|
void FillFree(std::string & PackageData);
|
||||||
|
int FillFree(const char* PackageData, int maxLen);
|
||||||
void AddStuffing(int NumBytes);
|
void AddStuffing(int NumBytes);
|
||||||
private:
|
private:
|
||||||
//int Free;
|
//int Free;
|
||||||
|
|
Loading…
Add table
Reference in a new issue