MediaProcessors
Classes | Macros | Typedefs | Functions | Variables
codecs_muxers_loopback.c File Reference

Complete encoding->multiplexing->demultiplexing->decoding->rendering loopback example. More...

#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#include <math.h>
#include <mongoose.h>
#include <libcjson/cJSON.h>
#include <SDL2/SDL.h>
#include <libavcodec/avcodec.h>
#include <libavutil/opt.h>
#include <libavutil/imgutils.h>
#include <libmediaprocsutils/log.h>
#include <libmediaprocsutils/check_utils.h>
#include <libmediaprocsutils/stat_codes.h>
#include <libmediaprocsutils/fifo.h>
#include <libmediaprocsutils/schedule.h>
#include <libmediaprocs/proc_if.h>
#include <libmediaprocs/procs.h>
#include <libmediaprocs/procs_api_http.h>
#include <libmediaprocs/proc.h>
#include <libmediaprocsmuxers/live555_rtsp.h>
#include <libmediaprocscodecs/ffmpeg_x264.h>
#include <libmediaprocscodecs/ffmpeg_m2v.h>
#include <libmediaprocscodecs/ffmpeg_mp3.h>
#include <libmediaprocscodecs/ffmpeg_lhe.h>
Include dependency graph for codecs_muxers_loopback.c:

Go to the source code of this file.

Classes

struct  thr_ctx_s
 

Macros

#define LISTENING_PORT   "8088"
 
#define LISTENING_HOST   "127.0.0.1"
 
#define VIDEO_WIDTH   "352"
 
#define VIDEO_HEIGHT   "288"
 
#define REFRESH_EVENT   (SDL_USEREVENT + 1)
 
#define BREAK_EVENT   (SDL_USEREVENT + 2)
 
#define URI_MAX   4096
 
#define METH_MAX   16
 
#define BODY_MAX   4096000
 
#define MPEG2_VIDEO
 

Typedefs

typedef struct thr_ctx_s thr_ctx_t
 

Functions

static void prepare_and_send_raw_video_data (procs_ctx_t *procs_ctx, int enc_proc_id, volatile int *ref_flag_exit)
 
static void * producer_thr_video (void *t)
 
static void * mux_thr (void *t)
 
static void * dmux_thr (void *t)
 
static void * consumer_thr_video (void *t)
 
static void http_event_handler (struct mg_connection *c, int ev, void *p)
 
static void * http_server_thr (void *t)
 
static void stream_proc_quit_signal_handler ()
 
static void procs_post (procs_ctx_t *procs_ctx, const char *proc_name, const char *proc_settings, int *ref_proc_id)
 
int main (int argc, char *argv[])
 

Variables

static volatile int flag_app_exit = 0
 

Detailed Description

Complete encoding->multiplexing->demultiplexing->decoding->rendering loopback example.

Author
Rafael Antoniello

Definition in file codecs_muxers_loopback.c.

Typedef Documentation

typedef struct thr_ctx_s thr_ctx_t

Common data passed to all the threads launched by this application. To simplify, we put all the necessary data together in the same type of structure.

Function Documentation

static void* dmux_thr ( void *  t)
static

De-multiplexer thread.

Definition at line 233 of file codecs_muxers_loopback.c.

static void* http_server_thr ( void *  t)
static

Runs HTTP server thread, listening to the given port.

Definition at line 566 of file codecs_muxers_loopback.c.

static void* mux_thr ( void *  t)
static

Multiplexer thread.

Definition at line 179 of file codecs_muxers_loopback.c.

static void procs_post ( procs_ctx_t procs_ctx,
const char *  proc_name,
const char *  proc_settings,
int *  ref_proc_id 
)
static

Register (open) a processor instance: 1.- Register processor with given initial settings if desired, 2.- Parse JSON-REST response to get processor Id.

Definition at line 613 of file codecs_muxers_loopback.c.

static void* producer_thr_video ( void *  t)
static

Raw data producer and encoding thread.

Definition at line 157 of file codecs_muxers_loopback.c.