| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Buffered file io for ffmpeg system | 2 * Buffered file io for ffmpeg system |
| 3 * Copyright (c) 2001 Fabrice Bellard | 3 * Copyright (c) 2001 Fabrice Bellard |
| 4 * | 4 * |
| 5 * This file is part of FFmpeg. | 5 * This file is part of FFmpeg. |
| 6 * | 6 * |
| 7 * FFmpeg is free software; you can redistribute it and/or | 7 * FFmpeg is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Lesser General Public | 8 * modify it under the terms of the GNU Lesser General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2.1 of the License, or (at your option) any later version. | 10 * version 2.1 of the License, or (at your option) any later version. |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 static int file_write(URLContext *h, unsigned char *buf, int size) | 66 static int file_write(URLContext *h, unsigned char *buf, int size) |
| 67 { | 67 { |
| 68 int fd = (intptr_t) h->priv_data; | 68 int fd = (intptr_t) h->priv_data; |
| 69 return write(fd, buf, size); | 69 return write(fd, buf, size); |
| 70 } | 70 } |
| 71 | 71 |
| 72 /* XXX: use llseek */ | 72 /* XXX: use llseek */ |
| 73 static int64_t file_seek(URLContext *h, int64_t pos, int whence) | 73 static int64_t file_seek(URLContext *h, int64_t pos, int whence) |
| 74 { | 74 { |
| 75 int fd = (intptr_t) h->priv_data; | 75 int fd = (intptr_t) h->priv_data; |
| 76 if (whence != SEEK_SET && whence != SEEK_CUR && whence != SEEK_END) |
| 77 return AVERROR_NOTSUPP; |
| 76 return lseek(fd, pos, whence); | 78 return lseek(fd, pos, whence); |
| 77 } | 79 } |
| 78 | 80 |
| 79 static int file_close(URLContext *h) | 81 static int file_close(URLContext *h) |
| 80 { | 82 { |
| 81 int fd = (intptr_t) h->priv_data; | 83 int fd = (intptr_t) h->priv_data; |
| 82 return close(fd); | 84 return close(fd); |
| 83 } | 85 } |
| 84 | 86 |
| 85 static int file_get_handle(URLContext *h) | 87 static int file_get_handle(URLContext *h) |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 return 0; | 123 return 0; |
| 122 } | 124 } |
| 123 | 125 |
| 124 URLProtocol pipe_protocol = { | 126 URLProtocol pipe_protocol = { |
| 125 "pipe", | 127 "pipe", |
| 126 pipe_open, | 128 pipe_open, |
| 127 file_read, | 129 file_read, |
| 128 file_write, | 130 file_write, |
| 129 .url_get_file_handle = file_get_handle, | 131 .url_get_file_handle = file_get_handle, |
| 130 }; | 132 }; |
| OLD | NEW |