summaryrefslogtreecommitdiff
path: root/src/liana
diff options
context:
space:
mode:
Diffstat (limited to 'src/liana')
-rw-r--r--src/liana/client.c30
-rw-r--r--src/liana/vcr.c6
2 files changed, 21 insertions, 15 deletions
diff --git a/src/liana/client.c b/src/liana/client.c
index 626a752..00eaca6 100644
--- a/src/liana/client.c
+++ b/src/liana/client.c
@@ -137,32 +137,38 @@ static void parse_info_packet(struct lia_client *client, struct nn_packet *packe
al_array_foreach_ptr(client->streams, i, stream) {
u8 type_mask = type_to_mask[stream->type];
if ((selected & type_mask) || !(prefs->enabled_mask & type_mask)) continue;
+ const char *title = NULL;
#ifdef CAMU_HAVE_FFMPEG
- const AVDictionaryEntry *title = NULL;
if (stream->mode == CAMU_FFMPEG_COMPAT) {
AVDictionary *metadata = stream->av.stream->metadata;
- title = av_dict_get(metadata, "title", NULL, 0);
- const AVDictionaryEntry *lang = av_dict_get(metadata, "language", NULL, 0);
- if (lang && !accept_defaults) {
- u8 lang_value = CAMU_LANG_UNKNOWN;
- if (strcmp(lang->value, "eng") == 0) lang_value = CAMU_LANG_ENGLISH;
- else if (strcmp(lang->value, "jpn") == 0) lang_value = CAMU_LANG_JAPANESE;
+ const AVDictionaryEntry *title_entry = av_dict_get(metadata, "title", NULL, 0);
+ if (title_entry) title = title_entry->value;
+ const AVDictionaryEntry *lang_entry = av_dict_get(metadata, "language", NULL, 0);
+ if (lang_entry && !accept_defaults) {
+ u8 lang = CAMU_LANG_UNKNOWN;
+ if (strcmp(lang_entry->value, "eng") == 0) {
+ lang = CAMU_LANG_ENGLISH;
+ } else if (strcmp(lang_entry->value, "jpn") == 0) {
+ lang = CAMU_LANG_JAPANESE;
+ }
switch (stream->type) {
case CAMU_STREAM_AUDIO:
- if (prefs->audio_lang != lang_value) continue;
+ if (prefs->audio_lang != lang) continue;
break;
case CAMU_STREAM_SUBTITLE:
- if (prefs->subtitle_lang != lang_value) continue;
+ if (prefs->subtitle_lang != lang) continue;
break;
default:
break;
}
}
}
- log_info("Selected %s stream (index: %u, title: %s).", type_to_str[stream->type], stream->index, title ? title->value : "(empty)");
-#else
- log_info("Selected %s stream (index: %u).", type_to_str[stream->type], stream->index);
#endif
+ if (title) {
+ log_info("Selected %s stream (index: %u, title: %s).", type_to_str[stream->type], stream->index, title);
+ } else {
+ log_info("Selected %s stream (index: %u).", type_to_str[stream->type], stream->index);
+ }
selected |= type_mask;
client->mask |= 1 << stream->index;
struct lia_vcr_track *track = al_alloc_object(struct lia_vcr_track);
diff --git a/src/liana/vcr.c b/src/liana/vcr.c
index 78c2b9c..270bc38 100644
--- a/src/liana/vcr.c
+++ b/src/liana/vcr.c
@@ -4,7 +4,7 @@
#include "vcr.h"
#include "handler.h"
-#define VCR_BUFFER_BUFFERED MB(8)
+#define VCR_BUFFER_BUFFERED MB(2)
enum {
VCR_EXPAND_UNTOUCHED = 0,
@@ -78,7 +78,7 @@ static nn_thread_result NNWT_THREADCALL vcr_track_thread(void *userdata)
packet = nn_packet_cache_at(&track->cache, index);
#ifdef VCR_BUFFER_WHOLE_FILE
- if (!packet) { // Loop.
+ if (!packet && packets > 2) { // Loop.
index = 0;
corked = false;
break;
@@ -223,7 +223,7 @@ static void cork_if_buffered(struct lia_vcr *vcr, u64 buffer)
}
if (buffered) {
if (vcr->expand == VCR_EXPAND_UNTOUCHED) {
- vcr->mark.buffered = buffer * 2;
+ vcr->mark.buffered = buffer * 8;
vcr->expand = VCR_EXPAND_GROWN;
log_info("Expanded buffer to size %.2fMB.", vcr->mark.buffered / (f32)MB(1));
return;