summaryrefslogtreecommitdiff
path: root/src/liana
diff options
context:
space:
mode:
Diffstat (limited to 'src/liana')
-rw-r--r--src/liana/list.c13
-rw-r--r--src/liana/list.h4
-rw-r--r--src/liana/list_cmp.h27
-rw-r--r--src/liana/server.c11
-rw-r--r--src/liana/server.h1
5 files changed, 25 insertions, 31 deletions
diff --git a/src/liana/list.c b/src/liana/list.c
index 0ceb591..fd58ea1 100644
--- a/src/liana/list.c
+++ b/src/liana/list.c
@@ -407,7 +407,7 @@ static void handle_seek(struct lia_list *list, s32 sequence, u32 id, u64 pos)
al_assert(entry);
if (entry->duration == 0 || entry->duration == LIANA_TIMESTAMP_INVALID) {
- log_warn("Skipping seek on entry with no duration.");
+ log_warn("Skipping seek on entry with unknown or 0 duration.");
return;
}
@@ -451,6 +451,11 @@ static bool handle_end(struct lia_list *list, u32 id, u32 reset_id)
if (sequence < 0) return true;
struct lia_list_entry *entry = get_entry_from_sequence(list, sequence);
+ // Looping:
+ // - Main issue is rolling back an entry that skipped onto queued
+ // before it's looping state was synced.
+ // - Maybe we can track which sink END comes from.
+
if (reset_id != entry->reset_id) {
log_warn("Got end() with out of order or incorrect reset id, ignoring.");
return true;
@@ -689,7 +694,7 @@ void lia_list_remove_sink(struct lia_list *list, void *userdata)
handle_remove_sink(list, userdata);
}
-void lia_list_add(struct lia_list *list, void *opaque, u64 duration, wstr *name)
+void lia_list_add(struct lia_list *list, void *opaque, u64 duration, str *brief)
{
struct lia_list_entry *entry = al_alloc_object(struct lia_list_entry);
entry->opaque = opaque;
@@ -701,7 +706,7 @@ void lia_list_add(struct lia_list *list, void *opaque, u64 duration, wstr *name)
entry->ended = false;
entry->reset_id = get_incremental_id(list);
entry->duration = duration;
- al_wstr_clone(&entry->name, name);
+ al_str_clone(&entry->brief, brief);
entry->list = list;
struct lia_list_cmd *cmd = al_alloc_object(struct lia_list_cmd);
cmd->op = ADD;
@@ -824,7 +829,7 @@ void lia_list_free(struct lia_list *list)
if (list->cmd) al_free(list->cmd);
struct lia_list_entry *entry;
al_array_foreach(list->entries, i, entry) {
- al_wstr_free(&entry->name);
+ al_str_free(&entry->brief);
al_free(entry);
}
al_array_free(list->entries);
diff --git a/src/liana/list.h b/src/liana/list.h
index 86a9712..36d95a4 100644
--- a/src/liana/list.h
+++ b/src/liana/list.h
@@ -82,7 +82,7 @@ struct lia_list_entry {
bool ended;
u32 reset_id;
u64 duration;
- wstr name;
+ str brief;
struct lia_list *list;
};
@@ -136,7 +136,7 @@ void lia_list_pump(struct lia_list *list);
void lia_list_add_sink(struct lia_list *list, void (*callback)(void *, u8, struct lia_list_entry *, s32, struct lia_timing *), void *userdata);
void lia_list_remove_sink(struct lia_list *list, void *userdata);
-void lia_list_add(struct lia_list *list, void *opaque, u64 duration, wstr *name);
+void lia_list_add(struct lia_list *list, void *opaque, u64 duration, str *brief);
void lia_list_unset(struct lia_list *list);
void lia_list_skipto(struct lia_list *list, s32 sequence, s32 i);
void lia_list_skip(struct lia_list *list, s32 sequence, s32 n);
diff --git a/src/liana/list_cmp.h b/src/liana/list_cmp.h
index 556f5dd..ee9b3f8 100644
--- a/src/liana/list_cmp.h
+++ b/src/liana/list_cmp.h
@@ -6,38 +6,38 @@
AL_IGNORE_WARNING("-Wunused-function")
-static void camu_db_num_from_path(wstr *path, s64 *id, s64 *index)
+static void camu_db_num_from_path(str *path, s64 *id, s64 *index)
{
- u32 last_slash = al_wstr_rfind(path, L'/');
+ u32 last_slash = al_str_rfind(path, '/');
if (last_slash == AL_WSTR_NPOS) {
return;
}
- wstr sub = al_wstr_substr(path, last_slash + 1, path->length);
+ str sub = al_str_substr(path, last_slash + 1, path->length);
// Skip 2 '_' characters.
- if (!(al_wstr_tok(&sub, L'_') && al_wstr_tok(&sub, L'_'))) {
+ if (!(al_str_tok(&sub, '_') && al_str_tok(&sub, '_'))) {
return;
}
- u32 target = al_wstr_find(&sub, L'_');
+ u32 target = al_str_find(&sub, '_');
if (target == AL_WSTR_NPOS) {
return;
}
- sub = al_wstr_substr(&sub, 0, target);
+ sub = al_str_substr(&sub, 0, target);
bool error;
- s64 num = al_wstr_to_long(&sub, 10, &error);
+ s64 num = al_str_to_long(&sub, 10, &error);
if (error) return;
*id = num;
- u32 ext_dot = al_wstr_rfind(path, L'.');
- u32 a_of_media = al_wstr_rfind(path, 'a');
+ u32 ext_dot = al_str_rfind(path, '.');
+ u32 a_of_media = al_str_rfind(path, 'a');
if (ext_dot == AL_WSTR_NPOS || a_of_media == AL_WSTR_NPOS) {
return;
}
- sub = al_wstr_substr(path, a_of_media + 1, ext_dot);
+ sub = al_str_substr(path, a_of_media + 1, ext_dot);
- num = al_wstr_to_long(&sub, 10, &error);
+ num = al_str_to_long(&sub, 10, &error);
if (error) return;
*index = num;
}
@@ -48,8 +48,9 @@ static s32 camu_db_compare(const void *a, const void *b)
struct lia_list_entry *bb = *((struct lia_list_entry **)b);
s64 a_id = -1, a_index = -1;
s64 b_id = -1, b_index = -1;
- camu_db_num_from_path(&aa->name, &a_id, &a_index);
- camu_db_num_from_path(&bb->name, &b_id, &b_index);
+ // Assuming brief is the file path.
+ camu_db_num_from_path(&aa->brief, &a_id, &a_index);
+ camu_db_num_from_path(&bb->brief, &b_id, &b_index);
if (a_id == b_id) {
if (a_index > b_index) return 1;
else if (a_index < b_index) return -1;
diff --git a/src/liana/server.c b/src/liana/server.c
index acb5f31..cc4ceed 100644
--- a/src/liana/server.c
+++ b/src/liana/server.c
@@ -1,7 +1,6 @@
#include "server.h"
#include "handler.h"
#include "handlers.h"
-#include "process.h"
#include "list.h"
static inline u32 get_incremental_id(struct lia_server *server)
@@ -443,13 +442,6 @@ static void duration_signal_callback(void *userdata)
nn_signal_stop(&node->signal);
nn_thread_join(&node->thread);
node->handler->free(&node->handler);
- bool got_visual_data = false;
- struct lia_visual_data visual_data;
-#if 0 // @TODO: This is obviously bad because it blocks the event loop.
- // Evaluate this when getting around to http/hls stream fixes.
- cch_handle_seek(&node->handle, 0, SEEK_SET);
- got_visual_data = lia_prepare_visual_data(&node->handle, &visual_data);
-#endif
cch_entry_return_handle(node->entry, &node->handle);
if (should_free_node(node)) {
free_node(node);
@@ -461,9 +453,6 @@ static void duration_signal_callback(void *userdata)
node->callback(node->userdata, LIANA_NODE_DURATION, &node->duration);
}
}
- if (got_visual_data) {
- node->callback(node->userdata, LIANA_NODE_VISUAL_DATA, &visual_data);
- }
}
void lia_node_get_duration(struct lia_node *node)
diff --git a/src/liana/server.h b/src/liana/server.h
index 55a581e..8035ee1 100644
--- a/src/liana/server.h
+++ b/src/liana/server.h
@@ -27,7 +27,6 @@ struct lia_node_connection {
enum {
LIANA_NODE_DURATION = 0,
- LIANA_NODE_VISUAL_DATA,
LIANA_NODE_ERRORED
};