]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/commitdiff
avio patch by (Gildas Bazin <gbazin at altern dot org>)
authormichael <michael@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Sat, 14 Feb 2004 16:25:32 +0000 (16:25 +0000)
committermichael <michael@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Sat, 14 Feb 2004 16:25:32 +0000 (16:25 +0000)
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@2783 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b

libavformat/aviobuf.c
libavformat/file.c

index 12760a857eb9313cdf39ebaef37359b39dd59df3..de140966c6b33ab49646aa2ad63c0ed9c7105c1a 100644 (file)
@@ -429,7 +429,7 @@ int url_fdopen(ByteIOContext *s, URLContext *h)
         return -ENOMEM;
 
     if (init_put_byte(s, buffer, buffer_size, 
-                      (h->flags & URL_WRONLY) != 0, h,
+                      (h->flags & URL_WRONLY || h->flags & URL_RDWR), h,
                       url_read_packet, url_write_packet, url_seek_packet) < 0) {
         av_free(buffer);
         return -EIO;
@@ -547,7 +547,8 @@ int url_fget_max_packet_size(ByteIOContext *s)
 int url_open_buf(ByteIOContext *s, uint8_t *buf, int buf_size, int flags)
 {
     return init_put_byte(s, buf, buf_size, 
-                         (flags & URL_WRONLY) != 0, NULL, NULL, NULL, NULL);
+                         (flags & URL_WRONLY || flags & URL_RDWR),
+                         NULL, NULL, NULL, NULL);
 }
 
 /* return the written or read size */
index ee1f72a00c334abd963bb48a1ff4af5b594b5fe4..b1d61caf8932412bcaabdbd943d7ffc59642de22 100644 (file)
@@ -37,7 +37,9 @@ static int file_open(URLContext *h, const char *filename, int flags)
 
     strstart(filename, "file:", &filename);
 
-    if (flags & URL_WRONLY) {
+    if (flags & URL_RDWR) {
+        access = O_CREAT | O_TRUNC | O_RDWR;
+    } else if (flags & URL_WRONLY) {
         access = O_CREAT | O_TRUNC | O_WRONLY;
     } else {
         access = O_RDONLY;