diff options
Diffstat (limited to 'src/multiplexer.cc')
-rw-r--r-- | src/multiplexer.cc | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/src/multiplexer.cc b/src/multiplexer.cc index 3d889e2..ae51139 100644 --- a/src/multiplexer.cc +++ b/src/multiplexer.cc @@ -24,13 +24,14 @@ * along with MIaV; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ - #include "config.h" #include "multiplexer.h" #include <netinet/in.h> #include <math.h> +#include <hugin.hpp> + #include "util.h" static uint64_t htonll(uint64_t value) @@ -74,14 +75,13 @@ static double picture_rate_index[16] = { RESERVED, RESERVED, RESERVED, RESERVED, RESERVED, RESERVED, RESERVED }; */ -Multiplexer::Multiplexer(File *f, Multicast *m, Info *i, volatile bool *r, +Multiplexer::Multiplexer(File *f, Multicast *m, volatile bool *r, ThreadSafeQueuePriority *video_q, ThreadSafeQueuePriority *audio_q) { running = r; file = f; multicast = m; - info = i; frame[TYPE_VIDEO] = NULL; written[TYPE_VIDEO] = 0.0; @@ -169,7 +169,7 @@ int Multiplexer::Write(uint16_t val) Frame *Multiplexer::getFrame(StreamType type) { - // info->info("Get %s Frame", type==TYPE_AUDIO?"Audio\0":"Video\0"); + DEBUG(multiplexer, "Get %s Frame", type==TYPE_AUDIO?"Audio\0":"Video\0"); read[type] = 0; @@ -199,7 +199,8 @@ int Multiplexer::read_stream(char *buf, unsigned int size, StreamType type) // check for end of stream if( frame[type]->endOfFrameStream == true) { - info->info("endOfFrameStream in Multiplexer %s-stream.", type==TYPE_VIDEO?"video\0":"audio\0"); + DEBUG(multiplexer, "endOfFrameStream in Multiplexer %s-stream.", + type==TYPE_VIDEO?"video\0":"audio\0"); return copied; } @@ -209,7 +210,8 @@ int Multiplexer::read_stream(char *buf, unsigned int size, StreamType type) uint32_t doread = (size - copied) < (frame[type]->size - read[type]) ? size - copied : (frame[type]->size - read[type]); - //info->info("Requested: %d. Read: %d. Doread: %d. In buffer %d", size, (*read), doread, (*frame)->size); + DEBUG(multiplexer, "Requested: %d. Read: %d. Doread: %d. In buffer %d", + size, (*read), doread, (*frame)->size); memcpy(buf + copied, frame[type]->data + read[type], doread); read[type] += doread; @@ -225,7 +227,7 @@ bool Multiplexer::packet(StreamType type) char buf[PACKET_SIZE]; // Write data - // info->info("\t\t[%sPacket]", type==TYPE_AUDIO?"Audio\0":"Video\0"); + DEBUG(multiplexer, "\t\t[%sPacket]", type==TYPE_AUDIO?"Audio\0":"Video\0"); uint16_t framesize = read_stream(buf, PACKET_SIZE, type); @@ -264,7 +266,8 @@ bool Multiplexer::packet(StreamType type) */ bool Multiplexer::packet() { - //info->info("\t\tWritten[A]: %f, Written[V]: %f", written[TYPE_AUDIO], written[TYPE_VIDEO]); + DEBUG(multiplexer, "\t\tWritten[A]: %f, Written[V]: %f", + written[TYPE_AUDIO], written[TYPE_VIDEO]); StreamType type; /* @@ -310,7 +313,7 @@ bool Multiplexer::packet() */ void Multiplexer::system_header() { - // info->info("\t\t[System Header]"); + DEBUG(multiplexer, "\t\t[System Header]"); // system_header_start_code (32 bits) Write((void*)ISO11172_1::system_header_start_code, @@ -376,7 +379,7 @@ void Multiplexer::pack_header() header.bits.system_clock_reference2 = TIMECODE29_15(SCR); header.bits.system_clock_reference3 = TIMECODE14_0(SCR); /* - info->info("timecode All: %lld, 1: %lld, 2: %lld, 3: %lld", + DEBUG(multiplexer, "timecode All: %lld, 1: %lld, 2: %lld, 3: %lld", SCR, (unsigned long long int)header.system_clock_reference1, (unsigned long long int)header.system_clock_reference2, @@ -428,7 +431,7 @@ bool Multiplexer::pack() for(int cnt = 0; cnt < PACKETS_PER_PACK; cnt++) if(!packet()) return false; - // info->info("\t]"); + //DEBUG(multiplexer, "\t]"); return true; } @@ -438,18 +441,18 @@ bool Multiplexer::pack() */ void Multiplexer::iso11172_stream() { - // info->info("[iso11172_stream"); + // DEBUG(multiplexer, "[iso11172_stream"); while(pack()); - // info->info("]"); - // info->info("[iso11172_end_code]"); + // DEBUG(multiplexer, "]"); + // DEBUG(multiplexer, "[iso11172_end_code]"); Write((void*)ISO11172_1::end_code, SIZEOF(ISO11172_1::end_code)); /* - info->info("false && false = %d", false && false); - info->info("true && false = %d", true && false); - info->info("true && true = %d", true && true); + DEBUG(multiplexer, "false && false = %d", false && false); + DEBUG(multiplexer, "true && false = %d", true && false); + DEBUG(multiplexer, "true && true = %d", true && true); */ } @@ -463,7 +466,7 @@ void Multiplexer::multiplex() char buf[1024]; do { frmsz = read_stream(buf, sizeof(buf), BYPASS); - info->info("Wrote %d bytes", frmsz); + DEBUG(multiplexer, "Wrote %d bytes", frmsz); Write(buf, frmsz); } while(frmsz == sizeof(buf)); return; |