2019-03-02 23:43:43 +08:00
|
|
|
#ifndef STREAM_H
|
|
|
|
#define STREAM_H
|
|
|
|
|
2019-03-03 06:52:22 +08:00
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdint.h>
|
2019-07-31 07:55:32 +08:00
|
|
|
#include <libavformat/avformat.h>
|
2019-05-30 17:57:40 +08:00
|
|
|
#include <SDL2/SDL_atomic.h>
|
2019-03-02 23:43:43 +08:00
|
|
|
#include <SDL2/SDL_thread.h>
|
|
|
|
|
|
|
|
#include "net.h"
|
|
|
|
|
|
|
|
struct video_buffer;
|
|
|
|
|
|
|
|
struct stream {
|
|
|
|
socket_t socket;
|
|
|
|
struct video_buffer *video_buffer;
|
|
|
|
SDL_Thread *thread;
|
|
|
|
struct decoder *decoder;
|
|
|
|
struct recorder *recorder;
|
2019-07-31 07:55:32 +08:00
|
|
|
AVCodecContext *codec_ctx;
|
|
|
|
AVCodecParserContext *parser;
|
|
|
|
// successive packets may need to be concatenated, until a non-config
|
|
|
|
// packet is available
|
|
|
|
bool has_pending;
|
|
|
|
AVPacket pending;
|
2019-03-02 23:43:43 +08:00
|
|
|
};
|
|
|
|
|
2019-03-03 03:09:56 +08:00
|
|
|
void
|
|
|
|
stream_init(struct stream *stream, socket_t socket,
|
|
|
|
struct decoder *decoder, struct recorder *recorder);
|
|
|
|
|
2019-03-03 06:52:22 +08:00
|
|
|
bool
|
2019-03-03 03:09:56 +08:00
|
|
|
stream_start(struct stream *stream);
|
|
|
|
|
|
|
|
void
|
|
|
|
stream_stop(struct stream *stream);
|
|
|
|
|
|
|
|
void
|
|
|
|
stream_join(struct stream *stream);
|
2019-03-02 23:43:43 +08:00
|
|
|
|
|
|
|
#endif
|