Add stub Video Receiver

This commit is contained in:
Florian Märkl 2019-05-31 22:22:56 +02:00
commit b2541d5430
No known key found for this signature in database
GPG key ID: 125BC8A5A6A1E857
5 changed files with 110 additions and 3 deletions

View file

@ -16,7 +16,9 @@ set(HEADER_FILES
include/chiaki/launchspec.h
include/chiaki/random.h
include/chiaki/gkcrypt.h
include/chiaki/audio.h)
include/chiaki/audio.h
include/chiaki/audioreceiver.h
include/chiaki/videoreceiver.h)
set(SOURCE_FILES
src/common.c
@ -36,7 +38,10 @@ set(SOURCE_FILES
src/ecdh.c
src/launchspec.c
src/random.c
src/gkcrypt.c src/audio.c include/chiaki/audioreceiver.h src/audioreceiver.c)
src/gkcrypt.c
src/audio.c
src/audioreceiver.c
src/videoreceiver.c)
add_subdirectory(protobuf)
include_directories("${NANOPB_SOURCE_DIR}")

View file

@ -28,6 +28,7 @@
#include "ecdh.h"
#include "audio.h"
#include "audioreceiver.h"
#include "videoreceiver.h"
#include <stdint.h>
#include <netdb.h>
@ -133,6 +134,7 @@ typedef struct chiaki_session_t
ChiakiNagare nagare;
ChiakiAudioReceiver *audio_receiver;
ChiakiVideoReceiver *video_receiver;
} ChiakiSession;
CHIAKI_EXPORT ChiakiErrorCode chiaki_session_init(ChiakiSession *session, ChiakiConnectInfo *connect_info);

View file

@ -0,0 +1,59 @@
/*
* This file is part of Chiaki.
*
* Chiaki is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Chiaki is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Chiaki. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef CHIAKI_VIDEORECEIVER_H
#define CHIAKI_VIDEORECEIVER_H
#include "common.h"
#include "log.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct chiaki_video_receiver_t
{
struct chiaki_session_t *session;
ChiakiLog *log;
} ChiakiVideoReceiver;
CHIAKI_EXPORT void chiaki_video_receiver_init(ChiakiVideoReceiver *video_receiver, struct chiaki_session_t *session);
CHIAKI_EXPORT void chiaki_video_receiver_fini(ChiakiVideoReceiver *video_receiver);
static inline ChiakiVideoReceiver *chiaki_video_receiver_new(struct chiaki_session_t *session)
{
ChiakiVideoReceiver *video_receiver = CHIAKI_NEW(ChiakiVideoReceiver);
if(!video_receiver)
return NULL;
chiaki_video_receiver_init(video_receiver, session);
return video_receiver;
}
static inline void chiaki_video_receiver_free(ChiakiVideoReceiver *video_receiver)
{
if(!video_receiver)
return;
chiaki_video_receiver_fini(video_receiver);
free(video_receiver);
}
#ifdef __cplusplus
}
#endif
#endif // CHIAKI_VIDEORECEIVER_H

View file

@ -192,15 +192,26 @@ static void *session_thread_func(void *arg)
goto quit_ctrl;
}
session->video_receiver = chiaki_video_receiver_new(session);
if(!session->video_receiver)
{
CHIAKI_LOGE(&session->log, "Session failed to initialize Video Receiver\n");
goto quit_audio_receiver;
}
err = chiaki_nagare_run(session);
if(err != CHIAKI_ERR_SUCCESS)
{
CHIAKI_LOGE(&session->log, "Nagare failed\n");
goto quit_audio_receiver;
goto quit_video_receiver;
}
CHIAKI_LOGI(&session->log, "Nagare completed successfully\n");
quit_video_receiver:
chiaki_video_receiver_free(session->video_receiver);
session->video_receiver = NULL;
quit_audio_receiver:
chiaki_audio_receiver_free(session->audio_receiver);
session->audio_receiver = NULL;

30
lib/src/videoreceiver.c Normal file
View file

@ -0,0 +1,30 @@
/*
* This file is part of Chiaki.
*
* Chiaki is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Chiaki is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Chiaki. If not, see <https://www.gnu.org/licenses/>.
*/
#include <chiaki/videoreceiver.h>
#include <chiaki/session.h>
CHIAKI_EXPORT void chiaki_video_receiver_init(ChiakiVideoReceiver *video_receiver, struct chiaki_session_t *session)
{
video_receiver->session = session;
video_receiver->log = &session->log;
}
CHIAKI_EXPORT void chiaki_video_receiver_fini(ChiakiVideoReceiver *video_receiver)
{
}