Loading...
Searching...
No Matches
record.h
Go to the documentation of this file.
#ifndef JANUS_RECORD_H
#define JANUS_RECORD_H
#include <inttypes.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "mutex.h"
#include "refcount.h"
#include "rtp.h"
typedef enum janus_recorder_medium {
JANUS_RECORDER_AUDIO,
JANUS_RECORDER_VIDEO,
JANUS_RECORDER_DATA
} janus_recorder_medium;
typedef struct janus_recorder {
char *dir;
char *filename;
FILE *file;
char *codec;
char *fmtp;
char *description;
GHashTable *extensions;
gint64 created, started;
janus_recorder_medium type;
int opusred_pt;
gboolean encrypted;
volatile int header;
volatile int writable;
volatile int paused;
janus_rtp_switching_context context;
janus_mutex mutex;
volatile gint destroyed;
janus_refcount ref;
} janus_recorder;
void janus_recorder_init(gboolean tempnames, const char *extension);
void janus_recorder_deinit(void);
janus_recorder *janus_recorder_create(const char *dir, const char *codec, const char *filename);
janus_recorder *janus_recorder_create_full(const char *dir, const char *codec, const char *fmtp, const char *filename);
int janus_recorder_pause(janus_recorder *recorder);
int janus_recorder_resume(janus_recorder *recorder);
int janus_recorder_add_extmap(janus_recorder *recorder, int id, const char *extmap);
int janus_recorder_description(janus_recorder *recorder, const char *description);
int janus_recorder_opusred(janus_recorder *recorder, int red_pt);
int janus_recorder_encrypted(janus_recorder *recorder);
int janus_recorder_save_frame(janus_recorder *recorder, char *buffer, uint length);
int janus_recorder_close(janus_recorder *recorder);
void janus_recorder_destroy(janus_recorder *recorder);
#endif
mutex.h
Semaphors, Mutexes and Conditions.
janus_mutex
GMutex janus_mutex
Janus mutex implementation.
Definition mutex.h:73
janus_recorder_resume
int janus_recorder_resume(janus_recorder *recorder)
Resume recording packets.
Definition record.c:269
janus_recorder_add_extmap
int janus_recorder_add_extmap(janus_recorder *recorder, int id, const char *extmap)
Add an RTP extension to this recording.
Definition record.c:286
janus_recorder_deinit
void janus_recorder_deinit(void)
De-initialize the recorder code.
Definition record.c:60
janus_recorder_create_full
janus_recorder * janus_recorder_create_full(const char *dir, const char *codec, const char *fmtp, const char *filename)
Create a new recorder with additional info.
Definition record.c:90
janus_recorder_encrypted
int janus_recorder_encrypted(janus_recorder *recorder)
Mark this recorder as end-to-end encrypted (e.g., via Insertable Streams).
Definition record.c:322
janus_recorder_pause
int janus_recorder_pause(janus_recorder *recorder)
Pause recording packets.
Definition record.c:261
janus_recorder_close
int janus_recorder_close(janus_recorder *recorder)
Close the recorder.
Definition record.c:487
janus_recorder_opusred
int janus_recorder_opusred(janus_recorder *recorder, int red_pt)
Mark this recording as using RED for audio.
Definition record.c:312
janus_recorder_medium
janus_recorder_medium
Media types we can record.
Definition record.h:34
JANUS_RECORDER_VIDEO
@ JANUS_RECORDER_VIDEO
Definition record.h:36
JANUS_RECORDER_AUDIO
@ JANUS_RECORDER_AUDIO
Definition record.h:35
JANUS_RECORDER_DATA
@ JANUS_RECORDER_DATA
Definition record.h:37
janus_recorder_save_frame
int janus_recorder_save_frame(janus_recorder *recorder, char *buffer, uint length)
Save an RTP frame in the recorder.
Definition record.c:332
janus_recorder_description
int janus_recorder_description(janus_recorder *recorder, const char *description)
Set the description for this recording.
Definition record.c:297
janus_recorder_init
void janus_recorder_init(gboolean tempnames, const char *extension)
Initialize the recorder code.
Definition record.c:46
janus_recorder_create
janus_recorder * janus_recorder_create(const char *dir, const char *codec, const char *filename)
Create a new recorder.
Definition record.c:86
janus_recorder_destroy
void janus_recorder_destroy(janus_recorder *recorder)
Destroy the recorder instance.
Definition record.c:525
refcount.h
Reference counter mechanism.
rtp.h
RTP processing (headers).
janus_recorder
Structure that represents a recorder.
Definition record.h:41
janus_recorder::context
janus_rtp_switching_context context
RTP switching context for rewriting RTP headers.
Definition record.h:71
janus_recorder::destroyed
volatile gint destroyed
Atomic flag to check if this instance has been destroyed.
Definition record.h:75
janus_recorder::filename
char * filename
Filename of this recorder file.
Definition record.h:45
janus_recorder::dir
char * dir
Absolute path to the directory where the recorder file is stored.
Definition record.h:43
janus_recorder::file
FILE * file
Recording file.
Definition record.h:47
janus_recorder::mutex
janus_mutex mutex
Mutex to lock/unlock this recorder instance.
Definition record.h:73
janus_recorder::paused
volatile int paused
Whether writing s/RTP packets/data is paused.
Definition record.h:69
janus_recorder::ref
janus_refcount ref
Reference counter for this instance.
Definition record.h:77
janus_recorder::codec
char * codec
Codec the packets to record are encoded in ("vp8", "vp9", "h264", "opus", "pcma", "pcmu",...
Definition record.h:49
janus_recorder::started
gint64 started
Definition record.h:57
janus_recorder::created
gint64 created
When the recording file has been created and started.
Definition record.h:57
janus_recorder::encrypted
gboolean encrypted
Whether the recording contains end-to-end encrypted media or not.
Definition record.h:63
janus_recorder::opusred_pt
int opusred_pt
In case RED is used for Opus, its payload types.
Definition record.h:61
janus_recorder::description
char * description
Stream description.
Definition record.h:53
janus_recorder::extensions
GHashTable * extensions
List of RTP extensions (as a hashtable, indexed by ID) in this recording.
Definition record.h:55
janus_recorder::writable
volatile int writable
Whether this recorder instance can be used for writing or not.
Definition record.h:67
janus_recorder::type
janus_recorder_medium type
Media this instance is recording.
Definition record.h:59
janus_recorder::fmtp
char * fmtp
Codec-specific info (e.g., H.264 or VP9 profile).
Definition record.h:51
janus_recorder::header
volatile int header
Whether the info header for this recorder instance has already been written or not.
Definition record.h:65
janus_refcount
Definition refcount.h:78
janus_rtp_switching_context
RTP context, in order to make sure SSRC changes result in coherent seq/ts increases.
Definition rtp.h:259