mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-20 14:40:10 +00:00
Playback: use POSIX API
This commit is contained in:
@@ -5,9 +5,9 @@ CXX = @CXX@
|
||||
QMAKE = @QMAKE@
|
||||
LINKER = @LINKER@
|
||||
COMMON_FLAGS = -g @DEFS@ -DPATH_PREFIX=@prefix@ -DLIB_DIR=@libdir@ -Wall -Wextra -Wpointer-arith -msse2
|
||||
CFLAGS = @CFLAGS@ @X_CFLAGS@ $(COMMON_FLAGS)
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CXXFLAGS = @CXXFLAGS@ $(COMMON_FLAGS)
|
||||
CFLAGS = @CFLAGS@ @X_CFLAGS@ $(COMMON_FLAGS) -D_GNU_SOURCE
|
||||
CPPFLAGS = @CPPFLAGS@ -D_GNU_SOURCE
|
||||
CXXFLAGS = @CXXFLAGS@ $(COMMON_FLAGS) -D_GNU_SOURCE
|
||||
NVCCFLAGS = @NVCCFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBS += @LIBS@ @JACK_TRANS_LIB@ @MATHLIBS@ @COREAUDIO_LIB@ \
|
||||
|
||||
@@ -967,24 +967,30 @@ static void * reading_thread(void *args)
|
||||
perror("stat");
|
||||
goto next;
|
||||
}
|
||||
FILE *file = fopen(name, "rb");
|
||||
if(!file) {
|
||||
perror("fopen");
|
||||
int fd = open(name, O_RDONLY|O_DIRECT);
|
||||
if(fd == -1) {
|
||||
perror("open");
|
||||
goto next;
|
||||
}
|
||||
new_entry = malloc(sizeof(struct processed_entry));
|
||||
assert(new_entry != NULL);
|
||||
new_entry->data_len = sb.st_size;
|
||||
new_entry->data = malloc(new_entry->data_len);
|
||||
posix_memalign((void **) &new_entry->data,
|
||||
512, new_entry->data_len);
|
||||
new_entry->next = NULL;
|
||||
assert(new_entry->data != NULL);
|
||||
|
||||
size_t res = fread(new_entry->data, new_entry->data_len, 1, file);
|
||||
fclose(file);
|
||||
if(res != 1) {
|
||||
perror("fread");
|
||||
goto next;
|
||||
}
|
||||
ssize_t bytes = 0;
|
||||
do {
|
||||
ssize_t res = read(fd, new_entry->data + bytes,
|
||||
new_entry->data_len - bytes);
|
||||
if (res <= 0) {
|
||||
perror("read");
|
||||
break;
|
||||
}
|
||||
bytes += res;
|
||||
} while (bytes < new_entry->data_len);
|
||||
close(fd);
|
||||
|
||||
pthread_mutex_lock(&s->lock);
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user