mirror of
https://github.com/albfan/miraclecast.git
synced 2025-03-09 23:38:56 +00:00
init source side implementation
This commit is contained in:
parent
c76667cf71
commit
5c501c0594
3 changed files with 725 additions and 459 deletions
File diff suppressed because it is too large
Load diff
|
@ -1,4 +1,6 @@
|
|||
/*
|
||||
* vim: set tabstop=4:softtabstop=4:shiftwidth=4:noexpandtab
|
||||
*
|
||||
* MiracleCast - Wifi-Display/Miracast Implementation
|
||||
*
|
||||
* MiracleCast is free software; you can redistribute it and/or modify it
|
||||
|
@ -39,12 +41,47 @@
|
|||
#include "shl_util.h"
|
||||
#include "wfd.h"
|
||||
|
||||
enum audio_format {
|
||||
AUDIO_FORMAT_UNKNOWN,
|
||||
AUDIO_FORMAT_LPCM,
|
||||
AUDIO_FORMAT_AAC,
|
||||
AUDIO_FORMAT_AC3,
|
||||
};
|
||||
|
||||
struct video_formats {
|
||||
uint8_t native_disp_mode;
|
||||
uint8_t pref_disp_mode;
|
||||
uint8_t codec_profile;
|
||||
uint8_t codec_level;
|
||||
unsigned int resolutions_cea;
|
||||
unsigned int resolutions_vesa;
|
||||
unsigned int resolutions_hh;
|
||||
uint8_t latency;
|
||||
unsigned short min_slice_size;
|
||||
unsigned short slice_enc_params;
|
||||
uint8_t frame_rate_control;
|
||||
int hres;
|
||||
int vres;
|
||||
};
|
||||
|
||||
struct audio_codecs {
|
||||
enum audio_format format;
|
||||
unsigned int modes;
|
||||
uint8_t latency;
|
||||
};
|
||||
|
||||
struct client_rtp_ports {
|
||||
char *profile;
|
||||
unsigned short port0;
|
||||
unsigned short port1;
|
||||
};
|
||||
|
||||
struct ctl_src {
|
||||
sd_event *event;
|
||||
|
||||
char *local;
|
||||
char *session;
|
||||
// char *url;
|
||||
char url[256];
|
||||
// char *uibc_config;
|
||||
// char *uibc_setting;
|
||||
struct sockaddr_storage addr;
|
||||
|
@ -52,47 +89,22 @@ struct ctl_src {
|
|||
int fd;
|
||||
sd_event_source *fd_source;
|
||||
|
||||
sd_event_source *req_source;
|
||||
|
||||
struct rtsp *rtsp;
|
||||
|
||||
struct {
|
||||
struct video_formats video_formats;
|
||||
struct audio_codecs audio_codecs;
|
||||
struct client_rtp_ports rtp_ports;
|
||||
|
||||
bool has_video_formats : 1;
|
||||
bool has_audio_codecs : 1;
|
||||
bool has_rtp_ports : 1;
|
||||
} sink;
|
||||
|
||||
bool connected : 1;
|
||||
bool hup : 1;
|
||||
//
|
||||
// uint32_t resolutions_cea;
|
||||
// uint32_t resolutions_vesa;
|
||||
// uint32_t resolutions_hh;
|
||||
//
|
||||
// int hres;
|
||||
// int vres;
|
||||
};
|
||||
|
||||
//extern int rstp_port;
|
||||
//extern bool uibc;
|
||||
//extern int uibc_port;
|
||||
//
|
||||
//struct ctl_sink {
|
||||
// sd_event *event;
|
||||
//
|
||||
// char *target;
|
||||
// char *session;
|
||||
// char *url;
|
||||
// char *uibc_config;
|
||||
// char *uibc_setting;
|
||||
// struct sockaddr_storage addr;
|
||||
// size_t addr_size;
|
||||
// int fd;
|
||||
// sd_event_source *fd_source;
|
||||
//
|
||||
// struct rtsp *rtsp;
|
||||
//
|
||||
// bool connected : 1;
|
||||
// bool hup : 1;
|
||||
//
|
||||
// uint32_t resolutions_cea;
|
||||
// uint32_t resolutions_vesa;
|
||||
// uint32_t resolutions_hh;
|
||||
//
|
||||
// int hres;
|
||||
// int vres;
|
||||
//};
|
||||
|
||||
#endif /* CTL_SRC_H */
|
||||
|
|
|
@ -54,8 +54,6 @@ static struct ctl_link *running_link;
|
|||
static struct ctl_peer *running_peer;
|
||||
static struct ctl_peer *pending_peer;
|
||||
//
|
||||
//void launch_player(struct ctl_sink *s);
|
||||
//
|
||||
//char *gst_scale_res;
|
||||
int gst_audio_en = 1;
|
||||
static const int DEFAULT_RSTP_PORT = 1991;
|
||||
|
@ -270,7 +268,7 @@ static int cmd_p2p_scan(char **args, unsigned int n)
|
|||
return 0;
|
||||
}
|
||||
|
||||
ctl_link_set_wfd_subelements(l, "00000600101c440032");
|
||||
ctl_link_set_wfd_subelements(l, "000600101c4400c8");
|
||||
r = ctl_link_set_p2p_scanning(l, !stop);
|
||||
if(!r && !running_link) {
|
||||
running_link = l;
|
||||
|
@ -421,11 +419,6 @@ static int src_timeout_fn(sd_event_source *s, uint64_t usec, void *data)
|
|||
|
||||
stop_timeout(&src_timeout);
|
||||
|
||||
cli_printf("src_timeout_fn(): %p, %d, %d\n",
|
||||
running_peer,
|
||||
running_peer ? running_peer->connected : 0,
|
||||
ctl_src_is_closed(src));
|
||||
|
||||
if (running_peer &&
|
||||
running_peer->connected &&
|
||||
ctl_src_is_closed(src)) {
|
||||
|
@ -720,7 +713,6 @@ void ctl_fn_peer_connected(struct ctl_peer *p)
|
|||
|
||||
src_connected = false;
|
||||
src_timeout_time = 1;
|
||||
cli_printf("src_timeout_time=%llu\n", src_timeout_time);
|
||||
schedule_timeout(&src_timeout,
|
||||
src_timeout_time * 1000ULL * 1000ULL,
|
||||
src_timeout_fn,
|
||||
|
@ -913,3 +905,5 @@ int main(int argc, char **argv)
|
|||
|
||||
return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
/* vim: set tabstop=4 softtabstop=4 shiftwidth=4 noexpandtab : */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue