#include #include #include "../../libsink/sink.h" #include "../../libsink/desktop.h" #ifdef CAMU_HAVE_FFMPEG #include "../../codec/ffmpeg/common.h" #endif #include "../common.h" struct ctv { struct nn_event_loop loop; struct camu_desktop desktop; struct nn_thread thread; }; static nn_thread_result NNWT_THREADCALL event_loop_thread(void *userdata) { struct ctv *c = (struct ctv *)userdata; nn_thread_set_name("event_loop"); nn_event_loop_init(&c->loop); struct camu_sink *sink = &c->desktop.sink; sink->local = true; struct lia_prefs *prefs = &sink->prefs; #ifdef CAMU_HAVE_SUBTITLES prefs->enabled = (1 << CAMU_STREAM_AUDIO) | (1 << CAMU_STREAM_VIDEO) | (1 << CAMU_STREAM_SUBTITLE); #else prefs->enabled = (1 << CAMU_STREAM_AUDIO) | (1 << CAMU_STREAM_VIDEO); #endif prefs->language.audio = CAMU_LANG_JAPANESE; prefs->language.subtitles = CAMU_LANG_ENGLISH; if (!camu_desktop_connect(&c->desktop, &al_str_c("ctv"), &c->loop, NNWT_SOCKET_TCP, &al_str_c(""), CAMU_PORT)) { return 0; } nn_event_loop_run(&c->loop); return 0; } static s32 log_callback(void *userdata, u8 level, char *message) { (void)userdata; (void)level; __android_log_print(ANDROID_LOG_DEBUG, "CTV", "%*.*s", 0, AL_LOG_MESSAGE_SIZE, message); return al_strnlen(message, AL_LOG_MESSAGE_SIZE); } static struct ctv c = { 0 }; s32 stl_platform_main(u32 argc, str *argv) { (void)argc; (void)argv; al_set_print(log_callback, NULL); #ifdef CAMU_HAVE_FFMPEG camu_ff_common_init(); #endif if (!camu_desktop_open(&c.desktop, "ctv")) { return 0; } nn_thread_create(&c.thread, event_loop_thread, &c); return EXIT_SUCCESS; }