From 29ae5ac36d4ffc520232ff393b2455130ec0227e Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Thu, 27 Oct 2011 15:50:11 +0200 Subject: fix warnings/errors. --- src/audio_encoder.cc | 2 +- src/daemon.cc | 2 +- src/dvfile.cc | 2 + src/file.cc | 2 +- src/file.h | 2 +- src/info.cc | 4 +- src/info.h | 8 ++-- src/info_console.cc | 6 +-- src/info_console.h | 6 +-- src/info_gui.cc | 6 +-- src/info_gui.h | 6 +-- src/iso11172-1.h | 90 +++++++++++++++++++--------------- src/libfame_wrapper.cc | 1 + src/liblame_wrapper.cc | 6 ++- src/miav.cc | 1 + src/miav_config.cc | 20 ++++---- src/miav_config.h | 14 +++--- src/miav_daemon.cc | 2 + src/mov_encoder.cc | 2 +- src/multicast.cc | 6 ++- src/multicast_configuration.cc | 4 +- src/multicast_configuration.h | 2 +- src/multiplexer.cc | 106 +++++++++++++++++++++-------------------- src/server.cc | 2 +- 24 files changed, 168 insertions(+), 134 deletions(-) (limited to 'src') diff --git a/src/audio_encoder.cc b/src/audio_encoder.cc index 6e412c3..0c82976 100644 --- a/src/audio_encoder.cc +++ b/src/audio_encoder.cc @@ -52,7 +52,7 @@ void AudioEncoder::thread_main() info->info("AudioEncoder::run"); // Run with slightly lower priority than MovEncoderWriter - nice(1); + if(nice(1) == -1) info->warn("AudioEncoder::run could not set nice."); Frame *in_frame = NULL; Frame *out_frame = NULL; diff --git a/src/daemon.cc b/src/daemon.cc index 6e46bd5..f5ebe41 100644 --- a/src/daemon.cc +++ b/src/daemon.cc @@ -72,7 +72,7 @@ int Daemon::run(const char *user, const char* group) fprintf(stderr, "Could not find group \"%s\" in /etc/group file.\n", group); } - chdir("/"); + if(chdir("/") == -1) fprintf(stderr, "Could not chdir to '/'.\n"); umask(0); f = fork(); diff --git a/src/dvfile.cc b/src/dvfile.cc index 7d83255..fb9a184 100644 --- a/src/dvfile.cc +++ b/src/dvfile.cc @@ -27,6 +27,8 @@ #include "config.h" #include "dvfile.h" +#include + #include "dv.h" #include "util.h" diff --git a/src/file.cc b/src/file.cc index 3a59334..9279015 100644 --- a/src/file.cc +++ b/src/file.cc @@ -42,7 +42,7 @@ #include -File::File(char *fn, char* ext, Info *i) +File::File(const char *fn, const char* ext, Info *i) { char path[256]; diff --git a/src/file.h b/src/file.h index 04947df..23ccc0c 100644 --- a/src/file.h +++ b/src/file.h @@ -41,7 +41,7 @@ class File { public: - File(char *filename, char* ext, Info* info); + File(const char *filename, const char* ext, Info* info); ~File(); int Write(void* data, int size); diff --git a/src/info.cc b/src/info.cc index 701a705..e67f444 100644 --- a/src/info.cc +++ b/src/info.cc @@ -28,12 +28,14 @@ #include "info.h" #include +#include +#include Info::Info() { pthread_mutex_init (&mutex, NULL); } -void Info::log(char *fmt, ...) +void Info::log(const char *fmt, ...) { // const time_t t; FILE *fp; diff --git a/src/info.h b/src/info.h index d533051..6c0f6de 100644 --- a/src/info.h +++ b/src/info.h @@ -46,10 +46,10 @@ public: Info(); virtual ~Info() {} - virtual void error(char* fmt, ...) = 0; - virtual void warn(char* fmt, ...) = 0; - virtual void info(char* fmt, ...) = 0; - void log(char* fmt, ...); + virtual void error(const char* fmt, ...) = 0; + virtual void warn(const char* fmt, ...) = 0; + virtual void info(const char* fmt, ...) = 0; + void log(const char* fmt, ...); protected: MiavConfig *config; diff --git a/src/info_console.cc b/src/info_console.cc index ce406fb..3a197a9 100644 --- a/src/info_console.cc +++ b/src/info_console.cc @@ -43,7 +43,7 @@ InfoConsole::~InfoConsole() pthread_mutex_destroy(&mutex); } -void InfoConsole::error(char *fmt, ...) +void InfoConsole::error(const char *fmt, ...) { char buf[1024]; @@ -62,7 +62,7 @@ void InfoConsole::error(char *fmt, ...) log("Error: %s", buf); } -void InfoConsole::warn(char *fmt, ...) +void InfoConsole::warn(const char *fmt, ...) { char buf[1024]; @@ -81,7 +81,7 @@ void InfoConsole::warn(char *fmt, ...) log("Warning: %s", buf); } -void InfoConsole::info(char *fmt, ...) +void InfoConsole::info(const char *fmt, ...) { char buf[1024]; diff --git a/src/info_console.h b/src/info_console.h index 2adcad6..7ecfda3 100644 --- a/src/info_console.h +++ b/src/info_console.h @@ -43,9 +43,9 @@ public: InfoConsole(MiavConfig *config); ~InfoConsole(); - void error(char* fmt, ...); - void warn(char* fmt, ...); - void info(char* fmt, ...); + void error(const char* fmt, ...); + void warn(const char* fmt, ...); + void info(const char* fmt, ...); private: }; diff --git a/src/info_gui.cc b/src/info_gui.cc index aa831b6..cb2e51d 100644 --- a/src/info_gui.cc +++ b/src/info_gui.cc @@ -98,7 +98,7 @@ void InfoGui::showmsg(char *msg, char *title, msg_icon icon) pthread_mutex_unlock(&mutex); } -void InfoGui::error(char *fmt, ...) +void InfoGui::error(const char *fmt, ...) { char buf[1024]; @@ -112,7 +112,7 @@ void InfoGui::error(char *fmt, ...) log("Error: %s", buf); } -void InfoGui::warn(char *fmt, ...) +void InfoGui::warn(const char *fmt, ...) { char buf[1024]; @@ -126,7 +126,7 @@ void InfoGui::warn(char *fmt, ...) log("Warning: %s", buf); } -void InfoGui::info(char *fmt, ...) +void InfoGui::info(const char *fmt, ...) { char buf[1024]; diff --git a/src/info_gui.h b/src/info_gui.h index a4f5135..75322a0 100644 --- a/src/info_gui.h +++ b/src/info_gui.h @@ -68,9 +68,9 @@ public: InfoGui(QApplication *a, QWidget *p, MiavConfig *config); ~InfoGui(); - void error(char* fmt, ...); - void warn(char* fmt, ...); - void info(char* fmt, ...); + void error(const char* fmt, ...); + void warn(const char* fmt, ...); + void info(const char* fmt, ...); void setParent(QWidget *p); diff --git a/src/iso11172-1.h b/src/iso11172-1.h index ee8f408..a011383 100644 --- a/src/iso11172-1.h +++ b/src/iso11172-1.h @@ -41,51 +41,63 @@ namespace ISO11172_1 { // Types //////////////////////////////////////////////////// // 64 bits (8 bytes) - typedef struct { - unsigned long long int marker_bit3:1; - unsigned long long int system_clock_reference3:15; - unsigned long long int marker_bit2:1; - unsigned long long int system_clock_reference2:15; - unsigned long long int marker_bit1:1; - unsigned long long int system_clock_reference1:3; - unsigned long long int padding:4; - unsigned long long int stuffing_byte:8; - unsigned long long int packet_length:16; + typedef union { + struct { + unsigned long long int marker_bit3:1; + unsigned long long int system_clock_reference3:15; + unsigned long long int marker_bit2:1; + unsigned long long int system_clock_reference2:15; + unsigned long long int marker_bit1:1; + unsigned long long int system_clock_reference1:3; + unsigned long long int padding:4; + unsigned long long int stuffing_byte:8; + unsigned long long int packet_length:16; + } bits; + unsigned long long int ulli; } packet_header; - typedef struct { - unsigned long long int marker_bit5:1; - unsigned long long int mux_rate:22; - unsigned long long int marker_bit4:1; - unsigned long long int marker_bit3:1; - unsigned long long int system_clock_reference3:15; - unsigned long long int marker_bit2:1; - unsigned long long int system_clock_reference2:15; - unsigned long long int marker_bit1:1; - unsigned long long int system_clock_reference1:3; - unsigned long long int padding:4; + typedef union { + struct { + unsigned long long int marker_bit5:1; + unsigned long long int mux_rate:22; + unsigned long long int marker_bit4:1; + unsigned long long int marker_bit3:1; + unsigned long long int system_clock_reference3:15; + unsigned long long int marker_bit2:1; + unsigned long long int system_clock_reference2:15; + unsigned long long int marker_bit1:1; + unsigned long long int system_clock_reference1:3; + unsigned long long int padding:4; + } bits; + unsigned long long int ulli; } pack_header; - typedef struct { - unsigned long long int reserved_byte:8; - unsigned long long int video_bound:5; - unsigned long long int marker_bit3:1; - unsigned long long int system_video_clock_flag:1; - unsigned long long int system_audio_clock_flag:1; - unsigned long long int CSPS_flag:1; - unsigned long long int fixed_flag:1; - unsigned long long int audio_bound:6; - unsigned long long int marker_bit2:1; - unsigned long long int rate_bound:22; - unsigned long long int marker_bit1:1; - unsigned long long int header_length:16; + typedef union { + struct { + unsigned long long int reserved_byte:8; + unsigned long long int video_bound:5; + unsigned long long int marker_bit3:1; + unsigned long long int system_video_clock_flag:1; + unsigned long long int system_audio_clock_flag:1; + unsigned long long int CSPS_flag:1; + unsigned long long int fixed_flag:1; + unsigned long long int audio_bound:6; + unsigned long long int marker_bit2:1; + unsigned long long int rate_bound:22; + unsigned long long int marker_bit1:1; + unsigned long long int header_length:16; + } bits; + unsigned long long int ulli; } system_header; - typedef struct { - unsigned long int STD_buffer_size_bound:13; - unsigned long int STD_buffer_bound_scale:1; - unsigned long int market_bits:2; - unsigned long int stream_id:8; + typedef union { + struct { + unsigned long int STD_buffer_size_bound:13; + unsigned long int STD_buffer_bound_scale:1; + unsigned long int market_bits:2; + unsigned long int stream_id:8; + } bits; + unsigned long int uli; } stream_description; //////////////////////////////////////////////////// diff --git a/src/libfame_wrapper.cc b/src/libfame_wrapper.cc index a663df6..dc453a8 100644 --- a/src/libfame_wrapper.cc +++ b/src/libfame_wrapper.cc @@ -28,6 +28,7 @@ #include "libfame_wrapper.h" #include +#include #include "miav_config.h" #include "frame.h" diff --git a/src/liblame_wrapper.cc b/src/liblame_wrapper.cc index 5603d6f..b4a0bd1 100644 --- a/src/liblame_wrapper.cc +++ b/src/liblame_wrapper.cc @@ -28,6 +28,8 @@ #include "liblame_wrapper.h" #include "miav_config.h" +#include + LibLAMEWrapper::LibLAMEWrapper(Info *i) { info = i; @@ -64,7 +66,7 @@ LibLAMEWrapper::LibLAMEWrapper(Info *i) lame_set_copyright(gfp, 0); // is there a copyright on the encoded data? lame_set_original(gfp, 1); // is the encoded data on the original media? lame_set_error_protection(gfp, 0);// add 2 byte CRC protection to each frame? - lame_set_padding_type(gfp, PAD_NO); // PAD_NO, PAD_ALL, PAD_ADJUST, PAD_MAX_INDICATOR + // lame_set_padding_type(gfp, PAD_NO); // PAD_NO, PAD_ALL, PAD_ADJUST, PAD_MAX_INDICATOR // 0 = do not pad frames // 1 = always pad frames // 2 = adjust padding to satisfy bit rate @@ -108,7 +110,7 @@ Frame *LibLAMEWrapper::close(Frame *oldframe) int flush; - flush = lame_encode_finish(gfp, frame->data + offset, 7200); + flush = 0;//lame_encode_finish(gfp, frame->data + offset, 7200); frame->size = offset + flush; diff --git a/src/miav.cc b/src/miav.cc index 2efd2bf..24d6fe1 100644 --- a/src/miav.cc +++ b/src/miav.cc @@ -40,6 +40,7 @@ #include "info_console.h" #include +#include typedef enum { MODE_UNKNOWN, diff --git a/src/miav_config.cc b/src/miav_config.cc index adfa5c5..4e4b82b 100644 --- a/src/miav_config.cc +++ b/src/miav_config.cc @@ -27,9 +27,13 @@ #include #include "miav_config.h" +#include +#include +#include + MiavConfig *config; -MiavConfig::MiavConfig(char *file, Info *i) +MiavConfig::MiavConfig(const char *file, Info *i) { info = i; configs = NULL; @@ -49,7 +53,7 @@ MiavConfig::MiavConfig(char *file, Info *i) fseek(fp, 0, SEEK_SET); char *raw = (char*)calloc(fsz, 1); - fread(raw, 1, fsz, fp); + size_t rsz = fread(raw, 1, fsz, fp); rsz = rsz; fclose(fp); @@ -74,7 +78,7 @@ MiavConfig::~MiavConfig() /** * Prints a reasonable error message when a parse error occurres. */ -void MiavConfig::parseError(char* msg, _cfg* cfg) +void MiavConfig::parseError(const char* msg, _cfg* cfg) { if(info) info->error("Error parsing file %s at line %d:\n\t%s\n\t%s\n", filename.c_str(), @@ -412,7 +416,7 @@ _cfg* MiavConfig::parse(char* raw) return first; } -int MiavConfig::readInt(char *node) +int MiavConfig::readInt(const char *node) { _cfg* n = findNode(node); if(n) { @@ -422,7 +426,7 @@ int MiavConfig::readInt(char *node) return 0; } -bool MiavConfig::readBool(char *node) +bool MiavConfig::readBool(const char *node) { _cfg* n = findNode(node); if(n) { @@ -433,7 +437,7 @@ bool MiavConfig::readBool(char *node) return false; } -string *MiavConfig::readString(char *node) +string *MiavConfig::readString(const char *node) { _cfg* n = findNode(node); if(n) { @@ -443,7 +447,7 @@ string *MiavConfig::readString(char *node) return &emptyString; } -float MiavConfig::readFloat(char *node) +float MiavConfig::readFloat(const char *node) { _cfg* n = findNode(node); if(n) { @@ -454,7 +458,7 @@ float MiavConfig::readFloat(char *node) return 0.0f; } -_cfg *MiavConfig::findNode(char* node) +_cfg *MiavConfig::findNode(const char* node) { _cfg *cfg = configs; diff --git a/src/miav_config.h b/src/miav_config.h index a8658f1..ddd1375 100644 --- a/src/miav_config.h +++ b/src/miav_config.h @@ -64,13 +64,13 @@ typedef struct __cfg { class MiavConfig { public: - MiavConfig(char *file, Info *info = NULL); + MiavConfig(const char *file, Info *info = NULL); ~MiavConfig(); - int readInt(char *node); - bool readBool(char *node); - string *readString(char *node); - float readFloat(char *node); + int readInt(const char *node); + bool readBool(const char *node); + string *readString(const char *node); + float readFloat(const char *node); protected: Info *info; @@ -88,8 +88,8 @@ protected: char *strip(char* conf); #endif - void parseError(char* msg, _cfg *cfg); - _cfg *findNode(char* node); + void parseError(const char* msg, _cfg *cfg); + _cfg *findNode(const char* node); _cfg *configs; }; diff --git a/src/miav_daemon.cc b/src/miav_daemon.cc index 500e92a..c044ed9 100644 --- a/src/miav_daemon.cc +++ b/src/miav_daemon.cc @@ -36,6 +36,8 @@ #include #include +#include + MiavDaemon::MiavDaemon() {} diff --git a/src/mov_encoder.cc b/src/mov_encoder.cc index 6ac5876..4794561 100644 --- a/src/mov_encoder.cc +++ b/src/mov_encoder.cc @@ -75,7 +75,7 @@ void MovEncoder::thread_main() info->info("MovEncoder::run"); // Run with slightly lower priority than MovEncoderWriter AND AudioEncoder - nice(2); + if(nice(2) == -1) info->warn("Could not set MovEncoder nice."); FrameVector *item; Frame *in_frame; diff --git a/src/multicast.cc b/src/multicast.cc index 0072c19..2f3e7a8 100644 --- a/src/multicast.cc +++ b/src/multicast.cc @@ -38,6 +38,8 @@ #include #include +#include + // For IP_MTU //#include //#ifndef IP_MTU @@ -106,7 +108,9 @@ int Multicast::Write(void* buf, int size) if(left == 0) { // info->info("Sending full packet"); - write(sock, udp_buffer, udp_buffer_size); + if(write(sock, udp_buffer, udp_buffer_size) != udp_buffer_size) { + info->error("Could not write entire buffer to socket."); + } left = udp_buffer_size; udp_buffer_pointer = udp_buffer; } diff --git a/src/multicast_configuration.cc b/src/multicast_configuration.cc index 969faca..217b959 100644 --- a/src/multicast_configuration.cc +++ b/src/multicast_configuration.cc @@ -27,7 +27,9 @@ #include "config.h" #include "multicast_configuration.h" -MulticastConfiguration::MulticastConfiguration(Info *info, char *file) +#include + +MulticastConfiguration::MulticastConfiguration(Info *info, const char *file) : MiavConfig(file, info) { mcastconf_t conf; diff --git a/src/multicast_configuration.h b/src/multicast_configuration.h index 3fa7ef1..b95e503 100644 --- a/src/multicast_configuration.h +++ b/src/multicast_configuration.h @@ -43,7 +43,7 @@ typedef struct { class MulticastConfiguration : private MiavConfig { public: - MulticastConfiguration(Info *info, char *file); + MulticastConfiguration(Info *info, const char *file); ~MulticastConfiguration(); mcastconf_t &getConf(char *client); diff --git a/src/multiplexer.cc b/src/multiplexer.cc index 7a8b095..de6180f 100644 --- a/src/multiplexer.cc +++ b/src/multiplexer.cc @@ -118,18 +118,18 @@ int Multiplexer::Write(unsigned long long int val) { int res; int written = 0; - unsigned long int *h_u = (unsigned long int *)&val; - unsigned long int *h_l = (unsigned long int *)(((char*)&val) + sizeof(unsigned long int)); + unsigned long int h_u = val & 0xffffffff; + unsigned long int h_l = (val << 32) & 0xffffffff; - *h_u = htonl(*h_u); - *h_l = htonl(*h_l); + h_u = htonl(h_u); + h_l = htonl(h_l); - if((res = Write((void*)h_l, sizeof(*h_l))) < 0) { + if((res = Write(&h_l, sizeof(h_l))) < 0) { return res; } written += res; - if((res = Write((void*)h_u, sizeof(*h_u))) < 0) { + if((res = Write(&h_u, sizeof(h_u))) < 0) { return res; } written += res; @@ -141,18 +141,18 @@ int Multiplexer::Write(long long int val) { int res; int written = 0; - unsigned long int *h_u = (unsigned long int *)&val; - unsigned long int *h_l = (unsigned long int *)(((char*)&val) + sizeof(unsigned long int)); + unsigned long int h_u = val & 0xffffffff; + unsigned long int h_l = (val << 32) & 0xffffffff; - *h_u = htonl(*h_u); - *h_l = htonl(*h_l); + h_u = htonl(h_u); + h_l = htonl(h_l); - if((res = Write((void*)h_l, sizeof(*h_l))) < 0) { + if((res = Write(&h_l, sizeof(h_l))) < 0) { return res; } written += res; - if((res = Write((void*)h_u, sizeof(*h_u))) < 0) { + if((res = Write(&h_u, sizeof(h_u))) < 0) { return res; } written += res; @@ -275,14 +275,15 @@ bool Multiplexer::packet(StreamType type) } ISO11172_1::packet_header header; - header.marker_bit1 = header.marker_bit2 = header.marker_bit3 = 1; - header.padding = 0x2; // Must be 2 - header.stuffing_byte = 0xFF; - header.packet_length = framesize + sizeof(ISO11172_1::packet_header) - sizeof(short); - header.system_clock_reference1 = TIMECODE32_30(SCR); - header.system_clock_reference2 = TIMECODE29_15(SCR); - header.system_clock_reference3 = TIMECODE14_0(SCR); - Write(*((unsigned long long int*)&header)); + header.bits.marker_bit1 = header.bits.marker_bit2 = + header.bits.marker_bit3 = 1; + header.bits.padding = 0x2; // Must be 2 + header.bits.stuffing_byte = 0xFF; + header.bits.packet_length = framesize + sizeof(ISO11172_1::packet_header) - sizeof(short); + header.bits.system_clock_reference1 = TIMECODE32_30(SCR); + header.bits.system_clock_reference2 = TIMECODE29_15(SCR); + header.bits.system_clock_reference3 = TIMECODE14_0(SCR); + Write(header.ulli); Write(buf, framesize); @@ -351,34 +352,35 @@ void Multiplexer::system_header() ISO11172_1::system_header header; - header.marker_bit1 = header.marker_bit2 = header.marker_bit3 = 1; + header.bits.marker_bit1 = header.bits.marker_bit2 = + header.bits.marker_bit3 = 1; - header.header_length = 8 - 2 + (NUM_TYPES * 3); + header.bits.header_length = 8 - 2 + (NUM_TYPES * 3); // (sizeof(header) - sizeof(header.header_length)) + // NUM_TYPES * sizeof(ISO11172_1::stream_description); - header.rate_bound = 3521; // FIXME: Taken from the example! - header.audio_bound = 1; // Only 1 audio stream - header.fixed_flag = 1; // Fixed bitrate (0 indicates vbr) - header.CSPS_flag = 1; // Standarts compliant? (yes: see lame_set_strict_ISO in liblame_wrapper.cc) - header.system_audio_clock_flag = 1; // FIXME: What excactly is this?? - header.system_video_clock_flag = 1; // FIXME: What excactly is this?? - header.video_bound = 1; // Only 1 video stream - header.reserved_byte = 0xFF; // Must be 0xFF - Write(*((unsigned long long int*)&header)); + header.bits.rate_bound = 3521; // FIXME: Taken from the example! + header.bits.audio_bound = 1; // Only 1 audio stream + header.bits.fixed_flag = 1; // Fixed bitrate (0 indicates vbr) + header.bits.CSPS_flag = 1; // Standarts compliant? (yes: see lame_set_strict_ISO in liblame_wrapper.cc) + header.bits.system_audio_clock_flag = 1; // FIXME: What excactly is this?? + header.bits.system_video_clock_flag = 1; // FIXME: What excactly is this?? + header.bits.video_bound = 1; // Only 1 video stream + header.bits.reserved_byte = 0xFF; // Must be 0xFF + Write(header.ulli); ISO11172_1::stream_description audio_stream_description; - audio_stream_description.stream_id = 0xC0; - audio_stream_description.market_bits = 0x3; - audio_stream_description.STD_buffer_bound_scale = 0; // Must be 0 for audio streams - audio_stream_description.STD_buffer_size_bound = 32; // Buffer must be 32 * 128 bytes - Write(*((unsigned long int*)&audio_stream_description)); + audio_stream_description.bits.stream_id = 0xC0; + audio_stream_description.bits.market_bits = 0x3; + audio_stream_description.bits.STD_buffer_bound_scale = 0; // Must be 0 for audio streams + audio_stream_description.bits.STD_buffer_size_bound = 32; // Buffer must be 32 * 128 bytes + Write(audio_stream_description.uli); ISO11172_1::stream_description video_stream_description; - video_stream_description.stream_id = 0xE3; - video_stream_description.market_bits = 0x3; - video_stream_description.STD_buffer_bound_scale = 1; // Must be 1 for video streams - video_stream_description.STD_buffer_size_bound = 46; // Buffer must be 32 * 1024 bytes - Write(*((unsigned long int*)&video_stream_description)); + video_stream_description.bits.stream_id = 0xE3; + video_stream_description.bits.market_bits = 0x3; + video_stream_description.bits.STD_buffer_bound_scale = 1; // Must be 1 for video streams + video_stream_description.bits.STD_buffer_size_bound = 46; // Buffer must be 32 * 1024 bytes + Write(video_stream_description.uli); } /** @@ -392,13 +394,13 @@ bool Multiplexer::pack() ISO11172_1::pack_header header; // Set marker bits to 1 - header.marker_bit1 = - header.marker_bit2 = - header.marker_bit3 = - header.marker_bit4 = - header.marker_bit5 = 1; + header.bits.marker_bit1 = + header.bits.marker_bit2 = + header.bits.marker_bit3 = + header.bits.marker_bit4 = + header.bits.marker_bit5 = 1; - header.padding = 0x2; + header.bits.padding = 0x2; unsigned int video_data_rate; unsigned int audio_data_rate; @@ -416,7 +418,7 @@ bool Multiplexer::pack() PACKETS_PER_PACK, // packets_per_pack, PACKET_SIZE);// packet_data_size) - header.mux_rate = Rmux; + header.bits.mux_rate = Rmux; //0x1B82; SCR = ISO11172_1::SCR(SCR, @@ -427,9 +429,9 @@ bool Multiplexer::pack() // SCR = 0x40010003LL; - header.system_clock_reference1 = TIMECODE32_30(SCR); - header.system_clock_reference2 = TIMECODE29_15(SCR); - header.system_clock_reference3 = TIMECODE14_0(SCR); + header.bits.system_clock_reference1 = TIMECODE32_30(SCR); + 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", SCR, @@ -438,7 +440,7 @@ bool Multiplexer::pack() (unsigned long long int)header.system_clock_reference3 ); */ - Write(*((unsigned long long int*)&header)); + Write(header.ulli); if(write_system_header % SYSTEM_HEADER_FREQUENCY == 0) system_header(); // Count this up here, we want a system header in pack 0, 5, ... NOT 4, 9, ... diff --git a/src/server.cc b/src/server.cc index 34aac7b..3655d33 100644 --- a/src/server.cc +++ b/src/server.cc @@ -86,7 +86,7 @@ void newConnection(Socket *socket, Info *info) frame->mute = h.header.h_data.mute; if(!hasCpr) { - sprintf(cpr, h.header.h_data.cpr); + sprintf(cpr, "%s", h.header.h_data.cpr); hasCpr = true; } -- cgit v1.2.3