#include "wx/wx.h"
#endif
#include <wx/stream.h>
-#include <wx/fstream.h>
-#include <wx/mstream.h>
+#include <wx/wfstream.h>
#include "mmfile.h"
m_tmpfname((char *)NULL), m_mfname((char *)NULL),
m_seekable(seekable)
{
-/*
if (preload) {
- wxMemoryStream *tmpstream = new wxMemoryStream();
+ wxStreamBuffer *streamb = new wxStreamBuffer(wxStreamBuffer::read_write);
- m_o_temp = tmpstream;
- m_i_temp = tmpstream;
+ streamb->Fixed(FALSE);
+ streamb->Flushable(FALSE);
+
+ m_o_temp = new wxOutputStream(streamb);
+ m_i_temp = new wxInputStream(streamb);
m_o_temp->Write(is);
+ streamb->ResetBuffer();
}
-*/
}
wxMMediaFile::wxMMediaFile(const wxString& fname)
m_ostream = NULL;
m_seekable = seekable;
-/*
if (preload) {
- wxMemoryStream *tmpstream = new wxMemoryStream();
+ wxStreamBuffer *streamb = new wxStreamBuffer(wxStreamBuffer::read_write);
+
+ streamb->Fixed(FALSE);
+ streamb->Flushable(FALSE);
- m_i_temp = tmpstream;
- m_o_temp = tmpstream;
+ m_o_temp = new wxOutputStream(streamb);
+ m_i_temp = new wxInputStream(streamb);
m_o_temp->Write(str);
+ streamb->ResetBuffer();
}
-*/
}
void wxMMediaFile::SetFile(wxOutputStream& str, bool seekable)
if (m_ostream)
m_ostream->Write(*m_i_temp);
- delete m_i_temp; // Only one delete because m_tmpo* and m_tmpi* are linked
+ delete (m_i_temp->InputStreamBuffer());
+ delete m_i_temp;
+ delete m_o_temp;
if (m_tmpfname)
wxRemoveFile(m_tmpfname);