cleaned several warrnings (Mac OS X)

This commit is contained in:
Martin Pulec
2012-01-11 16:48:21 +01:00
parent 7c121e7ac4
commit 51503ce48a
12 changed files with 96 additions and 69 deletions

View File

@@ -51,11 +51,13 @@
#ifdef HAVE_COREAUDIO
#include "audio/audio.h"
#include "audio/utils.h"
#include "audio/capture/coreaudio.h"
#include "utils/ring_buffer.h"
#include "debug.h"
#include <stdlib.h>
#include <AudioUnit/AudioUnit.h>
#include <QuickTime/QuickTime.h>
#include <pthread.h>
#ifdef HAVE_SPEEX
@@ -141,6 +143,7 @@ static OSStatus InputProc(void *inRefCon,
UInt32 inNumberFrames,
AudioBufferList * ioData)
{
UNUSED(ioData);
struct state_ca_capture * s = (struct state_ca_capture *) inRefCon;
OSStatus err =noErr;
@@ -181,7 +184,7 @@ static OSStatus InputProc(void *inRefCon,
pthread_cond_signal(&s->cv);
pthread_mutex_unlock(&s->lock);
} else {
fprintf(stderr, "[CoreAudio] writing buffer caused error %i.\n", err);
fprintf(stderr, "[CoreAudio] writing buffer caused error %i.\n", (int) err);
}
return err;
@@ -190,7 +193,6 @@ static OSStatus InputProc(void *inRefCon,
void audio_cap_ca_help(void)
{
OSErr ret;
AudioDeviceID device;
AudioDeviceID *dev_ids;
int dev_items;
int i;
@@ -210,7 +212,7 @@ void audio_cap_ca_help(void)
size = sizeof(name);
ret = AudioDeviceGetProperty(dev_ids[i], 0, 0, kAudioDevicePropertyDeviceName, &size, name);
fprintf(stderr,"\tcoreaudio:%d : %s\n", dev_ids[i], name);
fprintf(stderr,"\tcoreaudio:%d : %s\n", (int) dev_ids[i], name);
}
free(dev_ids);
@@ -371,7 +373,6 @@ void * audio_cap_ca_init(char *cfg)
{
AudioStreamBasicDescription desc;
AURenderCallbackStruct renderStruct;
size = sizeof(desc);
ret = AudioUnitGetProperty(s->auHALComponentInstance, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input,
@@ -465,7 +466,7 @@ struct audio_frame *audio_cap_ca_read(void *state)
void audio_cap_ca_finish(void *state)
{
struct state_ca_capture *s = (struct state_ca_capture *) state;
UNUSED(state);
}
void audio_cap_ca_done(void *state)

View File

@@ -84,6 +84,10 @@ static OSStatus theRenderProc(void *inRefCon,
UInt32 inBusNumber, UInt32 inNumFrames,
AudioBufferList *ioData)
{
UNUSED(inActionFlags);
UNUSED(inTimeStamp);
UNUSED(inBusNumber);
struct state_ca_playback * s = (struct state_ca_playback *) inRefCon;
int write_bytes = inNumFrames * s->audio_packet_size;
int ret;
@@ -169,7 +173,6 @@ error:
void audio_play_ca_help(void)
{
OSErr ret;
AudioDeviceID device;
AudioDeviceID *dev_ids;
int dev_items;
int i;
@@ -189,7 +192,7 @@ void audio_play_ca_help(void)
size = sizeof(name);
ret = AudioDeviceGetProperty(dev_ids[i], 0, 0, kAudioDevicePropertyDeviceName, &size, name);
fprintf(stderr,"\tcoreaudio:%d : %s\n", dev_ids[i], name);
fprintf(stderr,"\tcoreaudio:%d : %s\n", (int) dev_ids[i], name);
}
free(dev_ids);

View File

@@ -58,6 +58,8 @@
#include <mach/mach.h>
int clock_gettime(int unused, struct timespec *ts) {
UNUSED(unused);
clock_serv_t cclock;
mach_timespec_t mts;
@@ -66,6 +68,8 @@ int clock_gettime(int unused, struct timespec *ts) {
mach_port_deallocate(mach_task_self(), cclock);
ts->tv_sec = mts.tv_sec;
ts->tv_nsec = mts.tv_nsec;
return 0;
}
#endif

View File

@@ -233,7 +233,7 @@ void decoder_destroy(struct state_decoder *decoder)
static codec_t choose_codec_and_decoder(struct state_decoder * const decoder, struct video_desc desc,
codec_t *in_codec, decoder_t *decode_line)
{
codec_t out_codec;
codec_t out_codec = (codec_t) -1;
*decode_line = NULL;
*in_codec = desc.color_spec;

View File

@@ -382,6 +382,9 @@ audio_pbuf_decode(struct pbuf *playout_buf, struct timeval curr_time,
while (curr != NULL) {
if (!curr->decoded && frame_complete(curr)) { // FIXME: figure out then right frames ordering (if needed) - se pbuf_decode
int total_channels = 0, bps,
sample_rate;
int channel;
curr->decoded = 1;
@@ -391,13 +394,12 @@ audio_pbuf_decode(struct pbuf *playout_buf, struct timeval curr_time,
audio_payload_hdr_t *hdr =
(audio_payload_hdr_t *) cdata->data->data;
int total_channels, bps,
sample_rate;
int channel;
/* we receive last channel first (with m bit, last packet) */
/* thus can be set only with m-bit packet */
if(cdata->data->m) {
total_channels = ((ntohl(hdr->substream_bufnum) >> 22) & 0x3ff) + 1;
}
assert(total_channels > 0);
channel = (ntohl(hdr->substream_bufnum) >> 22) & 0x3ff;
sample_rate = ntohl(hdr->quant_sample_rate) & 0x3fffff;

View File

@@ -63,7 +63,7 @@ void vf_split(struct video_frame *out, struct video_frame *src,
{
unsigned int tile_idx, line_idx;
struct tile *cur_tiles;
unsigned int tile_line;
unsigned int tile_line = 0;
out->color_spec = src->color_spec;
out->fps = src->fps;

View File

@@ -208,8 +208,8 @@ tx_send_base(struct tx *tx, struct tile *tile, struct rtp *rtp_session,
long delta;
uint32_t tmp;
unsigned int fps, fpsd, fd, fi;
struct xor_session **xor;
int *xor_pkts;
struct xor_session **xor = NULL;
int *xor_pkts = NULL;
int mult_pos[FEC_MAX_MULT];
int mult_index = 0;
int mult_first_sent = 0;

View File

@@ -722,7 +722,7 @@ vidcap_decklink_init(char *fmt, unsigned int flags)
result = deckLink->QueryInterface(IID_IDeckLinkInput, (void**)&deckLinkInput);
if (result != S_OK)
{
printf("Could not obtain the IDeckLinkInput interface - result = %08x\n", result);
printf("Could not obtain the IDeckLinkInput interface - result = %08x\n", (int) result);
goto error;
}
@@ -732,7 +732,7 @@ vidcap_decklink_init(char *fmt, unsigned int flags)
result = deckLinkInput->GetDisplayModeIterator(&displayModeIterator);
if (result != S_OK)
{
printf("Could not obtain the video input display mode iterator - result = %08x\n", result);
printf("Could not obtain the video input display mode iterator - result = %08x\n", (int) result);
goto error;
}
@@ -765,7 +765,7 @@ vidcap_decklink_init(char *fmt, unsigned int flags)
if (result != S_OK)
{
printf("Could not query device attributes.\n");
printf("Could not enable video input: %08x\n", result);
printf("Could not enable video input: %08x\n", (int) result);
goto error;
}
@@ -790,7 +790,7 @@ vidcap_decklink_init(char *fmt, unsigned int flags)
if (result != S_OK)
{
printf("You have required invalid video mode and pixel format combination.\n");
printf("Could not enable video input: %08x\n", result);
printf("Could not enable video input: %08x\n", (int) result);
goto error;
}
@@ -798,7 +798,7 @@ vidcap_decklink_init(char *fmt, unsigned int flags)
result = deckLinkInput->QueryInterface(IID_IDeckLinkConfiguration, (void**)&deckLinkConfiguration);
if (result != S_OK)
{
printf("Could not obtain the IDeckLinkConfiguration interface: %08x\n", result);
printf("Could not obtain the IDeckLinkConfiguration interface: %08x\n", (int) result);
goto error;
}
@@ -849,12 +849,12 @@ vidcap_decklink_init(char *fmt, unsigned int flags)
result = deckLinkInput->StartStreams();
if (result != S_OK)
{
printf("Could not start stream: %08x\n", result);
printf("Could not start stream: %08x\n", (int) result);
goto error;
}
}else{
printf("Could not : %08x\n", result);
printf("Could not : %08x\n", (int) result);
goto error;
}
@@ -945,7 +945,7 @@ vidcap_decklink_done(void *state)
result = s->state[i].deckLinkInput->StopStreams();
if (result != S_OK)
{
printf("Could not stop stream: %08x\n", result);
printf("Could not stop stream: %08x\n", (int) result);
}
if(s->state[i].deckLinkInput != NULL)
@@ -1168,7 +1168,7 @@ print_output_modes (IDeckLink* deckLink)
result = deckLink->QueryInterface(IID_IDeckLinkOutput, (void**)&deckLinkOutput);
if (result != S_OK)
{
fprintf(stderr, "Could not obtain the IDeckLinkOutput interface - result = %08x\n", result);
fprintf(stderr, "Could not obtain the IDeckLinkOutput interface - result = %08x\n", (int) result);
goto bail;
}
@@ -1176,7 +1176,7 @@ print_output_modes (IDeckLink* deckLink)
result = deckLinkOutput->GetDisplayModeIterator(&displayModeIterator);
if (result != S_OK)
{
fprintf(stderr, "Could not obtain the video output display mode iterator - result = %08x\n", result);
fprintf(stderr, "Could not obtain the video output display mode iterator - result = %08x\n", (int) result);
goto bail;
}

View File

@@ -256,7 +256,7 @@ static OSErr MinimalSGSettingsDialog(SeqGrabComponent seqGrab,
}
static void
nprintf(unsigned char *str)
nprintf(char *str)
{
char tmp[((int)str[0]) + 1];
@@ -266,7 +266,7 @@ nprintf(unsigned char *str)
}
static void
shrink(unsigned char *str)
shrink(char *str)
{
int i, j;
j=1;
@@ -285,12 +285,12 @@ shrink(unsigned char *str)
str[0] = j-1;
}
static unsigned char *
shrink2(unsigned char *str)
static char *
shrink2(char *str)
{
int i, j;
int len = strlen((char*)str);
str = (unsigned char*)strdup((char*)str);
str = strdup((char*)str);
j=0;
for(i=0; i < len; i++) {
while((str[i] == '\t' ||
@@ -312,13 +312,13 @@ shrink2(unsigned char *str)
* Blackmagic 2 HD 1080
* ....
*/
static unsigned char *
delCardIndicesCard(unsigned char *str)
static char *
delCardIndicesCard(char *str)
{
if(strncmp(str, "Blackmagic", strlen("Blackmagic")) == 0) {
if(strncmp((char *) str, "Blackmagic", strlen("Blackmagic")) == 0) {
if(isdigit(str[strlen("Blackmagic") + 1])) { // Eg. Blackmagic X ...
int len =
strlen(str + strlen("Blackmagic") + 2);
strlen((char *) str + strlen("Blackmagic") + 2);
memmove(str + strlen("Blackmagic"),
str + strlen("Blackmagic") + 2,
len);
@@ -332,14 +332,14 @@ delCardIndicesCard(unsigned char *str)
* ... and to its modes:
* eg.: Blackmagic HD 1080i 50 - 8 Bit (2)
*/
static unsigned char *
delCardIndicesMode(unsigned char *str)
static char *
delCardIndicesMode(char *str)
{
if(strncmp(str, "Blackmagic", strlen("Blackmagic")) == 0) {
if(str[strlen(str) - 1 - 2] == '('
&& isdigit(str[strlen(str) - 1 - 1])
&& str[strlen(str) - 1] == ')') {
str[strlen(str) - 4] = '\0'; // Eg.: Blackmagic ... (x)
if(strncmp((char *) str, "Blackmagic", strlen("Blackmagic")) == 0) {
if(str[strlen((char *)str) - 1 - 2] == '('
&& isdigit(str[strlen((char *) str) - 1 - 1])
&& str[strlen((char *) str) - 1] == ')') {
str[strlen((char *) str) - 4] = '\0'; // Eg.: Blackmagic ... (x)
}
}
return str;
@@ -431,7 +431,7 @@ static int qt_open_grabber(struct qt_grabber_state *s, char *fmt)
SGDeviceName *deviceEntry =
&(*deviceList)->entry[i];
fprintf(stdout, " Device %d: ", i);
nprintf(deviceEntry->name);
nprintf((char *) deviceEntry->name);
if (deviceEntry->flags &
sgDeviceNameFlagDeviceUnavailable) {
fprintf(stdout,
@@ -451,7 +451,7 @@ static int qt_open_grabber(struct qt_grabber_state *s, char *fmt)
j++) {
fprintf(stdout, "\t");
fprintf(stdout, "- %d. ", j);
nprintf((unsigned char*)&(*inputList)->entry
nprintf((char *) &(*inputList)->entry
[j].name);
if ((i ==
(*deviceList)->selectedIndex)
@@ -469,7 +469,7 @@ static int qt_open_grabber(struct qt_grabber_state *s, char *fmt)
for (i = 0; i < list->count; i++) {
int fcc = list->list[i].cType;
printf("\t%d) ", i);
nprintf(list->list[i].typeName);
nprintf((char *) list->list[i].typeName);
printf(" - FCC (%c%c%c%c)",
fcc >> 24,
(fcc >> 16) & 0xff,
@@ -489,7 +489,7 @@ static int qt_open_grabber(struct qt_grabber_state *s, char *fmt)
SGDeviceName *deviceEntry =
&(*deviceList)->entry[i];
fprintf(stdout, " Device %d: ", i);
nprintf(deviceEntry->name);
nprintf((char *) deviceEntry->name);
if (deviceEntry->flags &
sgDeviceNameFlagDeviceUnavailable) {
fprintf(stdout,
@@ -509,7 +509,7 @@ static int qt_open_grabber(struct qt_grabber_state *s, char *fmt)
j++) {
fprintf(stdout, "\t");
fprintf(stdout, "- %d. ", j);
nprintf((unsigned char*)&(*inputList)->entry
nprintf((char*)&(*inputList)->entry
[j].name);
if ((i ==
(*deviceList)->selectedIndex)
@@ -599,7 +599,7 @@ static int qt_open_grabber(struct qt_grabber_state *s, char *fmt)
SGDeviceName *deviceEntry = &(*deviceList)->entry[s->major];
printf("Quicktime: Setting device: ");
nprintf(deviceEntry->name);
nprintf((char *) deviceEntry->name);
printf("\n");
if (SGSetChannelDevice(s->video_channel, deviceEntry->name) !=
noErr) {
@@ -610,7 +610,7 @@ static int qt_open_grabber(struct qt_grabber_state *s, char *fmt)
/* Select input */
inputList = deviceEntry->inputs;
printf("Quicktime: Setting input: ");
nprintf((unsigned char *)(&(*inputList)->entry[s->minor].name));
nprintf((char *)(&(*inputList)->entry[s->minor].name));
printf("\n");
if (SGSetChannelDeviceInput(s->video_channel, s->minor) !=
noErr) {
@@ -629,8 +629,8 @@ static int qt_open_grabber(struct qt_grabber_state *s, char *fmt)
s->tile->height = s->bounds.bottom =
gActiveVideoRect.bottom - gActiveVideoRect.top;
unsigned char *deviceName;
unsigned char *inputName;
char *deviceName;
char *inputName;
short inputNumber;
TimeScale scale;
@@ -643,15 +643,15 @@ static int qt_open_grabber(struct qt_grabber_state *s, char *fmt)
SGDeviceName *deviceEntry = &(*deviceList)->entry[(*deviceList)->selectedIndex];
inputList = deviceEntry->inputs;
deviceName = deviceEntry->name;
inputName = (unsigned char*)&(*inputList)->entry[inputNumber].name;
deviceName = (char *) deviceEntry->name;
inputName = (char*)&(*inputList)->entry[inputNumber].name;
shrink(delCardIndicesCard(deviceName));
shrink(delCardIndicesCard(inputName));
shrink(delCardIndicesMode(inputName));
for(i=0; quicktime_modes[i].device != NULL; i++) {
unsigned char *device = shrink2(quicktime_modes[i].device);
unsigned char *input = shrink2(quicktime_modes[i].input);
char *device = shrink2(quicktime_modes[i].device);
char *input = shrink2(quicktime_modes[i].input);
if((strncmp((char*)device, (char*)&deviceName[1], deviceName[0])) == 0 &&
(strncmp((char*)input, (char*)&inputName[1], inputName[0])) == 0) {
@@ -697,7 +697,7 @@ static int qt_open_grabber(struct qt_grabber_state *s, char *fmt)
}
/* Set selected fmt->codec and get pixel format of that codec */
int pixfmt;
int pixfmt = -1;
if (s->frame->color_spec != 0xffffffff) {
CodecNameSpecListPtr list;
GetCodecNameList(&list, 1);
@@ -719,6 +719,10 @@ static int qt_open_grabber(struct qt_grabber_state *s, char *fmt)
}
}
}
if(pixfmt == -1) {
fprintf(stderr, "[QuickTime] Unknown pixelformat!\n");
goto error;
}
for (i = 0; codec_info[i].name != NULL; i++) {
if ((unsigned)pixfmt == codec_info[i].fcc) {
@@ -732,7 +736,6 @@ static int qt_open_grabber(struct qt_grabber_state *s, char *fmt)
pixfmt >> 24, (pixfmt >> 16) & 0xff, (pixfmt >> 8) & 0xff,
(pixfmt) & 0xff);
int h_align = s->c_info->h_align;
s->tile->data_len = vc_get_linesize(s->tile->width, s->frame->color_spec) * s->tile->height;
s->vbuffer[0] = malloc(s->tile->data_len);
s->vbuffer[1] = malloc(s->tile->data_len);
@@ -753,7 +756,7 @@ static int qt_open_grabber(struct qt_grabber_state *s, char *fmt)
}
SGDeviceName *deviceEntry = &(*deviceList)->entry[s->audio_major];
printf("Quicktime: Setting audio device: ");
nprintf(deviceEntry->name);
nprintf((char *) deviceEntry->name);
printf("\n");
if (SGSetChannelDevice(s->audio_channel, deviceEntry->name) !=
noErr) {
@@ -765,7 +768,7 @@ static int qt_open_grabber(struct qt_grabber_state *s, char *fmt)
/* Select input */
inputList = deviceEntry->inputs;
printf("Quicktime: Setting audio input: ");
nprintf((unsigned char *)(&(*inputList)->entry[s->audio_minor].name));
nprintf((char *)(&(*inputList)->entry[s->audio_minor].name));
printf("\n");
if (SGSetChannelDeviceInput(s->audio_channel, s->audio_minor) !=
noErr) {
@@ -773,8 +776,12 @@ static int qt_open_grabber(struct qt_grabber_state *s, char *fmt)
s->grab_audio = FALSE;
goto AFTER_AUDIO;
}
ret = SGGetSoundInputParameters(s->audio_channel, &s->audio.bps,
&s->audio.ch_count, &compression);
short bps, ch_count;
ret = SGGetSoundInputParameters(s->audio_channel, &bps,
&ch_count, &compression);
s->audio.bps = bps;
s->audio.ch_count = ch_count;
if(ret != noErr) {
fprintf(stderr, "Quicktime: failed to get audio properties");
s->grab_audio = FALSE;
@@ -828,6 +835,7 @@ AFTER_AUDIO:
SGGetChannelTimeScale(s->video_channel, &scale);
s->frame->fps = scale / 100.0;
error:
return 1;
}

View File

@@ -222,6 +222,10 @@ void glut_key_callback(unsigned char key, int x, int y);
void glut_close_callback(void);
void glut_resize_window(struct state_gl *s);
#ifdef HAVE_MACOSX
void NSApplicationLoad(void);
#endif
/**
* Show help
* @since 23-03-2010, xsedmik

View File

@@ -246,7 +246,7 @@ void display_quicktime_reconfigure_audio(void *state, int quant_samples, int cha
int sample_rate);
static void
nprintf(unsigned char *str)
nprintf(char *str)
{
char tmp[((int)str[0]) + 1];
@@ -320,7 +320,7 @@ static void reconf_common(struct state_quicktime *s)
NULL,
srcCopy,
NULL,
(CodecFlags) NULL,
(CodecFlags) 0,
codecNormalQuality, bestSpeedCodec);
if (ret != noErr)
fprintf(stderr, "Failed DecompressSequenceBeginS\n");
@@ -354,7 +354,7 @@ void display_quicktime_run(void *arg)
* the decompressor does not call the completion
* function.
*/
0, &ignore, -1,
0, &ignore, (void *) -1,
NULL);
if (ret != noErr) {
fprintf(stderr,
@@ -557,7 +557,7 @@ void *display_quicktime_init(char *fmt, unsigned int flags)
struct state_quicktime *s;
int ret;
int i;
char *codec_name;
char *codec_name = NULL;
/* Parse fmt input */
s = (struct state_quicktime *)calloc(1, sizeof(struct state_quicktime));
@@ -788,7 +788,7 @@ void display_quicktime_audio_init(struct state_quicktime *s)
ret = GetComponentInfo(audioComponent, 0, componentNameHandle, NULL, NULL);
if (ret != noErr) goto audio_error;
HLock(componentNameHandle);
s->audio_name = CFStringCreateWithPascalString(NULL, *componentNameHandle,
s->audio_name = CFStringCreateWithPascalString(NULL, (ConstStr255Param) *componentNameHandle,
kCFStringEncodingMacRoman);
HUnlock(componentNameHandle);
DisposeHandle(componentNameHandle);
@@ -892,7 +892,7 @@ int display_quicktime_reconfigure(void *state, struct video_desc desc)
struct state_quicktime *s = (struct state_quicktime *) state;
int i;
int ret;
const char *codec_name;
const char *codec_name = NULL;
for (i = 0; codec_info[i].name != NULL; i++) {
if (codec_info[i].codec == desc.color_spec) {
@@ -900,6 +900,7 @@ int display_quicktime_reconfigure(void *state, struct video_desc desc)
codec_name = s->cinfo->name;
}
}
assert(codec_name != NULL);
if(desc.color_spec == UYVY || desc.color_spec == DVS8) /* just aliases for 2vuy,
* but would confuse QT */
codec_name = "2vuy";
@@ -1129,6 +1130,10 @@ static OSStatus theRenderProc(void *inRefCon,
UInt32 inBusNumber, UInt32 inNumFrames,
AudioBufferList *ioData)
{
UNUSED(inActionFlags);
UNUSED(inTimeStamp);
UNUSED(inBusNumber);
struct state_quicktime * s = (struct state_quicktime *) inRefCon;
int write_bytes = inNumFrames * s->audio_packet_size;
int bytes_in_buffer = s->audio_end - s->audio_start;

View File

@@ -52,8 +52,8 @@
struct audio_frame;
typedef struct {
unsigned char *device;
unsigned char *input;
char *device;
char *input;
unsigned int width;
unsigned int height;
double fps;