mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-20 06:40:03 +00:00
main.c -> main.cpp
This commit is contained in:
@@ -3,7 +3,7 @@ dnl Process this file with autoconf to produce a configure script.
|
||||
AC_INIT([UltraGrid], [1.2], [ultragrid-dev@cesnet.cz])
|
||||
AM_INIT_AUTOMAKE([1.10])
|
||||
AC_PREREQ(2.61)
|
||||
AC_CONFIG_SRCDIR([src/main.c])
|
||||
AC_CONFIG_SRCDIR([src/main.cpp])
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
|
||||
PARENT=`echo $PWD | sed -e 's%/[[^/]]*$%%'`
|
||||
|
||||
@@ -55,6 +55,10 @@
|
||||
#include "config_win32.h"
|
||||
#endif // HAVE_CONFIG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define PORT_AUDIO 5006
|
||||
|
||||
#define MAX_AUDIO_CHANNELS 8
|
||||
@@ -142,16 +146,9 @@ int audio_reconfigure(struct state_audio *s, int quant_samples, int channels,
|
||||
|
||||
unsigned int audio_get_display_flags(struct state_audio *s);
|
||||
|
||||
/**
|
||||
* Changes bps for everey sample.
|
||||
*
|
||||
* The memory areas shouldn't (supposedly) overlap.
|
||||
*/
|
||||
void change_bps(char *out, int out_bps, const char *in, int in_bps, int in_len /* bytes */);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Makes n copies of first channel (interleaved).
|
||||
*/
|
||||
void audio_frame_multiply_channel(struct audio_frame *frame, int new_channel_count);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -44,6 +44,10 @@
|
||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct state_audio_capture;
|
||||
struct audio_frame;
|
||||
|
||||
@@ -69,5 +73,10 @@ const char *audio_capture_get_driver_name(struct state_audio_cap
|
||||
* SDI (embedded sound).
|
||||
*/
|
||||
void *audio_capture_get_state_pointer(struct state_audio_capture *s);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/* vim: set expandtab: sw=4 */
|
||||
|
||||
|
||||
@@ -62,6 +62,10 @@
|
||||
#include "video_capture.h"
|
||||
#include "video_display.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct ihdtv_state;
|
||||
struct video_frame;
|
||||
struct rx_tx;
|
||||
@@ -71,5 +75,9 @@ extern struct rx_tx ihdtv_rxtx;
|
||||
struct ihdtv_state *initialize_ihdtv(struct vidcap *capture_device, struct display *display_device,
|
||||
int requested_mtu, int argc, char **argv);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // IHDTV_H_
|
||||
|
||||
|
||||
@@ -409,7 +409,7 @@ static struct rtp **initialize_network(const char *addrs, int recv_port_base,
|
||||
|
||||
devices[index] = rtp_init_if(addr, mcast_if, recv_port,
|
||||
send_port, ttl, rtcp_bw, FALSE,
|
||||
rtp_recv_callback, (void *)participants,
|
||||
rtp_recv_callback, (uint8_t *)participants,
|
||||
use_ipv6);
|
||||
if (devices[index] != NULL) {
|
||||
rtp_set_option(devices[index], RTP_OPT_WEAK_VALIDATION,
|
||||
@@ -455,7 +455,7 @@ void destroy_rtp_devices(struct rtp ** network_devices)
|
||||
}
|
||||
|
||||
static struct vcodec_state *new_video_decoder(struct state_uv *uv) {
|
||||
struct vcodec_state *state = calloc(1, sizeof(struct vcodec_state));
|
||||
struct vcodec_state *state = (struct vcodec_state *) calloc(1, sizeof(struct vcodec_state));
|
||||
|
||||
if(state) {
|
||||
state->decoder = video_decoder_init(&uv->receiver_mod, uv->decoder_mode,
|
||||
@@ -476,7 +476,7 @@ static struct vcodec_state *new_video_decoder(struct state_uv *uv) {
|
||||
}
|
||||
|
||||
static void destroy_video_decoder(void *state) {
|
||||
struct vcodec_state *video_decoder_state = state;
|
||||
struct vcodec_state *video_decoder_state = (struct vcodec_state *) state;
|
||||
|
||||
if(!video_decoder_state) {
|
||||
return;
|
||||
@@ -650,7 +650,7 @@ void *ultragrid_rtp_receiver_thread(void *arg)
|
||||
((struct vcodec_state*) cp->decoder_state)->display = uv->display_device;
|
||||
}
|
||||
|
||||
struct vcodec_state *vdecoder_state = cp->decoder_state;
|
||||
struct vcodec_state *vdecoder_state = (struct vcodec_state *) cp->decoder_state;
|
||||
|
||||
/* Decode and render video... */
|
||||
if (pbuf_decode
|
||||
@@ -749,6 +749,7 @@ static void *capture_thread(void *arg)
|
||||
struct module *uv_mod = (struct module *)arg;
|
||||
struct state_uv *uv = (struct state_uv *) uv_mod->priv_data;
|
||||
struct sender_data sender_data;
|
||||
struct wait_obj *wait_obj;
|
||||
memset(&sender_data, 0, sizeof(sender_data));
|
||||
|
||||
struct compress_state *compression = NULL;
|
||||
@@ -772,10 +773,7 @@ static void *capture_thread(void *arg)
|
||||
sender_data.video_exporter = uv->video_exporter;
|
||||
sender_data.compression = compression;
|
||||
|
||||
// The magic here with wait_objs is a workaround until all capture
|
||||
// drivers implement a dispose function. Until that, it is supposed
|
||||
// that every vidcap_grab call invalidates previous captured frame.
|
||||
struct wait_obj *wait_obj = wait_obj_init();
|
||||
wait_obj = wait_obj_init();
|
||||
|
||||
if(!sender_init(&sender_data)) {
|
||||
fprintf(stderr, "Error initializing sender.\n");
|
||||
@@ -922,6 +920,7 @@ int main(int argc, char *argv[])
|
||||
unsigned display_flags = 0;
|
||||
int compressed_audio_sample_rate = 48000;
|
||||
int ret;
|
||||
struct vidcap_params *audio_cap_dev;
|
||||
|
||||
#if defined DEBUG && defined HAVE_LINUX
|
||||
mtrace();
|
||||
@@ -1347,7 +1346,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Pass embedded/analog/AESEBU flags to selected vidcap
|
||||
* device. */
|
||||
struct vidcap_params *audio_cap_dev = vidcap_params_get_nth(
|
||||
audio_cap_dev = vidcap_params_get_nth(
|
||||
vidcap_params_head,
|
||||
audio_capture_get_vidcap_index(audio_send));
|
||||
if (audio_cap_dev != NULL) {
|
||||
@@ -51,6 +51,10 @@
|
||||
* $Date: 2009/12/11 15:29:39 $
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* A participant database entry. This holds (pointers to) all the
|
||||
@@ -100,3 +104,7 @@ struct pdb_e *pdb_iter_init(struct pdb *db, pdb_iter_t *it);
|
||||
struct pdb_e *pdb_iter_next(pdb_iter_t *it);
|
||||
void pdb_iter_done(pdb_iter_t *it);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -68,6 +68,10 @@
|
||||
#include "audio/audio.h"
|
||||
#include "utils/list.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* The coded representation of a single frame */
|
||||
struct coded_data {
|
||||
struct coded_data *nxt;
|
||||
@@ -116,4 +120,7 @@ void pbuf_remove(struct pbuf *playout_buf, struct timeval curr_time);
|
||||
void pbuf_set_playout_delay(struct pbuf *playout_buf, double playout_delay,
|
||||
double deletion_delay);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -46,6 +46,10 @@
|
||||
#include "config_win32.h"
|
||||
#endif // HAVE_CONFIG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define RTP_VERSION 2
|
||||
#define RTP_PACKET_HEADER_SIZE ((sizeof(char *) * 2) + sizeof(uint32_t *) + (2 * sizeof(int)))
|
||||
#define RTP_MAX_PACKET_LEN 9000
|
||||
@@ -286,4 +290,9 @@ void rtp_flush_recv_buf(struct rtp *session);
|
||||
int rtp_change_dest(struct rtp *session, const char *addr);
|
||||
uint64_t rtp_get_bytes_sent(struct rtp *session);
|
||||
int rtp_compute_fract_lost(struct rtp *session, uint32_t ssrc);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __RTP_H__ */
|
||||
|
||||
@@ -40,6 +40,10 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** @page av_pkt_description UltraGrid packet format
|
||||
* Packet formats are described in papers referenced here:<br/>
|
||||
* https://www.sitola.cz/igrid/index.php/Developer_Documentation#Packet_formats
|
||||
@@ -143,3 +147,7 @@ int check_for_frame_completion(struct rtp *);
|
||||
void process_packet_for_display(char *);
|
||||
void call_display_frame(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -66,6 +66,10 @@
|
||||
|
||||
#include "video.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct tx;
|
||||
struct rtp;
|
||||
struct display;
|
||||
@@ -128,5 +132,9 @@ struct h264_rtp_state {
|
||||
bool sender_init(struct sender_data *data);
|
||||
void sender_done(struct sender_data *data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // SENDER_H_
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ struct stats {
|
||||
platform_spin_t m_spin;
|
||||
};
|
||||
|
||||
struct stats *stats_new_statistics(struct control_state *control, char * name)
|
||||
struct stats *stats_new_statistics(struct control_state *control, const char * name)
|
||||
{
|
||||
return new stats(string(name), control);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ extern "C" {
|
||||
struct control_state;
|
||||
struct stats;
|
||||
|
||||
struct stats *stats_new_statistics(struct control_state *control, char * name);
|
||||
struct stats *stats_new_statistics(struct control_state *control, const char * name);
|
||||
void stats_update_int(struct stats *, int64_t);
|
||||
void stats_format(struct stats *s, char *buffer, int buffer_len);
|
||||
void stats_destroy(struct stats *);
|
||||
|
||||
@@ -43,6 +43,10 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct tfrc;
|
||||
|
||||
struct tfrc *tfrc_init(struct timeval curr_time);
|
||||
@@ -53,3 +57,7 @@ void tfrc_recv_rtt (struct tfrc *state, struct timeval curr_time,
|
||||
double tfrc_feedback_txrate(struct tfrc *state, struct timeval curr_time);
|
||||
int tfrc_feedback_is_due(struct tfrc *state, struct timeval curr_time);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -60,6 +60,10 @@
|
||||
#include "audio/audio.h"
|
||||
#include "types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct module;
|
||||
struct rtp;
|
||||
struct tx;
|
||||
@@ -78,5 +82,9 @@ struct tx *tx_init_h264(struct module *parent, unsigned mtu, enum tx_media_type
|
||||
|
||||
void tx_send_h264(struct tx *tx_session, struct video_frame *frame, struct rtp *rtp_session);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // TRANSMIT_H_
|
||||
|
||||
|
||||
@@ -38,7 +38,15 @@
|
||||
#ifndef UTILS_MISC_H_
|
||||
#define UTILS_MISC_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int64_t unit_evaluate(const char *str);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif// UTILS_MISC_H_
|
||||
|
||||
|
||||
Reference in New Issue
Block a user