aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMåns Rullgård <mans@mansr.com>2010-07-06 14:28:32 +0000
committerMåns Rullgård <mans@mansr.com>2010-07-06 14:28:32 +0000
commitdefb0009cff57d66fe952915917864cc5b3a417f (patch)
tree98b72bbdad356a1ef028261adb66a39ecd1aa5be
parenta2ab5ad5f15fc65b41d653f2b8a9606d45fad919 (diff)
downloadffmpeg-defb0009cff57d66fe952915917864cc5b3a417f.tar.gz
Add #ifdefs around code specific to file and pipe protocols
Originally committed as revision 24076 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavformat/file.c42
1 files changed, 24 insertions, 18 deletions
diff --git a/libavformat/file.c b/libavformat/file.c
index 1bc7cf951a..3c3f42f4df 100644
--- a/libavformat/file.c
+++ b/libavformat/file.c
@@ -33,6 +33,25 @@
/* standard file protocol */
+static int file_read(URLContext *h, unsigned char *buf, int size)
+{
+ int fd = (intptr_t) h->priv_data;
+ return read(fd, buf, size);
+}
+
+static int file_write(URLContext *h, const unsigned char *buf, int size)
+{
+ int fd = (intptr_t) h->priv_data;
+ return write(fd, buf, size);
+}
+
+static int file_get_handle(URLContext *h)
+{
+ return (intptr_t) h->priv_data;
+}
+
+#if CONFIG_FILE_PROTOCOL
+
static int file_open(URLContext *h, const char *filename, int flags)
{
int access;
@@ -57,18 +76,6 @@ static int file_open(URLContext *h, const char *filename, int flags)
return 0;
}
-static int file_read(URLContext *h, unsigned char *buf, int size)
-{
- int fd = (intptr_t) h->priv_data;
- return read(fd, buf, size);
-}
-
-static int file_write(URLContext *h, const unsigned char *buf, int size)
-{
- int fd = (intptr_t) h->priv_data;
- return write(fd, buf, size);
-}
-
/* XXX: use llseek */
static int64_t file_seek(URLContext *h, int64_t pos, int whence)
{
@@ -87,11 +94,6 @@ static int file_close(URLContext *h)
return close(fd);
}
-static int file_get_handle(URLContext *h)
-{
- return (intptr_t) h->priv_data;
-}
-
URLProtocol file_protocol = {
"file",
file_open,
@@ -102,7 +104,9 @@ URLProtocol file_protocol = {
.url_get_file_handle = file_get_handle,
};
-/* pipe protocol */
+#endif /* CONFIG_FILE_PROTOCOL */
+
+#if CONFIG_PIPE_PROTOCOL
static int pipe_open(URLContext *h, const char *filename, int flags)
{
@@ -133,3 +137,5 @@ URLProtocol pipe_protocol = {
file_write,
.url_get_file_handle = file_get_handle,
};
+
+#endif /* CONFIG_PIPE_PROTOCOL */