X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4d6306eb4da8cdac4b5dee9784959672c233eec8..20239453d57b635b6e578c4e46ef02b198512733:/utils/wxMMedia/mmfile.cpp?ds=inline diff --git a/utils/wxMMedia/mmfile.cpp b/utils/wxMMedia/mmfile.cpp index fa57adfc7f..47e31efe09 100644 --- a/utils/wxMMedia/mmfile.cpp +++ b/utils/wxMMedia/mmfile.cpp @@ -16,8 +16,7 @@ #include "wx/wx.h" #endif #include -#include -#include +#include #include "mmfile.h" @@ -44,16 +43,18 @@ wxMMediaFile::wxMMediaFile(wxInputStream& is, bool preload, bool seekable) 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) @@ -75,16 +76,18 @@ void wxMMediaFile::SetFile(wxInputStream& str, bool preload, bool seekable) 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); + m_o_temp->Write(is); + streamb->ResetBuffer(); } -*/ } void wxMMediaFile::SetFile(wxOutputStream& str, bool seekable) @@ -113,7 +116,9 @@ void wxMMediaFile::CleanUpPrevious() 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->StreamBuffer(); + delete m_i_temp; + delete m_o_temp; if (m_tmpfname) wxRemoveFile(m_tmpfname);