summaryrefslogtreecommitdiff
path: root/src/multiplexer.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/multiplexer.cc')
-rw-r--r--src/multiplexer.cc44
1 files changed, 15 insertions, 29 deletions
diff --git a/src/multiplexer.cc b/src/multiplexer.cc
index d4526bc..3d889e2 100644
--- a/src/multiplexer.cc
+++ b/src/multiplexer.cc
@@ -132,14 +132,14 @@ int Multiplexer::Write(int64_t val)
return Write((uint64_t)val);
}
-int Multiplexer::Write(long int val)
+int Multiplexer::Write(int32_t val)
{
val = htonl(val);
return Write((char*)&val, sizeof(val));
}
-int Multiplexer::Write(unsigned long int val)
+int Multiplexer::Write(uint32_t val)
{
val = htonl(val);
@@ -153,28 +153,14 @@ int Multiplexer::Write24(uint32_t val)
return Write((char*)&val, 3 /*24 bit*/);
}
-int Multiplexer::Write(int val)
-{
- val = htonl(val);
-
- return Write((char*)&val, sizeof(val));
-}
-
-int Multiplexer::Write(unsigned int val)
-{
- val = htonl(val);
-
- return Write((char*)&val, sizeof(val));
-}
-
-int Multiplexer::Write(short int val)
+int Multiplexer::Write(int16_t val)
{
val = htons(val);
return Write((char*)&val, sizeof(val));
}
-int Multiplexer::Write(unsigned short int val)
+int Multiplexer::Write(uint16_t val)
{
val = htons(val);
@@ -198,7 +184,7 @@ Frame *Multiplexer::getFrame(StreamType type)
int Multiplexer::read_stream(char *buf, unsigned int size, StreamType type)
{
- unsigned int copied = 0;
+ uint32_t copied = 0;
while( copied < size ) {
@@ -220,7 +206,7 @@ int Multiplexer::read_stream(char *buf, unsigned int size, StreamType type)
// If a frame exists in the buffer copy it to the output buffer
// (No frame ocurres when *running is set to false)
if( frame[type] ) {
- unsigned int doread = (size - copied) < (frame[type]->size - read[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);
@@ -241,7 +227,7 @@ bool Multiplexer::packet(StreamType type)
// Write data
// info->info("\t\t[%sPacket]", type==TYPE_AUDIO?"Audio\0":"Video\0");
- unsigned short int framesize = read_stream(buf, PACKET_SIZE, type);
+ uint16_t framesize = read_stream(buf, PACKET_SIZE, type);
Write((void*)ISO11172_1::packet_start_code_prefix, SIZEOF(ISO11172_1::packet_start_code_prefix));
switch(type) {
@@ -398,8 +384,8 @@ void Multiplexer::pack_header()
);
*/
- unsigned int video_data_rate;
- unsigned int audio_data_rate;
+ uint32_t video_data_rate;
+ uint32_t audio_data_rate;
if(frame[TYPE_AUDIO]) audio_data_rate = frame[TYPE_AUDIO]->bitrate;
else audio_data_rate = 112000;
@@ -407,12 +393,12 @@ void Multiplexer::pack_header()
if(frame[TYPE_VIDEO]) video_data_rate = frame[TYPE_VIDEO]->bitrate;
else video_data_rate = 1100000;
- unsigned int Rmux = ISO11172_1::Rmux(video_data_rate,
- audio_data_rate,
- 20, // packet_header_size,
- 12, // pack_header_size,
- PACKETS_PER_PACK, // packets_per_pack,
- PACKET_SIZE);// packet_data_size)
+ uint32_t Rmux = ISO11172_1::Rmux(video_data_rate,
+ audio_data_rate,
+ 20, // packet_header_size,
+ 12, // pack_header_size,
+ PACKETS_PER_PACK, // packets_per_pack,
+ PACKET_SIZE);// packet_data_size)
header.bits.mux_rate = Rmux;
//0x1B82;