Fix broken macro token pasting.
Cast argument of format string to avoid warnings. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@28563 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -51,7 +51,7 @@ wxUint32 wxSoundStreamPcm::GetBestSize() const
|
|||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
|
|
||||||
#define DEFINE_CONV(name, input_type, output_type, convert) \
|
#define DEFINE_CONV(name, input_type, output_type, convert) \
|
||||||
static void Convert_##name##(const void *buf_in, void *buf_out, wxUint32 len) \
|
static void Convert_##name(const void *buf_in, void *buf_out, wxUint32 len) \
|
||||||
{\
|
{\
|
||||||
register input_type src; \
|
register input_type src; \
|
||||||
register const input_type *t_buf_in = (input_type *)buf_in; \
|
register const input_type *t_buf_in = (input_type *)buf_in; \
|
||||||
@@ -112,7 +112,7 @@ DEFINE_CONV(16_swap_16_sign_swap, wxUint16, wxUint16, (src ^ 0x80))
|
|||||||
// XX swapped stereo -> YY swapped mono
|
// XX swapped stereo -> YY swapped mono
|
||||||
// XX swapped stereo -> YY swapped mono sign
|
// XX swapped stereo -> YY swapped mono sign
|
||||||
|
|
||||||
static wxSoundStreamPcm::ConverterType s_converters[4][3][2] = {
|
static wxSoundStreamPcm::ConverterType s_converters[4][3][2] = {
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
NULL,
|
NULL,
|
||||||
@@ -152,10 +152,10 @@ static wxSoundStreamPcm::ConverterType s_converters[4][3][2] = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
NULL,
|
NULL,
|
||||||
NULL
|
NULL
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
NULL, /* 16 -> 16 */
|
NULL, /* 16 -> 16 */
|
||||||
@@ -186,7 +186,7 @@ wxSoundStream& wxSoundStreamPcm::Read(void *buffer, wxUint32 len)
|
|||||||
|
|
||||||
// We must have a multiple of 2
|
// We must have a multiple of 2
|
||||||
len &= 0x01;
|
len &= 0x01;
|
||||||
|
|
||||||
if (!m_function_in) {
|
if (!m_function_in) {
|
||||||
m_sndio->Read(buffer, len);
|
m_sndio->Read(buffer, len);
|
||||||
m_lastcount = m_sndio->GetLastAccess();
|
m_lastcount = m_sndio->GetLastAccess();
|
||||||
@@ -195,7 +195,7 @@ wxSoundStream& wxSoundStreamPcm::Read(void *buffer, wxUint32 len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
in_bufsize = GetReadSize(len);
|
in_bufsize = GetReadSize(len);
|
||||||
|
|
||||||
if (len <= m_best_size) {
|
if (len <= m_best_size) {
|
||||||
m_sndio->Read(m_prebuffer, in_bufsize);
|
m_sndio->Read(m_prebuffer, in_bufsize);
|
||||||
m_snderror = m_sndio->GetError();
|
m_snderror = m_sndio->GetError();
|
||||||
@@ -203,11 +203,11 @@ wxSoundStream& wxSoundStreamPcm::Read(void *buffer, wxUint32 len)
|
|||||||
m_lastcount = 0;
|
m_lastcount = 0;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_function_in(m_prebuffer, buffer, m_sndio->GetLastAccess());
|
m_function_in(m_prebuffer, buffer, m_sndio->GetLastAccess());
|
||||||
} else {
|
} else {
|
||||||
char *temp_buffer;
|
char *temp_buffer;
|
||||||
|
|
||||||
temp_buffer = new char[in_bufsize];
|
temp_buffer = new char[in_bufsize];
|
||||||
m_sndio->Read(temp_buffer, in_bufsize);
|
m_sndio->Read(temp_buffer, in_bufsize);
|
||||||
|
|
||||||
@@ -216,21 +216,21 @@ wxSoundStream& wxSoundStreamPcm::Read(void *buffer, wxUint32 len)
|
|||||||
m_lastcount = 0;
|
m_lastcount = 0;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_function_in(temp_buffer, buffer, m_sndio->GetLastAccess());
|
m_function_in(temp_buffer, buffer, m_sndio->GetLastAccess());
|
||||||
|
|
||||||
delete[] temp_buffer;
|
delete[] temp_buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_lastcount = (wxUint32)(m_sndio->GetLastAccess() * m_multiplier_in);
|
m_lastcount = (wxUint32)(m_sndio->GetLastAccess() * m_multiplier_in);
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSoundStream& wxSoundStreamPcm::Write(const void *buffer, wxUint32 len)
|
wxSoundStream& wxSoundStreamPcm::Write(const void *buffer, wxUint32 len)
|
||||||
{
|
{
|
||||||
wxUint32 out_bufsize;
|
wxUint32 out_bufsize;
|
||||||
|
|
||||||
if (!m_function_out) {
|
if (!m_function_out) {
|
||||||
m_sndio->Write(buffer, len);
|
m_sndio->Write(buffer, len);
|
||||||
m_lastcount = m_sndio->GetLastAccess();
|
m_lastcount = m_sndio->GetLastAccess();
|
||||||
@@ -252,17 +252,17 @@ wxSoundStream& wxSoundStreamPcm::Write(const void *buffer, wxUint32 len)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
char *temp_buffer;
|
char *temp_buffer;
|
||||||
|
|
||||||
temp_buffer = new char[out_bufsize];
|
temp_buffer = new char[out_bufsize];
|
||||||
m_function_out(buffer, temp_buffer, len);
|
m_function_out(buffer, temp_buffer, len);
|
||||||
|
|
||||||
m_sndio->Write(temp_buffer, out_bufsize);
|
m_sndio->Write(temp_buffer, out_bufsize);
|
||||||
m_snderror = m_sndio->GetError();
|
m_snderror = m_sndio->GetError();
|
||||||
if (m_snderror != wxSOUND_NOERROR) {
|
if (m_snderror != wxSOUND_NOERROR) {
|
||||||
m_lastcount = 0;
|
m_lastcount = 0;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
delete[] temp_buffer;
|
delete[] temp_buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -275,7 +275,7 @@ bool wxSoundStreamPcm::SetSoundFormat(const wxSoundFormatBase& format)
|
|||||||
{
|
{
|
||||||
wxSoundFormatBase *new_format;
|
wxSoundFormatBase *new_format;
|
||||||
wxSoundFormatPcm *pcm_format, *pcm_format2;
|
wxSoundFormatPcm *pcm_format, *pcm_format2;
|
||||||
|
|
||||||
if (m_sndio->SetSoundFormat(format)) {
|
if (m_sndio->SetSoundFormat(format)) {
|
||||||
m_function_out = NULL;
|
m_function_out = NULL;
|
||||||
m_function_in = NULL;
|
m_function_in = NULL;
|
||||||
@@ -287,7 +287,7 @@ bool wxSoundStreamPcm::SetSoundFormat(const wxSoundFormatBase& format)
|
|||||||
}
|
}
|
||||||
if (m_sndformat)
|
if (m_sndformat)
|
||||||
delete m_sndformat;
|
delete m_sndformat;
|
||||||
|
|
||||||
new_format = m_sndio->GetSoundFormat().Clone();
|
new_format = m_sndio->GetSoundFormat().Clone();
|
||||||
pcm_format = (wxSoundFormatPcm *)&format;
|
pcm_format = (wxSoundFormatPcm *)&format;
|
||||||
pcm_format2 = (wxSoundFormatPcm *)new_format;
|
pcm_format2 = (wxSoundFormatPcm *)new_format;
|
||||||
@@ -317,7 +317,7 @@ bool wxSoundStreamPcm::SetSoundFormat(const wxSoundFormatBase& format)
|
|||||||
|
|
||||||
int table_no, table_no2;
|
int table_no, table_no2;
|
||||||
int i_sign, i_swap;
|
int i_sign, i_swap;
|
||||||
|
|
||||||
switch (pcm_format->GetBPS()) {
|
switch (pcm_format->GetBPS()) {
|
||||||
case 8:
|
case 8:
|
||||||
table_no = 0;
|
table_no = 0;
|
||||||
@@ -340,7 +340,7 @@ bool wxSoundStreamPcm::SetSoundFormat(const wxSoundFormatBase& format)
|
|||||||
// TODO: Add something here: error, log, ...
|
// TODO: Add something here: error, log, ...
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pcm_format2->Signed() != pcm_format->Signed())
|
if (pcm_format2->Signed() != pcm_format->Signed())
|
||||||
i_sign = 1;
|
i_sign = 1;
|
||||||
else
|
else
|
||||||
@@ -389,14 +389,14 @@ bool wxSoundStreamPcm::SetSoundFormat(const wxSoundFormatBase& format)
|
|||||||
m_best_size = (wxUint32)(m_sndio->GetBestSize() *
|
m_best_size = (wxUint32)(m_sndio->GetBestSize() *
|
||||||
m_multiplier_out);
|
m_multiplier_out);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_prebuffer = new char[m_prebuffer_size];
|
m_prebuffer = new char[m_prebuffer_size];
|
||||||
|
|
||||||
bool SetSoundFormatReturn;
|
bool SetSoundFormatReturn;
|
||||||
|
|
||||||
SetSoundFormatReturn = m_sndio->SetSoundFormat(*new_format);
|
SetSoundFormatReturn = m_sndio->SetSoundFormat(*new_format);
|
||||||
wxASSERT( SetSoundFormatReturn );
|
wxASSERT( SetSoundFormatReturn );
|
||||||
|
|
||||||
m_sndformat = new_format;
|
m_sndformat = new_format;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -429,14 +429,14 @@ void ResamplingShrink_##DEPTH##(const void *source, void *destination, wxUint32
|
|||||||
|
|
||||||
source_data = (wxUint##DEPTH## *)source;
|
source_data = (wxUint##DEPTH## *)source;
|
||||||
dest_data = (wxUint##DEPTH## *)destination;
|
dest_data = (wxUint##DEPTH## *)destination;
|
||||||
|
|
||||||
pos = m_saved_pos;
|
pos = m_saved_pos;
|
||||||
while (len > 0) {
|
while (len > 0) {
|
||||||
// Increment the position in the input buffer
|
// Increment the position in the input buffer
|
||||||
pos += m_pitch;
|
pos += m_pitch;
|
||||||
if (pos & INTMASK) {
|
if (pos & INTMASK) {
|
||||||
pos &= FLOATMASK;
|
pos &= FLOATMASK;
|
||||||
|
|
||||||
*dest_data ++ = *source_data;
|
*dest_data ++ = *source_data;
|
||||||
}
|
}
|
||||||
len--;
|
len--;
|
||||||
|
@@ -61,7 +61,7 @@ public:
|
|||||||
wxVideoXANIMOutput();
|
wxVideoXANIMOutput();
|
||||||
|
|
||||||
void OnTerminate(int pid, int status);
|
void OnTerminate(int pid, int status);
|
||||||
|
|
||||||
bool IsTerminated() const;
|
bool IsTerminated() const;
|
||||||
protected:
|
protected:
|
||||||
bool m_terminated;
|
bool m_terminated;
|
||||||
@@ -121,11 +121,11 @@ wxVideoXANIM::wxVideoXANIM(wxInputStream& str)
|
|||||||
m_paused = FALSE;
|
m_paused = FALSE;
|
||||||
m_size[0] = 0;
|
m_size[0] = 0;
|
||||||
m_size[1] = 0;
|
m_size[1] = 0;
|
||||||
|
|
||||||
m_filename = wxGetTempFileName("vidxa");
|
m_filename = wxGetTempFileName("vidxa");
|
||||||
m_remove_file = TRUE;
|
m_remove_file = TRUE;
|
||||||
wxFileOutputStream fout(m_filename);
|
wxFileOutputStream fout(m_filename);
|
||||||
|
|
||||||
fout << str;
|
fout << str;
|
||||||
|
|
||||||
CollectInfo();
|
CollectInfo();
|
||||||
@@ -142,7 +142,7 @@ wxVideoXANIM::wxVideoXANIM(const wxString& filename)
|
|||||||
m_remove_file = FALSE;
|
m_remove_file = FALSE;
|
||||||
m_size[0] = 0;
|
m_size[0] = 0;
|
||||||
m_size[1] = 0;
|
m_size[1] = 0;
|
||||||
|
|
||||||
CollectInfo();
|
CollectInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,7 +152,7 @@ wxVideoXANIM::~wxVideoXANIM()
|
|||||||
Stop();
|
Stop();
|
||||||
delete m_internal;
|
delete m_internal;
|
||||||
delete m_xanim_detector;
|
delete m_xanim_detector;
|
||||||
|
|
||||||
if (m_remove_file)
|
if (m_remove_file)
|
||||||
wxRemoveFile(m_filename);
|
wxRemoveFile(m_filename);
|
||||||
}
|
}
|
||||||
@@ -163,7 +163,7 @@ wxVideoXANIM::~wxVideoXANIM()
|
|||||||
bool wxVideoXANIM::Play()
|
bool wxVideoXANIM::Play()
|
||||||
{
|
{
|
||||||
if (!m_paused && m_xanim_started)
|
if (!m_paused && m_xanim_started)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
if (!m_video_output) {
|
if (!m_video_output) {
|
||||||
wxVideoCreateFrame(this);
|
wxVideoCreateFrame(this);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -203,12 +203,12 @@ bool wxVideoXANIM::Stop()
|
|||||||
SendCommand("q");
|
SendCommand("q");
|
||||||
|
|
||||||
// We are waiting for the termination of the subprocess.
|
// We are waiting for the termination of the subprocess.
|
||||||
while (m_xanim_started) {
|
while (m_xanim_started) {
|
||||||
wxYield();
|
wxYield();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_paused = FALSE;
|
m_paused = FALSE;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -315,7 +315,7 @@ bool wxVideoXANIM::AttachOutput(wxWindow& out)
|
|||||||
{
|
{
|
||||||
if (!wxVideoBaseDriver::AttachOutput(out))
|
if (!wxVideoBaseDriver::AttachOutput(out))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -348,7 +348,7 @@ bool wxVideoXANIM::SendCommand(const char *command, char **ret,
|
|||||||
int prop_format;
|
int prop_format;
|
||||||
Atom prop_type;
|
Atom prop_type;
|
||||||
unsigned long extra;
|
unsigned long extra;
|
||||||
|
|
||||||
XGetWindowProperty(m_internal->xanim_dpy, m_internal->xanim_window,
|
XGetWindowProperty(m_internal->xanim_dpy, m_internal->xanim_window,
|
||||||
m_internal->xanim_ret, 0, 16, True, AnyPropertyType,
|
m_internal->xanim_ret, 0, 16, True, AnyPropertyType,
|
||||||
&prop_type, &prop_format, (unsigned long *)size,
|
&prop_type, &prop_format, (unsigned long *)size,
|
||||||
@@ -362,7 +362,7 @@ bool wxVideoXANIM::CollectInfo()
|
|||||||
wxVideoXANIMOutput *xanimProcess;
|
wxVideoXANIMOutput *xanimProcess;
|
||||||
wxString xanim_command;
|
wxString xanim_command;
|
||||||
wxStringTokenizer tokenizer;
|
wxStringTokenizer tokenizer;
|
||||||
|
|
||||||
xanimProcess = new wxVideoXANIMOutput;
|
xanimProcess = new wxVideoXANIMOutput;
|
||||||
xanim_command = wxT("xanim +v +Zv -Ae ");
|
xanim_command = wxT("xanim +v +Zv -Ae ");
|
||||||
xanim_command += m_filename;
|
xanim_command += m_filename;
|
||||||
@@ -371,22 +371,22 @@ bool wxVideoXANIM::CollectInfo()
|
|||||||
|
|
||||||
wxInputStream *infoStream = xanimProcess->GetInputStream();
|
wxInputStream *infoStream = xanimProcess->GetInputStream();
|
||||||
wxString totalOutput;
|
wxString totalOutput;
|
||||||
|
|
||||||
while (infoStream->LastError() == wxSTREAM_NOERROR) {
|
while (infoStream->LastError() == wxSTREAM_NOERROR) {
|
||||||
char line[100];
|
char line[100];
|
||||||
|
|
||||||
infoStream->Read(line, sizeof(line)-1);
|
infoStream->Read(line, sizeof(line)-1);
|
||||||
if (infoStream->LastRead() == 0)
|
if (infoStream->LastRead() == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
line[infoStream->LastRead()] = 0;
|
line[infoStream->LastRead()] = 0;
|
||||||
|
|
||||||
totalOutput += line;
|
totalOutput += line;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is good for everything ... :-)
|
// This is good for everything ... :-)
|
||||||
int position = totalOutput.Find(wxT("Video Codec:"));
|
int position = totalOutput.Find(wxT("Video Codec:"));
|
||||||
|
|
||||||
totalOutput.Remove(0, position+13);
|
totalOutput.Remove(0, position+13);
|
||||||
|
|
||||||
position = totalOutput.Find(wxT("depth="));
|
position = totalOutput.Find(wxT("depth="));
|
||||||
@@ -398,11 +398,11 @@ bool wxVideoXANIM::CollectInfo()
|
|||||||
// the rest of the line
|
// the rest of the line
|
||||||
wxString token = tokenizer.GetNextToken();
|
wxString token = tokenizer.GetNextToken();
|
||||||
unsigned long my_long;
|
unsigned long my_long;
|
||||||
|
|
||||||
#define GETINT(i) \
|
#define GETINT(i) \
|
||||||
totalOutput.ToULong(&my_long); \
|
totalOutput.ToULong(&my_long); \
|
||||||
i = my_long;
|
i = my_long;
|
||||||
|
|
||||||
// 'Audio Codec:'
|
// 'Audio Codec:'
|
||||||
totalOutput = tokenizer.GetString();
|
totalOutput = tokenizer.GetString();
|
||||||
totalOutput.Remove(0, totalOutput.Find(wxT(":"))+2);
|
totalOutput.Remove(0, totalOutput.Find(wxT(":"))+2);
|
||||||
@@ -456,10 +456,10 @@ bool wxVideoXANIM::RestartXANIM()
|
|||||||
unsigned long extra;
|
unsigned long extra;
|
||||||
char prop[4];
|
char prop[4];
|
||||||
bool xanim_chg_size;
|
bool xanim_chg_size;
|
||||||
|
|
||||||
if (!m_video_output || m_xanim_started)
|
if (!m_video_output || m_xanim_started)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
// Check if we can change the size of the window dynamicly
|
// Check if we can change the size of the window dynamicly
|
||||||
xanim_chg_size = TRUE;
|
xanim_chg_size = TRUE;
|
||||||
// Get current display
|
// Get current display
|
||||||
@@ -467,24 +467,24 @@ bool wxVideoXANIM::RestartXANIM()
|
|||||||
m_internal->xanim_dpy = gdk_display;
|
m_internal->xanim_dpy = gdk_display;
|
||||||
GtkPizza *pizza = GTK_PIZZA( m_video_output->m_wxwindow );
|
GtkPizza *pizza = GTK_PIZZA( m_video_output->m_wxwindow );
|
||||||
GdkWindow *window = pizza->bin_window;
|
GdkWindow *window = pizza->bin_window;
|
||||||
|
|
||||||
m_internal->xanim_window =
|
m_internal->xanim_window =
|
||||||
((GdkWindowPrivate *)window)->xwindow;
|
((GdkWindowPrivate *)window)->xwindow;
|
||||||
#endif
|
#endif
|
||||||
// Get the XANIM atom
|
// Get the XANIM atom
|
||||||
m_internal->xanim_atom = XInternAtom(m_internal->xanim_dpy,
|
m_internal->xanim_atom = XInternAtom(m_internal->xanim_dpy,
|
||||||
"XANIM_PROPERTY", False);
|
"XANIM_PROPERTY", False);
|
||||||
|
|
||||||
// Build the command
|
// Build the command
|
||||||
xanim_command.Printf(wxT("xanim -Zr +Ze +Sr +f +W%d +f +q "
|
xanim_command.Printf(wxT("xanim -Zr +Ze +Sr +f +W%d +f +q "
|
||||||
"+Av70 %s %s"), m_internal->xanim_window,
|
"+Av70 %s %s"), (int)m_internal->xanim_window,
|
||||||
(xanim_chg_size) ? _T("") : _T(""),
|
(xanim_chg_size) ? _T("") : _T(""),
|
||||||
WXSTRINGCAST m_filename);
|
WXSTRINGCAST m_filename);
|
||||||
|
|
||||||
// Execute it
|
// Execute it
|
||||||
if (!wxExecute(xanim_command, FALSE, m_xanim_detector))
|
if (!wxExecute(xanim_command, FALSE, m_xanim_detector))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
// Wait for XAnim to be ready
|
// Wait for XAnim to be ready
|
||||||
nitems = 0;
|
nitems = 0;
|
||||||
m_xanim_started = TRUE;
|
m_xanim_started = TRUE;
|
||||||
@@ -498,17 +498,17 @@ bool wxVideoXANIM::RestartXANIM()
|
|||||||
}
|
}
|
||||||
|
|
||||||
wxSize vibrato_size;
|
wxSize vibrato_size;
|
||||||
|
|
||||||
vibrato_size = m_video_output->GetSize();
|
vibrato_size = m_video_output->GetSize();
|
||||||
|
|
||||||
vibrato_size.SetWidth(vibrato_size.GetWidth()+1);
|
vibrato_size.SetWidth(vibrato_size.GetWidth()+1);
|
||||||
m_video_output->SetSize(vibrato_size);
|
m_video_output->SetSize(vibrato_size);
|
||||||
vibrato_size.SetWidth(vibrato_size.GetWidth()-1);
|
vibrato_size.SetWidth(vibrato_size.GetWidth()-1);
|
||||||
m_video_output->SetSize(vibrato_size);
|
m_video_output->SetSize(vibrato_size);
|
||||||
// Very useful ! Actually it "should" sends a SETSIZE event to XAnim
|
// Very useful ! Actually it "should" sends a SETSIZE event to XAnim
|
||||||
// FIXME: This event is not sent !!
|
// FIXME: This event is not sent !!
|
||||||
|
|
||||||
m_paused = FALSE;
|
m_paused = FALSE;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user