diff --git a/Makefile.am b/Makefile.am index d72ae55..63bddcc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,4 @@ bin_PROGRAMS=tcfs -tcfs_SOURCES=src/tcfs.c +tcfs_SOURCES=src/tcfs.c src/transcode.c src/util.c tcfs_LDADD = $(LIBOBJS) $(FUSE_LIBS) $(libavcore_LIBS) $(libavutil_LIBS) $(libavformat_LIBS) $(libavcodec_LIBS) tcfs_CFLAGS = $(FUSE_CFLAGS) $(libavcore_CFLAGS) $(libavutil_CFLAGS) $(libavformat_CFLAGS) $(libavcodec_CFLAGS) -DFUSE_USE_VERSION=28 \ No newline at end of file diff --git a/src/common.h b/src/common.h index d7aa301..a49c224 100644 --- a/src/common.h +++ b/src/common.h @@ -58,4 +58,9 @@ # include #endif +#include +#include +#include +#include + #endif diff --git a/src/tcfs.c b/src/tcfs.c index 750bb43..972eb00 100644 --- a/src/tcfs.c +++ b/src/tcfs.c @@ -5,136 +5,13 @@ */ #include "common.h" +#include "util.h" +#include "transcode.h" #include #include -struct options { - char *base; - char *tfmt; -} options; - -// Get the filename from a path, i.e. a pointer to the character after the last / in path. -// If path contains no /, returns path. -char *get_file_from_path(const char *path) -{ - if(!path) - return NULL; - - char *ret = strchr(path, '/'); - if(ret == NULL) - return path; - - return ret+1; -} - -// Get the extension from the file name -char *get_ext_from_file(const char *file) -{ - if(!file) - return NULL; - - char *ret = strchr(file, '.'); - if(!ret) - return file+strlen(file); - if(ret == file) - return file+strlen(file); // return pointer to '\0'; - - return ret+1; -} - -char *strip_ext_from_path(const char *path) -{ - if(!path) - return NULL; - - char *ret = strdup(path); - - char *ext = strchr(ret, '.'); - char *file = strchr(ret, '/'); - if(!ext || (ext + + This work is licensed under the Open Software License ("OSL") v. 3.0. + */ + +#include "common.h" + +struct TC_FILE { +}; + +struct TC_FILE *tc_open(const char *src, const char *tfmt) +{ + return NULL; +} + +int tc_read(char *buf, size_t size, struct TC_FILE *fd) +{ + errno = ENOSYS; + return 0; +} diff --git a/src/transcode.h b/src/transcode.h new file mode 100644 index 0000000..a63d743 --- /dev/null +++ b/src/transcode.h @@ -0,0 +1,15 @@ +/* + Copyright (c) 2010 Matthias Blankertz + + This work is licensed under the Open Software License ("OSL") v. 3.0. + */ + +#ifndef TCFS_TRANSCODE_H +#define TCFS_TRANSCODE_H 1 + +struct TC_FILE; + +struct TC_FILE *tc_open(const char *src, const char *tfmt); +int tc_read(char *buf, size_t size, struct TC_FILE *fd); + +#endif diff --git a/src/util.c b/src/util.c new file mode 100644 index 0000000..62adfd1 --- /dev/null +++ b/src/util.c @@ -0,0 +1,130 @@ +/* + Copyright (c) 2010 Matthias Blankertz + + This work is licensed under the Open Software License ("OSL") v. 3.0. + */ + +#include "common.h" +#include "util.h" + +// Get the filename from a path, i.e. a pointer to the character after the last / in path. +// If path contains no /, returns path. +const char *get_file_from_path(const char *path) +{ + if(!path) + return NULL; + + char *ret = strchr(path, '/'); + if(ret == NULL) + return path; + + return ret+1; +} + +// Get the extension from the file name +const char *get_ext_from_file(const char *file) +{ + if(!file) + return NULL; + + char *ret = strchr(file, '.'); + if(!ret) + return file+strlen(file); + if(ret == file) + return file+strlen(file); // return pointer to '\0'; + + return ret+1; +} + +char *strip_ext_from_path(const char *path) +{ + if(!path) + return NULL; + + char *ret = strdup(path); + + char *ext = strchr(ret, '.'); + char *file = strchr(ret, '/'); + if(!ext || (ext + + This work is licensed under the Open Software License ("OSL") v. 3.0. + */ + +#ifndef TCFS_UTIL_H +#define TCFS_UTIL_H 1 + +struct options { + char *base; + char *tfmt; +}; + +extern struct options options; + +const char *get_file_from_path(const char *path); +const char *get_ext_from_file(const char *file); +char *strip_ext_from_path(const char *path); +int is_tc_audio_file(const char *path); +char *get_tc_source_name(const char *path); +char *path_cat(const char *path); + +#endif