Working HLS video (not audio) for bipbop video

This commit is contained in:
Erik Zandvliet 2013-01-08 14:27:13 +01:00 committed by Thulinma
parent 942c7d69ba
commit cddf0192f6
4 changed files with 19 additions and 4 deletions

View file

@ -2055,6 +2055,7 @@ namespace MP4 {
void AVCC::setPayload(std::string newPayload){
if ( !reserve(0, payloadSize(), newPayload.size())){
std::cerr << "Cannot allocate enough memory for payload" << std::endl;
return;
}
memcpy((char*)payload(), (char*)newPayload.c_str(), newPayload.size());

View file

@ -1,6 +1,7 @@
#pragma once
#include <string>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <stdint.h>
#include <sstream>

View file

@ -48,6 +48,9 @@ int TS::Packet::PID(){
/// Sets the Continuity Counter of a single TS::Packet.
/// \param NewContinuity The new Continuity Counter of the packet.
void TS::Packet::ContinuityCounter(int NewContinuity){
if (strBuf.size() < 4){
strBuf.resize(4);
}
strBuf[3] = (strBuf[3] & 0xF0) + (NewContinuity & 0x0F);
}
@ -211,16 +214,16 @@ void TS::Packet::RandomAccess(int NewVal){
void TS::Packet::DefaultPAT(){
static int MyCntr = 0;
strBuf = std::string(TS::PAT, 188);
ContinuityCounter(MyCntr);
MyCntr = ((MyCntr + 1) % 0x10);
ContinuityCounter(MyCntr++);
MyCntr %= 0x10;
}
/// Transforms the TS::Packet into a standard Program Mapping Table
void TS::Packet::DefaultPMT(){
static int MyCntr = 0;
strBuf = std::string(TS::PMT, 188);
ContinuityCounter(MyCntr);
MyCntr = ((MyCntr + 1) % 0x10);
ContinuityCounter(MyCntr++);
MyCntr %= 0x10;
}
/// 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);
}
/// 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.
/// \param NumBytes the amount of stuffing bytes.
void TS::Packet::AddStuffing(int NumBytes){

View file

@ -43,6 +43,7 @@ namespace TS {
void PESVideoLeadIn(int NewLen, long long unsigned int PTS = 1);
void PESAudioLeadIn(int NewLen, uint64_t PTS = 0);
void FillFree(std::string & PackageData);
int FillFree(const char* PackageData, int maxLen);
void AddStuffing(int NumBytes);
private:
//int Free;