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