Commit 2b7e5dfa authored by Ghislain MARY's avatar Ghislain MARY

Fix compilation warnings when building with Visual Studio.

parent 036fed7a
......@@ -113,7 +113,7 @@ typedef struct _IceSession {
IceRole role; /**< Role played by the agent for this session */
IceSessionState state; /**< State of the session */
uint64_t tie_breaker; /**< Random number used to resolve role conflicts (see paragraph 5.2 of the RFC 5245) */
uint32_t ta; /**< Duration of timer for sending connectivity checks in ms */
int32_t ta; /**< Duration of timer for sending connectivity checks in ms */
int event_value; /** Value of the event to send */
MSTimeSpec event_time; /**< Time when an event must be sent */
struct sockaddr_storage ss; /**< STUN server address to use for the candidates gathering process */
......@@ -188,7 +188,7 @@ typedef struct _IceCandidatePair {
IceCandidatePairState state; /**< State of the candidate pair */
uint64_t priority; /**< Priority of the candidate pair */
MSTimeSpec transmission_time; /**< Time when the connectivity check for the candidate pair has been sent */
uint32_t rto; /**< Duration of the retransmit timer for the connectivity check sent for the candidate pair in ms */
int32_t rto; /**< Duration of the retransmit timer for the connectivity check sent for the candidate pair in ms */
uint8_t retransmissions; /**< Number of retransmissions for the connectivity check sent for the candidate pair */
IceRole role; /**< Role of the agent when the connectivity check has been sent for the candidate pair */
bool_t is_default; /**< Boolean value telling whether this candidate pair is a default candidate pair or not */
......
......@@ -35,7 +35,7 @@ typedef struct _MSConcealerContext MSConcealerContext;
* Creates a new concealer object.
* @param max_plc_count the number of consecutive milliseconds of PLC allowed.
**/
MS2_PUBLIC MSConcealerContext* ms_concealer_context_new(unsigned int max_plc_count);
MS2_PUBLIC MSConcealerContext* ms_concealer_context_new(uint32_t max_plc_count);
/**
* Destroys a concealer object.
**/
......@@ -46,7 +46,7 @@ MS2_PUBLIC void ms_concealer_context_destroy(MSConcealerContext* context);
* @param obj the concealer object
* @param current_time the current time in milliseconds, as pointed by f->ticker->time .
**/
MS2_PUBLIC unsigned int ms_concealer_context_is_concealement_required(MSConcealerContext* obj,uint64_t current_time);
MS2_PUBLIC unsigned int ms_concealer_context_is_concealement_required(MSConcealerContext* obj, uint64_t current_time);
/**
* Call this function whenever you decoded a packet, for true or in PLC mode, to inform the concealer
......@@ -54,10 +54,10 @@ MS2_PUBLIC unsigned int ms_concealer_context_is_concealement_required(MSConceale
* @param obj the concealer object
* @param current_time the current time in milliseconds, as pointed by f->ticker->time.
* @param time_increment the number of milliseconds of audio decoded.
* @param got_packet set to 1 if a real frame was decoded, 0 if it was a PLC frame.
* @param got_packet set to TRUE if a real frame was decoded, FALSE if it was a PLC frame.
* @return if a PLC period terminates, returns the duration of this PLC period in milliseconds, 0 otherwise.
**/
MS2_PUBLIC int ms_concealer_inc_sample_time(MSConcealerContext* obj, uint64_t current_time, int time_increment, int got_packet);
MS2_PUBLIC uint32_t ms_concealer_inc_sample_time(MSConcealerContext* obj, uint64_t current_time, uint32_t time_increment, bool_t got_packet);
MS2_PUBLIC unsigned long ms_concealer_context_get_total_number_of_plc(MSConcealerContext* obj);
......@@ -91,10 +91,10 @@ MS2_PUBLIC unsigned int ms_concealer_ts_context_is_concealement_required(MSConce
* @param obj the concealer object
* @param current_ts the current time converted in timestamp units, usually (f->ticker->time*clock_rate)/1000
* @param ts_increment the duration of audio decoded expressed in timestamp units
* @param got_packet set to 1 if a real frame was decoded, 0 if it was a PLC frame.
* @param got_packet set to TRUE if a real frame was decoded, FALSE if it was a PLC frame.
* @return if a PLC period terminates, returns the duration of this PLC period in timestamp units, 0 otherwise.
**/
MS2_PUBLIC int ms_concealer_ts_context_inc_sample_ts(MSConcealerTsContext* obj, uint64_t current_ts, int ts_increment, int got_packet);
MS2_PUBLIC int ms_concealer_ts_context_inc_sample_ts(MSConcealerTsContext* obj, uint64_t current_ts, uint32_t ts_increment, bool_t got_packet);
MS2_PUBLIC unsigned long ms_concealer_ts_context_get_total_number_of_plc(MSConcealerTsContext* obj);
......
......@@ -220,7 +220,7 @@ MS2_PUBLIC MSList * ms_list_remove_custom(MSList *list, MSCompareFunc compare_fu
* @param list List to measure
* @return Size of list
**/
MS2_PUBLIC int ms_list_size(const MSList *list);
MS2_PUBLIC size_t ms_list_size(const MSList *list);
/** Invoke function on each element of the list
* @param list List object
......
......@@ -678,7 +678,7 @@ the method index (_cnt_) and the argument size */
#define MS_FILTER_GET_LATENCY MS_FILTER_BASE_METHOD(11,int)
typedef struct _MSPinFormat{
int pin;
uint16_t pin;
const MSFmtDescriptor *fmt;
}MSPinFormat;
......
......@@ -135,7 +135,7 @@ typedef enum _MSPlayerState MSPlayerState;
MS_FILTER_METHOD(MSFilterPlayerInterface,7,int)
#define MS_PLAYER_GET_CURRENT_POSITION \
MS_FILTER_METHOD(MSFilterPlayerInterface,8,int)
MS_FILTER_METHOD(MSFilterPlayerInterface,8,int64_t)
#define MS_PLAYER_EOF \
MS_FILTER_EVENT_NO_ARG(MSFilterPlayerInterface,0)
......
......@@ -139,7 +139,7 @@ MS2_PUBLIC void ms_bufferizer_put(MSBufferizer *obj, mblk_t *m);
MS2_PUBLIC void ms_bufferizer_put_from_queue(MSBufferizer *obj, MSQueue *q);
/*read bytes from bufferizer object*/
MS2_PUBLIC int ms_bufferizer_read(MSBufferizer *obj, uint8_t *data, int datalen);
MS2_PUBLIC size_t ms_bufferizer_read(MSBufferizer *obj, uint8_t *data, size_t datalen);
/*obtain current meta-information of the last read bytes (if any) and copy them into 'm'*/
MS2_PUBLIC void ms_bufferizer_fill_current_metas(MSBufferizer *obj, mblk_t *m);
......
......@@ -286,7 +286,9 @@ void deinterlace_down_scale_neon(const uint8_t* ysrc, const uint8_t* cbcrsrc, ui
MS2_PUBLIC mblk_t *copy_ycbcrbiplanar_to_true_yuv_with_rotation_and_down_scale_by_2(MSYuvBufAllocator *allocator, const uint8_t* y, const uint8_t * cbcr, int rotation, int w, int h, int y_byte_per_row,int cbcr_byte_per_row, bool_t uFirstvSecond, bool_t down_scale);
static MS2_INLINE MSVideoSize ms_video_size_make(int width, int height){
MSVideoSize vsize={width,height};
MSVideoSize vsize;
vsize.width = width;
vsize.height = height;
return vsize;
}
......@@ -367,28 +369,28 @@ MS2_PUBLIC mblk_t *copy_ycbcrbiplanar_to_true_yuv_with_rotation(MSYuvBufAllocato
/*** Encoder Helpers ***/
/* Frame rate controller */
struct _MSFrameRateController {
unsigned int start_time;
uint64_t start_time;
int th_frame_count;
float fps;
};
typedef struct _MSFrameRateController MSFrameRateController;
MS2_PUBLIC void ms_video_init_framerate_controller(MSFrameRateController* ctrl, float fps);
MS2_PUBLIC bool_t ms_video_capture_new_frame(MSFrameRateController* ctrl, uint32_t current_time);
MS2_PUBLIC bool_t ms_video_capture_new_frame(MSFrameRateController* ctrl, uint64_t current_time);
/* Average FPS calculator */
struct _MSAverageFPS {
unsigned int last_frame_time, last_print_time;
uint64_t last_frame_time, last_print_time;
float mean_inter_frame;
const char* context;
};
typedef struct _MSAverageFPS MSAverageFPS;
MS2_PUBLIC void ms_average_fps_init(MSAverageFPS* afps, const char* context);
MS2_PUBLIC bool_t ms_average_fps_update(MSAverageFPS* afps, uint32_t current_time);
MS2_PUBLIC bool_t ms_average_fps_update(MSAverageFPS* afps, uint64_t current_time);
MS2_PUBLIC float ms_average_fps_get(const MSAverageFPS* afps);
/*deprecated: for compatibility with plugin*/
MS2_PUBLIC void ms_video_init_average_fps(MSAverageFPS* afps, const char* ctx);
MS2_PUBLIC bool_t ms_video_update_average_fps(MSAverageFPS* afps, uint32_t current_time);
MS2_PUBLIC bool_t ms_video_update_average_fps(MSAverageFPS* afps, uint64_t current_time);
/**
......
......@@ -143,7 +143,7 @@ static void enc_process (MSFilter *f){
short *buf= NULL;
mblk_t *inputMessage = NULL, *outputMessage = NULL;
int frame_per_packet=s->ptime/5;
int in_rcvd_bytes = 0;
size_t in_rcvd_bytes = 0;
in_rcvd_bytes = SIGNAL_FRAME_SIZE * frame_per_packet;
buf=(short*)alloca(in_rcvd_bytes);
......
......@@ -52,7 +52,7 @@ plc_context_t *generic_plc_create_context(int sample_rate) {
/* initialise hamming window : h(t) = 0.75 - 0.25*cos(2pi*t/T) */
for(i=0; i<sample_rate*PLC_BUFFER_LEN; i++) {
context->hamming_window[i] = 0.75 - 0.25*cos( 2*PI*i/(sample_rate*PLC_BUFFER_LEN));
context->hamming_window[i] = (float)(0.75 - 0.25*cos( 2*PI*i/(sample_rate*PLC_BUFFER_LEN)));
}
return context;
......@@ -75,7 +75,7 @@ void generic_plc_fftbf(plc_context_t *context, int16_t *input_buffer, int16_t *o
ms_word16_t *freq_domain_buffer = ms_malloc0(input_buffer_len*sizeof(ms_word16_t));
ms_word16_t *freq_domain_buffer_double = ms_malloc0(2*input_buffer_len*sizeof(ms_word16_t));
ms_word16_t *time_domain_buffer_double = ms_malloc0(2*input_buffer_len*sizeof(ms_word16_t));
int i;
size_t i;
/* convert to ms_word16_t the input buffer */
for (i=0; i<input_buffer_len; i++) {
......@@ -106,8 +106,8 @@ void generic_plc_fftbf(plc_context_t *context, int16_t *input_buffer, int16_t *o
ms_free(time_domain_buffer_double);
}
void generic_plc_generate_samples(plc_context_t *context, int16_t *data, size_t sample_nbr) {
size_t continuity_buffer_sample_nbr = context->sample_rate*TRANSITION_DELAY/1000;
void generic_plc_generate_samples(plc_context_t *context, int16_t *data, uint16_t sample_nbr) {
uint16_t continuity_buffer_sample_nbr = context->sample_rate*TRANSITION_DELAY/1000;
/* shall we just set everything to 0 */
if (context->plc_samples_used>=MAX_PLC_LEN*context->sample_rate/1000) {
......@@ -209,8 +209,8 @@ void generic_plc_update_continuity_buffer(plc_context_t *context, unsigned char
/** Transition mix function, mix last received data with local generated one for smooth transition */
void generic_plc_transition_mix(int16_t *inout_buffer, int16_t *continuity_buffer, size_t fading_sample_nbr) {
int i;
void generic_plc_transition_mix(int16_t *inout_buffer, int16_t *continuity_buffer, uint16_t fading_sample_nbr) {
uint16_t i;
for (i=0; i<fading_sample_nbr; i++) {
float progress = ((float) i)/fading_sample_nbr;
inout_buffer[i] = (int16_t)((float)continuity_buffer[i]*(1-progress) + (float)inout_buffer[i]*progress);
......
......@@ -33,7 +33,7 @@
/* length in ms of the incoming signal used to adjust energy of PLC generated signal */
#define ENERGY_ADJUSTMENT_WINDOW 10
#define ENERGY_ATTENUATION 0.85
#define ENERGY_ATTENUATION 0.85f
typedef struct {
unsigned char *continuity_buffer; /**< buffer used to store a small set of future samples */
......@@ -51,9 +51,9 @@ typedef struct {
plc_context_t *generic_plc_create_context(int sample_rate);
void generic_plc_destroy_context(plc_context_t *context);
void generic_plc_transition_mix(int16_t *inout_buffer, int16_t *continuity_buffer, size_t fading_sample_nbr);
void generic_plc_transition_mix(int16_t *inout_buffer, int16_t *continuity_buffer, uint16_t fading_sample_nbr);
void generic_plc_fftbf(plc_context_t *context, int16_t *input_buffer, int16_t *output_buffer, size_t input_buffer_len);
void generic_plc_generate_samples(plc_context_t *context, int16_t *data, size_t sample_nbr);
void generic_plc_generate_samples(plc_context_t *context, int16_t *data, uint16_t sample_nbr);
void generic_plc_update_plc_buffer(plc_context_t *context, unsigned char *data, size_t data_len);
void generic_plc_update_continuity_buffer(plc_context_t *context, unsigned char *data, size_t data_len);
......
......@@ -25,7 +25,7 @@ struct EncState {
int ptime;
int rate;
int nchannels;
int nbytes;
size_t nbytes;
MSBufferizer *bufferizer;
};
......
......@@ -233,7 +233,7 @@ static void ms_opus_enc_process(MSFilter *f) {
}
ms_bufferizer_put_from_queue(d->bufferizer, f->inputs[0]);
while (ms_bufferizer_get_avail(d->bufferizer) >= (d->channels * packet_size * SIGNAL_SAMPLE_SIZE)) {
while (ms_bufferizer_get_avail(d->bufferizer) >= (size_t)(d->channels * packet_size * SIGNAL_SAMPLE_SIZE)) {
opus_int32 ret = 0;
if (frame_count == 1) { /* One Opus frame, not using the repacketizer */
......
......@@ -486,7 +486,7 @@ static void volume_process(MSFilter *f){
*/
if (v->agc_enabled || v->peer!=NULL){
mblk_t *om;
int nbytes=v->nsamples*2;
size_t nbytes=(size_t)(v->nsamples*2);
ms_bufferizer_put_from_queue(v->buffer,f->inputs[0]);
while(ms_bufferizer_get_avail(v->buffer)>=nbytes){
om=allocb(nbytes,0);
......
......@@ -586,13 +586,13 @@ static void winsnd_write_process(MSFilter *f){
WAVEHDR *hdr=&d->hdrs_write[outcurbuf];
old=(mblk_t*)hdr->dwUser;
if (d->nsamples==0){
int tmpsize=WINSND_OUT_DELAY*d->wfx.nAvgBytesPerSec;
int tmpsize=(int)WINSND_OUT_DELAY*d->wfx.nAvgBytesPerSec;
mblk_t *tmp=allocb(tmpsize,0);
memset(tmp->b_wptr,0,tmpsize);
tmp->b_wptr+=tmpsize;
playout_buf(d,hdr,tmp);
d->outcurbuf++;
d->nsamples+=WINSND_OUT_DELAY*d->wfx.nSamplesPerSec;
d->nsamples+=(int)(WINSND_OUT_DELAY*d->wfx.nSamplesPerSec);
continue;
}
m=ms_queue_get(f->inputs[0]);
......
......@@ -136,8 +136,8 @@ MSList * ms_list_remove_custom(MSList *first, MSCompareFunc compare_func, const
return first;
}
int ms_list_size(const MSList *first){
int n=0;
size_t ms_list_size(const MSList *first){
size_t n=0;
while(first!=NULL){
++n;
first=first->next;
......@@ -431,7 +431,7 @@ struct _MSConcealerContext {
int64_t sample_time;
int64_t plc_start_time;
unsigned long total_number_for_plc;
unsigned int max_plc_time;
uint32_t max_plc_time;
};
/*** plc context begin***/
......@@ -439,7 +439,7 @@ unsigned long ms_concealer_context_get_total_number_of_plc(MSConcealerContext* o
return obj->total_number_for_plc;
}
MSConcealerContext* ms_concealer_context_new(unsigned int max_plc_time){
MSConcealerContext* ms_concealer_context_new(uint32_t max_plc_time){
MSConcealerContext *obj=(MSConcealerContext *) ms_new0(MSConcealerContext,1);
obj->sample_time=-1;
obj->plc_start_time=-1;
......@@ -452,29 +452,28 @@ void ms_concealer_context_destroy(MSConcealerContext* context) {
ms_free(context);
}
int ms_concealer_inc_sample_time(MSConcealerContext* obj, uint64_t current_time, int time_increment, int got_packet){
int plc_duration=0;
uint32_t ms_concealer_inc_sample_time(MSConcealerContext* obj, uint64_t current_time, uint32_t time_increment, bool_t got_packet){
uint32_t plc_duration=0;
if (obj->sample_time==-1){
obj->sample_time=(int64_t)current_time;
}
obj->sample_time+=time_increment;
if (obj->plc_start_time!=-1 && got_packet){
plc_duration=(int)(current_time-obj->plc_start_time);
plc_duration=(uint32_t)(current_time-obj->plc_start_time);
obj->plc_start_time=-1;
if (plc_duration>obj->max_plc_time) plc_duration=obj->max_plc_time;
}
return plc_duration;
}
unsigned int ms_concealer_context_is_concealement_required(MSConcealerContext* obj,uint64_t current_time) {
unsigned int ms_concealer_context_is_concealement_required(MSConcealerContext* obj, uint64_t current_time) {
if(obj->sample_time == -1) return 0; /*no valid value*/
if (obj->sample_time <= current_time){
int plc_duration;
if ((uint64_t)obj->sample_time <= current_time){
uint32_t plc_duration;
if (obj->plc_start_time==-1)
obj->plc_start_time=obj->sample_time;
plc_duration=current_time-obj->plc_start_time;
plc_duration=(uint32_t)(current_time-(uint64_t)obj->plc_start_time);
if (plc_duration<obj->max_plc_time) {
obj->total_number_for_plc++;
return 1;
......@@ -513,14 +512,14 @@ void ms_concealer_ts_context_destroy(MSConcealerTsContext* context) {
ms_free(context);
}
int ms_concealer_ts_context_inc_sample_ts(MSConcealerTsContext* obj, uint64_t current_ts, int ts_increment, int got_packet){
int plc_duration=0;
uint32_t ms_concealer_ts_context_inc_sample_ts(MSConcealerTsContext* obj, uint64_t current_ts, uint32_t ts_increment, bool_t got_packet){
uint32_t plc_duration=0;
if (obj->sample_ts==-1){
obj->sample_ts=(int64_t)current_ts;
}
obj->sample_ts+=ts_increment;
if (obj->plc_start_ts!=-1 && got_packet){
plc_duration=current_ts-obj->plc_start_ts;
plc_duration=(uint32_t)(current_ts-(uint64_t)obj->plc_start_ts);
obj->plc_start_ts=-1;
if (plc_duration>obj->max_plc_ts) plc_duration=obj->max_plc_ts;
}
......@@ -530,11 +529,11 @@ int ms_concealer_ts_context_inc_sample_ts(MSConcealerTsContext* obj, uint64_t cu
unsigned int ms_concealer_ts_context_is_concealement_required(MSConcealerTsContext* obj, uint64_t current_ts) {
if(obj->sample_ts == -1) return 0; /*no valid value*/
if (obj->sample_ts < current_ts){
int plc_duration;
if ((uint64_t)obj->sample_ts < current_ts){
uint32_t plc_duration;
if (obj->plc_start_ts==-1)
obj->plc_start_ts=obj->sample_ts;
plc_duration=current_ts-obj->plc_start_ts;
plc_duration=(uint32_t)(current_ts-(uint64_t)obj->plc_start_ts);
if (plc_duration<obj->plc_start_ts) {
obj->total_number_for_plc++;
return 1;
......
......@@ -77,17 +77,17 @@ void ms_bufferizer_put_from_queue(MSBufferizer *obj, MSQueue *q){
}
}
int ms_bufferizer_read(MSBufferizer *obj, uint8_t *data, int datalen){
size_t ms_bufferizer_read(MSBufferizer *obj, uint8_t *data, size_t datalen){
if (obj->size>=datalen){
/*we can return something */
int sz=0;
int cplen;
size_t sz=0;
size_t cplen;
mblk_t *m=peekq(&obj->q);
/* first store current meta information in the _q_stopper field the queue, just to reuse space*/
mblk_meta_copy(m, &obj->q._q_stopper);
while(sz<datalen){
cplen=MIN((int)(m->b_wptr-m->b_rptr),datalen-sz);
cplen=MIN((size_t)(m->b_wptr-m->b_rptr),datalen-sz);
if (data) memcpy(data+sz,m->b_rptr,cplen);
sz+=cplen;
m->b_rptr+=cplen;
......
......@@ -344,7 +344,7 @@ static int ms_zrtp_addExportedKeysInZidCache(void *zidCacheData, void *clientDat
if (zidCache->peerURI) {
/* Write the peer sip URI in cache */
bzrtp_addCustomDataInCache(zrtpContext, peerZid, (uint8_t *)"uri", 3, (uint8_t *)(zidCache->peerURI), strlen(zidCache->peerURI), 0, BZRTP_CUSTOMCACHE_PLAINDATA, BZRTP_CACHE_LOADFILE|BZRTP_CACHE_DONTWRITEFILE);
bzrtp_addCustomDataInCache(zrtpContext, peerZid, (uint8_t *)"uri", 3, (uint8_t *)(zidCache->peerURI), (uint16_t)strlen(zidCache->peerURI), 0, BZRTP_CUSTOMCACHE_PLAINDATA, BZRTP_CACHE_LOADFILE|BZRTP_CACHE_DONTWRITEFILE);
}
/* Derive the master keys and session Id 32 bytes each */
......
......@@ -191,7 +191,7 @@ static void ms_rtt_4103_source_preprocess(MSFilter *f) {
static void ms_rtt_4103_source_process(MSFilter *f) {
RealTimeTextSourceData *s = (RealTimeTextSourceData *)f->data;
uint32_t timestamp = f->ticker->time;
uint32_t timestamp = (uint32_t)f->ticker->time;
mblk_t *m;
ms_filter_lock(f);
......
......@@ -84,7 +84,7 @@ int ms_bits_reader_ue(MSBitsReader *reader, unsigned int* ret, const char* symbo
unsigned int value;
if (ms_bits_reader_n_bits(reader, leading_zeros_cnt, &trail, 0) != 0)
return -1;
value = pow(2, leading_zeros_cnt) - 1 + trail;
value = (unsigned int)pow(2, leading_zeros_cnt) - 1 + trail;
if (symbol_name)
ms_debug(".%s (ue) : 0x%x | %u", symbol_name, value, value);
if (ret)
......@@ -103,7 +103,7 @@ int ms_bits_reader_se(MSBitsReader *reader, int* ret, const char* symbol_name) {
return -1;
sign = (code_num % 2) ? 1 : -1;
value = sign * ceil(code_num / 2.0f);
value = (int)(sign * ceil(code_num / 2.0f));
if (symbol_name)
ms_debug(".%s (se) : 0x%x | %d [%x", symbol_name, value, value, code_num);
if (ret)
......@@ -131,7 +131,7 @@ int ms_bits_writer_n_bits(MSBitsWriter *writer, int count, unsigned int value, c
}
/* resize if necessary */
if (writer->bit_index + count > writer->buf_size * 8) {
if ((size_t)(writer->bit_index + count) > writer->buf_size * 8) {
int old_size = writer->buf_size;
writer->buf_size = MAX(2 * (writer->buf_size + 1), writer->buf_size + count / 8);
writer->buffer = (uint8_t*) realloc(writer->buffer, writer->buf_size);
......
......@@ -34,6 +34,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#pragma GCC diagnostic ignored "-Wunused-function"
#endif
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4244)
#endif
#include <ortp/port.h>
......@@ -148,4 +153,9 @@ void av_frame_unref (AVFrame *frame);
#endif /*iHAVE_LIBAVCODEC_AVCODEC_H*/
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif /* FFMPEG_PRIV_H */
......@@ -55,7 +55,7 @@ static void push_nalu(const uint8_t *begin, const uint8_t *end, MSQueue *nalus)
}
void ms_h264_bitstream_to_nalus(const uint8_t *bitstream, size_t size, MSQueue *nalus){
int i;
size_t i;
const uint8_t *p,*begin=NULL;
int zeroes=0;
......
......@@ -17,13 +17,13 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "mkv_reader.h"
#define bool_t mkv_bool_t
#include <matroska/matroska.h>
#include <matroska/matroska_sem.h>
#undef bool_t
#include "mkv_reader.h"
extern const nodemeta LangStr_Class[];
extern const nodemeta UrlPart_Class[];
extern const nodemeta BufStream_Class[];
......@@ -219,7 +219,7 @@ int mkv_reader_seek(MKVReader *reader, int pos_ms) {
for(track_position=EBML_MasterFindChild((ebml_master *)cue_point, &MATROSKA_ContextCueTrackPositions);
track_position!=NULL;
track_position = EBML_MasterFindNextElt((ebml_master *)cue_point, track_position, FALSE, FALSE)) {
int track_num = EBML_IntegerValue((ebml_integer *)EBML_MasterFindChild((ebml_master *)track_position, &MATROSKA_ContextCueTrack));
int track_num = (int)EBML_IntegerValue((ebml_integer *)EBML_MasterFindChild((ebml_master *)track_position, &MATROSKA_ContextCueTrack));
MKVTrackReader *t_reader = NULL;
for(it = reader->readers; it != NULL; it=it->next) {
t_reader = (MKVTrackReader *)it->data;
......@@ -290,15 +290,15 @@ void mkv_track_reader_next_block(MKVTrackReader *reader, MKVBlock **block, bool_
if(EBML_ElementIsType(reader->current_frame_elt, &MATROSKA_ContextBlockGroup)) {
ebml_element *codec_state_elt = EBML_MasterFindChild(reader->current_frame_elt, &MATROSKA_ContextCodecState);
if(codec_state_elt) {
(*block)->codec_state_size = EBML_ElementDataSize(codec_state_elt, FALSE);
(*block)->codec_state_size = (size_t)EBML_ElementDataSize(codec_state_elt, FALSE);
(*block)->codec_state_data = ms_new0(uint8_t, (*block)->codec_state_size);
memcpy((*block)->codec_state_data, EBML_BinaryGetData((ebml_binary *)codec_state_elt), (*block)->codec_state_size);
}
}
(*block)->keyframe = MATROSKA_BlockKeyframe(block_elt);
(*block)->track_num = MATROSKA_BlockTrackNum(block_elt);
(*block)->keyframe = (bool_t)MATROSKA_BlockKeyframe(block_elt);
(*block)->track_num = (uint8_t)MATROSKA_BlockTrackNum(block_elt);
MATROSKA_BlockGetFrame(block_elt, 0, &m_frame, TRUE);
(*block)->timestamp = MATROSKA_BlockTimecode(block_elt) / 1000000LL;
(*block)->timestamp = (uint32_t)(MATROSKA_BlockTimecode(block_elt) / 1000000LL);
(*block)->data_length = m_frame.Size;
(*block)->data = ms_new0(uint8_t, m_frame.Size);
memcpy((*block)->data, m_frame.Data, m_frame.Size);
......@@ -385,7 +385,7 @@ static int _parse_headers(MKVReader *obj) {
ms_error("MKVParser: not a matroska file");
goto fail;
}
doc_type_version = EBML_IntegerValue((ebml_integer *)EBML_MasterGetChild((ebml_master *)level0, &EBML_ContextDocTypeVersion));
doc_type_version = (int)EBML_IntegerValue((ebml_integer *)EBML_MasterGetChild((ebml_master *)level0, &EBML_ContextDocTypeVersion));
NodeDelete((node *)level0);
level0 = EBML_FindNextElement(obj->file, &pctx, &upper_level, FALSE);
......@@ -522,9 +522,9 @@ static int _parse_tracks(MSList **tracks_out, ebml_element *tracks_elt) {
static void _parse_track(MKVTrack **track_out, ebml_element *track_elt) {
tchar_t codec_id[MAX_MKV_STRING_LENGTH];
int track_type;
uint8_t track_type;
ebml_element *codec_private_elt;
track_type = EBML_IntegerValue((ebml_integer *)EBML_MasterFindChild(track_elt, &MATROSKA_ContextTrackType));
track_type = (uint8_t)EBML_IntegerValue((ebml_integer *)EBML_MasterFindChild(track_elt, &MATROSKA_ContextTrackType));
if(track_type == TRACK_TYPE_VIDEO) {
*track_out = (MKVTrack *)ms_new0(MKVVideoTrack, 1);
_parse_video_track_info((MKVVideoTrack *)*track_out, EBML_MasterFindChild(track_elt, &MATROSKA_ContextVideo));
......@@ -535,15 +535,15 @@ static void _parse_track(MKVTrack **track_out, ebml_element *track_elt) {
*track_out = NULL;
return;
}
(*track_out)->num = EBML_IntegerValue((ebml_integer *)EBML_MasterFindChild(track_elt, &MATROSKA_ContextTrackNumber));
(*track_out)->num = (uint8_t)EBML_IntegerValue((ebml_integer *)EBML_MasterFindChild(track_elt, &MATROSKA_ContextTrackNumber));
(*track_out)->UID = EBML_IntegerValue((ebml_integer *)EBML_MasterFindChild(track_elt, &MATROSKA_ContextTrackUID));
(*track_out)->type = track_type;
(*track_out)->enabled = EBML_IntegerValue((ebml_integer *)EBML_MasterGetChild((ebml_master *)track_elt, &MATROSKA_ContextFlagEnabled));
(*track_out)->def = EBML_IntegerValue((ebml_integer *)EBML_MasterGetChild((ebml_master *)track_elt, &MATROSKA_ContextFlagDefault));
(*track_out)->forced = EBML_IntegerValue((ebml_integer *)EBML_MasterGetChild((ebml_master *)track_elt, &MATROSKA_ContextFlagForced));
(*track_out)->lacing = EBML_IntegerValue((ebml_integer *)EBML_MasterGetChild((ebml_master *)track_elt, &MATROSKA_ContextFlagLacing));
(*track_out)->min_cache = EBML_IntegerValue((ebml_integer *)EBML_MasterGetChild((ebml_master *)track_elt, &MATROSKA_ContextMinCache));
(*track_out)->max_block_addition_id = EBML_IntegerValue((ebml_integer *)EBML_MasterGetChild((ebml_master *)track_elt, &MATROSKA_ContextMaxBlockAdditionID));
(*track_out)->enabled = EBML_IntegerValue((ebml_integer *)EBML_MasterGetChild((ebml_master *)track_elt, &MATROSKA_ContextFlagEnabled)) == 0 ? FALSE : TRUE;
(*track_out)->def = EBML_IntegerValue((ebml_integer *)EBML_MasterGetChild((ebml_master *)track_elt, &MATROSKA_ContextFlagDefault)) == 0 ? FALSE : TRUE;
(*track_out)->forced = EBML_IntegerValue((ebml_integer *)EBML_MasterGetChild((ebml_master *)track_elt, &MATROSKA_ContextFlagForced)) == 0 ? FALSE : TRUE;
(*track_out)->lacing = EBML_IntegerValue((ebml_integer *)EBML_MasterGetChild((ebml_master *)track_elt, &MATROSKA_ContextFlagLacing)) == 0 ? FALSE : TRUE;
(*track_out)->min_cache = (int)EBML_IntegerValue((ebml_integer *)EBML_MasterGetChild((ebml_master *)track_elt, &MATROSKA_ContextMinCache));
(*track_out)->max_block_addition_id = (int)EBML_IntegerValue((ebml_integer *)EBML_MasterGetChild((ebml_master *)track_elt, &MATROSKA_ContextMaxBlockAdditionID));
memset(codec_id, 0, sizeof(codec_id));
EBML_StringGet((ebml_string *)EBML_MasterFindChild(track_elt, &MATROSKA_ContextCodecID), codec_id, MAX_MKV_STRING_LENGTH);
#ifdef UNICODE
......@@ -557,19 +557,19 @@ static void _parse_track(MKVTrack **track_out, ebml_element *track_elt) {
#endif
codec_private_elt = EBML_MasterFindChild(track_elt, &MATROSKA_ContextCodecPrivate);
if(codec_private_elt) {
size_t data_size = EBML_ElementDataSize(codec_private_elt, FALSE);
size_t data_size = (size_t)EBML_ElementDataSize(codec_private_elt, FALSE);
(*track_out)->codec_private = ms_new0(uint8_t, data_size);
memcpy((*track_out)->codec_private, EBML_BinaryGetData((ebml_binary *)codec_private_elt), data_size);
}
(*track_out)->seek_preroll = EBML_IntegerValue((ebml_integer *)EBML_MasterGetChild((ebml_master *)track_elt, &MATROSKA_ContextSeekPreRoll));
(*track_out)->seek_preroll = (int)EBML_IntegerValue((ebml_integer *)EBML_MasterGetChild((ebml_master *)track_elt, &MATROSKA_ContextSeekPreRoll));
}
static void _parse_video_track_info(MKVVideoTrack *video_info_out, ebml_element *video_info_elt) {
ebml_element *elt;
if(video_info_elt==NULL) return;
video_info_out->interlaced = EBML_IntegerValue((ebml_integer *)EBML_MasterGetChild((ebml_master *)video_info_elt, &MATROSKA_ContextFlagInterlaced));
video_info_out->width = EBML_IntegerValue((ebml_integer *)EBML_MasterFindChild(video_info_elt, &MATROSKA_ContextPixelWidth));
video_info_out->height = EBML_IntegerValue((ebml_integer *)EBML_MasterFindChild(video_info_elt, &MATROSKA_ContextPixelHeight));
video_info_out->interlaced = EBML_IntegerValue((ebml_integer *)EBML_MasterGetChild((ebml_master *)video_info_elt, &MATROSKA_ContextFlagInterlaced)) == 0 ? FALSE : TRUE;
video_info_out->width = (int)EBML_IntegerValue((ebml_integer *)EBML_MasterFindChild(video_info_elt, &MATROSKA_ContextPixelWidth));
video_info_out->height = (int)EBML_IntegerValue((ebml_integer *)EBML_MasterFindChild(video_info_elt, &MATROSKA_ContextPixelHeight));
elt = EBML_MasterFindChild(video_info_elt, &MATROSKA_ContextFrameRate);
video_info_out->frame_rate = elt ? EBML_FloatValue((ebml_float *)elt) : 0.0;
}
......@@ -577,7 +577,7 @@ static void _parse_video_track_info(MKVVideoTrack *video_info_out, ebml_element
static void _parse_audio_track_info(MKVAudioTrack *audio_info_out, ebml_element *audio_info_elt) {
if(audio_info_elt==NULL) return;
audio_info_out->sampling_freq = (int)EBML_FloatValue((ebml_float *)EBML_MasterGetChild((ebml_master *)audio_info_elt, &MATROSKA_ContextSamplingFrequency));
audio_info_out->channels = EBML_IntegerValue((ebml_integer *)EBML_MasterGetChild((ebml_master *)audio_info_elt, &MATROSKA_ContextChannels));
audio_info_out->channels = (uint8_t)EBML_IntegerValue((ebml_integer *)EBML_MasterGetChild((ebml_master *)audio_info_elt, &MATROSKA_ContextChannels));
}
static void _mkv_track_free(MKVTrack *obj) {
......
......@@ -78,7 +78,7 @@ typedef struct {
typedef struct {
MKVTrack base;
int sampling_freq;
int channels;
uint8_t channels;
} MKVAudioTrack;
typedef struct _MKVTrackReader MKVTrackReader;
......
......@@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
struct _MSStreamRegulator {
MSTicker *ticker;
int clock_rate;
int64_t clock_rate;
int64_t t_origin;
bool_t origin_set;
MSQueue queue;
......@@ -53,7 +53,7 @@ mblk_t *ms_stream_regulator_get(MSStreamRegulator *obj) {
return pkt;
} else {
mblk_t *pkt = ms_queue_peek_first(&obj->queue);
int64_t timestamp = (int64_t)(mblk_get_timestamp_info(pkt)) * 1000LL / obj->clock_rate;
uint64_t timestamp = (uint64_t)(mblk_get_timestamp_info(pkt)) * 1000LL / obj->clock_rate;
if(timestamp <= obj->ticker->time - obj->t_origin) {
return ms_queue_get(&obj->queue);
} else {
......
......@@ -147,7 +147,7 @@ static mblk_t *get_as_yuvmsg(MSFilter *f, DecData *s, AVFrame *orig){
ms_error("%s: error in sws_scale().",f->desc->name);
}
#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(50,43,0) // backward compatibility with Debian Squeeze (6.0)
mblk_set_timestamp_info(yuv_msg, orig->pkt_pts);
mblk_set_timestamp_info(yuv_msg, (uint32_t)orig->pkt_pts);
#endif
return yuv_msg;
}
......
This diff is collapsed.
......@@ -171,7 +171,7 @@ static bool_t parse_video_fmtp(const char *fmtp, float *fps, MSVideoSize *vsize)
}
divider=atoi(equal+1);
if (divider!=0){
float newfps=29.97/divider;
float newfps=29.97f/divider;
if (*fps>newfps) *fps=newfps;
}else{
ms_warning("Could not find video fps");
......@@ -276,11 +276,11 @@ static void prepare(EncState *s){
bitrate peaks especially on low bandwidth, we make a correction on the
codec's target bitrate.
*/
c->bit_rate=(float)s->vconf.required_bitrate*0.92;
c->bit_rate=(int)((float)s->vconf.required_bitrate*0.92f);
if (c->bit_rate>RATE_CONTROL_MARGIN){
c->bit_rate -= RATE_CONTROL_MARGIN;
}
c->bit_rate_tolerance=s->vconf.fps>1?(float)c->bit_rate/(s->vconf.fps-1):c->bit_rate;
c->bit_rate_tolerance=s->vconf.fps>1.0f?(int)((float)c->bit_rate/(s->vconf.fps-1.0f)):c->bit_rate;
/* ffmpeg vbv rate control consumes too much cpu above a certain target bitrate.
We don't use it above max_br_vbv */
......@@ -631,7 +631,7 @@ static void mjpeg_fragment_and_send(MSFilter *f,EncState *s,mblk_t *frame, uint3
if (q >= 128) {
qtblhdr.mbz = 0;
qtblhdr.precision = 0; /* This code uses 8 bit tables only */
qtblhdr.length = htons(msgdsize(lqt)+msgdsize(cqt)); /* 2 64-byte tables */
qtblhdr.length = htons((uint16_t)(msgdsize(lqt)+msgdsize(cqt))); /* 2 64-byte tables */
}
while (bytes_left > 0) {
......@@ -745,7 +745,7 @@ static mblk_t *skip_jpeg_headers(mblk_t *full_frame, mblk_t **lqt, mblk_t **cqt)
static void split_and_send(MSFilter *f, EncState *s, mblk_t *frame, bool_t is_iframe){
uint8_t *lastpsc;
uint8_t *psc;
uint32_t timestamp=f->ticker->time*90LL;
uint32_t timestamp=(uint32_t)(f->ticker->time*90LL);
if (s->codec==CODEC_ID_MPEG4
#if HAVE_AVCODEC_SNOW
......
......@@ -806,7 +806,7 @@ void ms_video_init_framerate_controller(MSFrameRateController* ctrl, float fps)
ctrl->fps = fps;
}
bool_t ms_video_capture_new_frame(MSFrameRateController* ctrl, uint32_t current_time) {
bool_t ms_video_capture_new_frame(MSFrameRateController* ctrl, uint64_t current_time) {
int cur_frame;
float elapsed;
......@@ -842,7 +842,7 @@ void ms_video_init_average_fps(MSAverageFPS* afps, const char* ctx){
ms_average_fps_init(afps,ctx);
}
bool_t ms_average_fps_update(MSAverageFPS* afps, uint32_t current_time) {
bool_t ms_average_fps_update(MSAverageFPS* afps, uint64_t current_time) {
if (afps->last_frame_time!=-1){
float frame_interval=(float)(current_time - afps->last_frame_time)/1000.0f;
if (afps->mean_inter_frame==0){
......@@ -864,7 +864,7 @@ bool_t ms_average_fps_update(MSAverageFPS* afps, uint32_t current_time) {
}
/*compatibility, deprecated*/
bool_t ms_video_update_average_fps(MSAverageFPS* afps,