summaryrefslogtreecommitdiffstats
path: root/libmpdemux/muxer_lavf.c
diff options
context:
space:
mode:
authornicodvb <nicodvb@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-12-18 21:03:59 +0000
committernicodvb <nicodvb@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-12-18 21:03:59 +0000
commitcf099b21004558223ed3132dc42d37f5f814541e (patch)
tree1f69aaeaefe8da1ebb4b82bf63be442783c163c0 /libmpdemux/muxer_lavf.c
parentac9465059730747f59b07ad00b5daebbbece8c9f (diff)
downloadmpv-cf099b21004558223ed3132dc42d37f5f814541e.tar.bz2
mpv-cf099b21004558223ed3132dc42d37f5f814541e.tar.xz
muxers now write to output muxer->stream rather than to muxer->file
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@21676 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux/muxer_lavf.c')
-rw-r--r--libmpdemux/muxer_lavf.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/libmpdemux/muxer_lavf.c b/libmpdemux/muxer_lavf.c
index e06ff6abe6..17cc80d00a 100644
--- a/libmpdemux/muxer_lavf.c
+++ b/libmpdemux/muxer_lavf.c
@@ -12,8 +12,8 @@
#include "aviheader.h"
#include "ms_hdr.h"
-#include "muxer.h"
#include "stream.h"
+#include "muxer.h"
#include "demuxer.h"
#include "stheader.h"
#include "m_option.h"
@@ -89,14 +89,30 @@ static int mp_read(URLContext *h, unsigned char *buf, int size)
static int mp_write(URLContext *h, unsigned char *buf, int size)
{
muxer_t *muxer = (muxer_t*)h->priv_data;
- return fwrite(buf, 1, size, muxer->file);
+ return stream_write_buffer(muxer->stream, buf, size);
}
static offset_t mp_seek(URLContext *h, offset_t pos, int whence)
{
muxer_t *muxer = (muxer_t*)h->priv_data;
+ if(whence == SEEK_CUR)
+ {
+ off_t cur = stream_tell(muxer->stream);
+ if(cur == -1)
+ return -1;
+ pos += cur;
+ }
+ else if(whence == SEEK_END)
+ {
+ off_t size=0;
+ if(stream_control(muxer->stream, STREAM_CTRL_GET_SIZE, &size) == STREAM_UNSUPORTED || size < pos)
+ return -1;
+ pos = size - pos;
+ }
mp_msg(MSGT_MUXER, MSGL_DBG2, "SEEK %"PRIu64"\n", (int64_t)pos);
- return fseeko(muxer->file, pos, whence);
+ if(!stream_seek(muxer->stream, pos))
+ return -1;
+ return 0;
}