Re-fixed indenting (post-merge)
This commit is contained in:
parent
f9876c7548
commit
48bbb8afdb
3 changed files with 278 additions and 282 deletions
|
@ -55,8 +55,7 @@ namespace Connector_HTTP {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (metadata.isMember("length") && metadata["length"].asInt() > 0){
|
if (metadata.isMember("length") && metadata["length"].asInt() > 0){
|
||||||
Result <<
|
Result << "#EXTM3U\r\n"
|
||||||
"#EXTM3U\r\n"
|
|
||||||
//"#EXT-X-VERSION:1\r\n"
|
//"#EXT-X-VERSION:1\r\n"
|
||||||
"#EXT-X-MEDIA-SEQUENCE:1\r\n"
|
"#EXT-X-MEDIA-SEQUENCE:1\r\n"
|
||||||
//"#EXT-X-ALLOW-CACHE:YES\r\n"
|
//"#EXT-X-ALLOW-CACHE:YES\r\n"
|
||||||
|
@ -66,14 +65,14 @@ namespace Connector_HTTP {
|
||||||
bool writeOffset = true;
|
bool writeOffset = true;
|
||||||
fragIndices.push_back(metadata["keytime"][metadata["keytime"].size() - 1].asInt() + 1);
|
fragIndices.push_back(metadata["keytime"][metadata["keytime"].size() - 1].asInt() + 1);
|
||||||
for (int i = 0; i < fragIndices.size() - 1; i++){
|
for (int i = 0; i < fragIndices.size() - 1; i++){
|
||||||
Result << "#EXTINF:" << (metadata["keytime"][fragIndices[i]].asInt() - lastDuration) / 1000 << "." << std::setw(3) << std::setfill('0') << ((metadata["keytime"][fragIndices[i]].asInt() - lastDuration) % 1000) << ",\r\n"
|
Result << "#EXTINF:" << (metadata["keytime"][fragIndices[i]].asInt() - lastDuration) / 1000 << "." << std::setw(3) << std::setfill('0')
|
||||||
<< fragIndices[i] << "_" << fragIndices[i+1] - fragIndices[i] << ".ts\r\n";
|
<< ((metadata["keytime"][fragIndices[i]].asInt() - lastDuration) % 1000) << ",\r\n" << fragIndices[i] << "_"
|
||||||
|
<< fragIndices[i + 1] - fragIndices[i] << ".ts\r\n";
|
||||||
lastDuration = metadata["keytime"][fragIndices[i]].asInt();
|
lastDuration = metadata["keytime"][fragIndices[i]].asInt();
|
||||||
}
|
}
|
||||||
Result << "#EXT-X-ENDLIST";
|
Result << "#EXT-X-ENDLIST";
|
||||||
}else{
|
}else{
|
||||||
Result <<
|
Result << "#EXTM3U\r\n"
|
||||||
"#EXTM3U\r\n"
|
|
||||||
"#EXT-X-VERSION:4\r\n"
|
"#EXT-X-VERSION:4\r\n"
|
||||||
"#EXT-X-MEDIA-SEQUENCE:1\r\n"
|
"#EXT-X-MEDIA-SEQUENCE:1\r\n"
|
||||||
"#EXT-X-TARGETDURATION:" << ((metadata["video"]["keyms"].asInt() + metadata["video"]["keyvar"].asInt()) / 1000) + 1 << "\r\n";
|
"#EXT-X-TARGETDURATION:" << ((metadata["video"]["keyms"].asInt() + metadata["video"]["keyvar"].asInt()) / 1000) + 1 << "\r\n";
|
||||||
|
@ -323,8 +322,7 @@ fprintf( stderr, " Received Keyframe of size %d\n", Strm.lastData().size() );
|
||||||
int TSType;
|
int TSType;
|
||||||
bool FirstPic = true;
|
bool FirstPic = true;
|
||||||
while (DTMIData.size()){
|
while (DTMIData.size()){
|
||||||
ThisNaluSize = (DTMIData[0] << 24) + (DTMIData[1] << 16) +
|
ThisNaluSize = (DTMIData[0] << 24) + (DTMIData[1] << 16) + (DTMIData[2] << 8) + DTMIData[3];
|
||||||
(DTMIData[2] << 8) + DTMIData[3];
|
|
||||||
DTMIData.erase(0, 4); //Erase the first four characters;
|
DTMIData.erase(0, 4); //Erase the first four characters;
|
||||||
TSType = (int)DTMIData[0] & 0x1F;
|
TSType = (int)DTMIData[0] & 0x1F;
|
||||||
if (TSType == 0x05){
|
if (TSType == 0x05){
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
#include <mist/ts_packet.h> //TS support
|
#include <mist/ts_packet.h> //TS support
|
||||||
#include <mist/dtsc.h> //DTSC support
|
#include <mist/dtsc.h> //DTSC support
|
||||||
#include <mist/mp4.h> //For initdata conversion
|
#include <mist/mp4.h> //For initdata conversion
|
||||||
|
|
||||||
/// The main function of the connector
|
/// The main function of the connector
|
||||||
/// \param conn A connection with the client
|
/// \param conn A connection with the client
|
||||||
/// \param streamname The name of the stream
|
/// \param streamname The name of the stream
|
||||||
|
@ -81,8 +80,7 @@ int TS_Handler( Socket::Connection conn, std::string streamname ) {
|
||||||
int TSType;
|
int TSType;
|
||||||
bool FirstPic = true;
|
bool FirstPic = true;
|
||||||
while (DTMIData.size()){
|
while (DTMIData.size()){
|
||||||
ThisNaluSize = (DTMIData[0] << 24) + (DTMIData[1] << 16) +
|
ThisNaluSize = (DTMIData[0] << 24) + (DTMIData[1] << 16) + (DTMIData[2] << 8) + DTMIData[3];
|
||||||
(DTMIData[2] << 8) + DTMIData[3];
|
|
||||||
DTMIData.erase(0, 4); //Erase the first four characters;
|
DTMIData.erase(0, 4); //Erase the first four characters;
|
||||||
TSType = (int)DTMIData[0] & 0x1F;
|
TSType = (int)DTMIData[0] & 0x1F;
|
||||||
if (TSType == 0x05){
|
if (TSType == 0x05){
|
||||||
|
@ -183,11 +181,14 @@ int TS_Handler( Socket::Connection conn, std::string streamname ) {
|
||||||
|
|
||||||
int main(int argc, char ** argv){
|
int main(int argc, char ** argv){
|
||||||
Util::Config conf(argv[0], PACKAGE_VERSION);
|
Util::Config conf(argv[0], PACKAGE_VERSION);
|
||||||
conf.addOption("streamname",JSON::fromString("{\"arg\":\"string\",\"arg_num\":1,\"help\":\"The name of the stream that this connector will transmit.\"}"));
|
conf.addOption("streamname",
|
||||||
|
JSON::fromString("{\"arg\":\"string\",\"arg_num\":1,\"help\":\"The name of the stream that this connector will transmit.\"}"));
|
||||||
conf.addConnectorOptions(8888);
|
conf.addConnectorOptions(8888);
|
||||||
conf.parseArgs(argc, argv);
|
conf.parseArgs(argc, argv);
|
||||||
Socket::Server server_socket = Socket::Server(conf.getInteger("listen_port"), conf.getString("listen_interface"));
|
Socket::Server server_socket = Socket::Server(conf.getInteger("listen_port"), conf.getString("listen_interface"));
|
||||||
if (!server_socket.connected()){return 1;}
|
if ( !server_socket.connected()){
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
conf.activate();
|
conf.activate();
|
||||||
|
|
||||||
while (server_socket.connected() && conf.is_active){
|
while (server_socket.connected() && conf.is_active){
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
#include <mist/ts_packet.h> //TS support
|
#include <mist/ts_packet.h> //TS support
|
||||||
#include <mist/dtsc.h> //DTSC support
|
#include <mist/dtsc.h> //DTSC support
|
||||||
#include <mist/mp4.h> //For initdata conversion
|
#include <mist/mp4.h> //For initdata conversion
|
||||||
|
|
||||||
#define VIDEO_SCALING ( 27000000.0 / (double)DTSCStream.metadata["video"]["fpks"].asInt())
|
#define VIDEO_SCALING ( 27000000.0 / (double)DTSCStream.metadata["video"]["fpks"].asInt())
|
||||||
#define AUDIO_SCALING ( 27000000.0 / (double)DTSCStream.metadata["audio"]["rate"].asInt())
|
#define AUDIO_SCALING ( 27000000.0 / (double)DTSCStream.metadata["audio"]["rate"].asInt())
|
||||||
|
|
||||||
|
@ -34,7 +33,6 @@ int main( ) {
|
||||||
MP4::AVCC avccbox;
|
MP4::AVCC avccbox;
|
||||||
bool haveAvcc = false;
|
bool haveAvcc = false;
|
||||||
|
|
||||||
|
|
||||||
while (std::cin.good()){
|
while (std::cin.good()){
|
||||||
if (DTSCStream.parsePacket(StrData)){
|
if (DTSCStream.parsePacket(StrData)){
|
||||||
if ( !haveAvcc){
|
if ( !haveAvcc){
|
||||||
|
@ -56,8 +54,7 @@ int main( ) {
|
||||||
int TSType;
|
int TSType;
|
||||||
bool FirstPic = true;
|
bool FirstPic = true;
|
||||||
while (DTMIData.size()){
|
while (DTMIData.size()){
|
||||||
ThisNaluSize = (DTMIData[0] << 24) + (DTMIData[1] << 16) +
|
ThisNaluSize = (DTMIData[0] << 24) + (DTMIData[1] << 16) + (DTMIData[2] << 8) + DTMIData[3];
|
||||||
(DTMIData[2] << 8) + DTMIData[3];
|
|
||||||
DTMIData.erase(0, 4); //Erase the first four characters;
|
DTMIData.erase(0, 4); //Erase the first four characters;
|
||||||
TSType = (int)DTMIData[0] & 0x1F;
|
TSType = (int)DTMIData[0] & 0x1F;
|
||||||
if ( !(TSType == 0x09)){
|
if ( !(TSType == 0x09)){
|
||||||
|
|
Loading…
Add table
Reference in a new issue