Fork me on GitHub
Loading...
Searching...
No Matches
record.h
Go to the documentation of this file.
1
20#ifndef JANUS_RECORD_H
21#define JANUS_RECORD_H
22
23#include <inttypes.h>
24#include <string.h>
25#include <stdio.h>
26#include <stdlib.h>
27
28#include "mutex.h"
29#include "refcount.h"
30#include "rtp.h"
31
32
39
41typedef struct janus_recorder {
43 char *dir;
45 char *filename;
47 FILE *file;
49 char *codec;
51 char *fmtp;
55 GHashTable *extensions;
63 gboolean encrypted;
65 volatile int header;
67 volatile int writable;
69 volatile int paused;
75 volatile gint destroyed;
79
83void janus_recorder_init(gboolean tempnames, const char *extension);
85void janus_recorder_deinit(void);
86
94janus_recorder *janus_recorder_create(const char *dir, const char *codec, const char *filename);
103janus_recorder *janus_recorder_create_full(const char *dir, const char *codec, const char *fmtp, const char *filename);
121int janus_recorder_add_extmap(janus_recorder *recorder, int id, const char *extmap);
126int janus_recorder_description(janus_recorder *recorder, const char *description);
133int janus_recorder_opusred(janus_recorder *recorder, int red_pt);
147int janus_recorder_save_frame(janus_recorder *recorder, char *buffer, uint length);
155
156#endif
Semaphors, Mutexes and Conditions.
GMutex janus_mutex
Janus mutex implementation.
Definition: mutex.h:73
int janus_recorder_resume(janus_recorder *recorder)
Resume recording packets.
Definition: record.c:266
int janus_recorder_add_extmap(janus_recorder *recorder, int id, const char *extmap)
Add an RTP extension to this recording.
Definition: record.c:283
void janus_recorder_deinit(void)
De-initialize the recorder code.
Definition: record.c:57
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:87
int janus_recorder_encrypted(janus_recorder *recorder)
Mark this recorder as end-to-end encrypted (e.g., via Insertable Streams)
Definition: record.c:319
int janus_recorder_pause(janus_recorder *recorder)
Pause recording packets.
Definition: record.c:258
int janus_recorder_close(janus_recorder *recorder)
Close the recorder.
Definition: record.c:484
int janus_recorder_opusred(janus_recorder *recorder, int red_pt)
Mark this recording as using RED for audio.
Definition: record.c:309
janus_recorder_medium
Media types we can record.
Definition: record.h:34
@ JANUS_RECORDER_VIDEO
Definition: record.h:36
@ JANUS_RECORDER_AUDIO
Definition: record.h:35
@ JANUS_RECORDER_DATA
Definition: record.h:37
int janus_recorder_save_frame(janus_recorder *recorder, char *buffer, uint length)
Save an RTP frame in the recorder.
Definition: record.c:329
int janus_recorder_description(janus_recorder *recorder, const char *description)
Set the description for this recording.
Definition: record.c:294
void janus_recorder_init(gboolean tempnames, const char *extension)
Initialize the recorder code.
Definition: record.c:43
janus_recorder * janus_recorder_create(const char *dir, const char *codec, const char *filename)
Create a new recorder.
Definition: record.c:83
void janus_recorder_destroy(janus_recorder *recorder)
Destroy the recorder instance.
Definition: record.c:522
Reference counter mechanism.
RTP processing (headers)
Structure that represents a recorder.
Definition: record.h:41
janus_rtp_switching_context context
RTP switching context for rewriting RTP headers.
Definition: record.h:71
volatile gint destroyed
Atomic flag to check if this instance has been destroyed.
Definition: record.h:75
char * filename
Filename of this recorder file.
Definition: record.h:45
char * dir
Absolute path to the directory where the recorder file is stored.
Definition: record.h:43
FILE * file
Recording file.
Definition: record.h:47
janus_mutex mutex
Mutex to lock/unlock this recorder instance.
Definition: record.h:73
volatile int paused
Whether writing s/RTP packets/data is paused.
Definition: record.h:69
janus_refcount ref
Reference counter for this instance.
Definition: record.h:77
char * codec
Codec the packets to record are encoded in ("vp8", "vp9", "h264", "opus", "pcma", "pcmu",...
Definition: record.h:49
gint64 started
Definition: record.h:57
gint64 created
When the recording file has been created and started.
Definition: record.h:57
gboolean encrypted
Whether the recording contains end-to-end encrypted media or not.
Definition: record.h:63
int opusred_pt
In case RED is used for Opus, its payload types.
Definition: record.h:61
char * description
Stream description.
Definition: record.h:53
GHashTable * extensions
List of RTP extensions (as a hashtable, indexed by ID) in this recording.
Definition: record.h:55
volatile int writable
Whether this recorder instance can be used for writing or not.
Definition: record.h:67
janus_recorder_medium type
Media this instance is recording.
Definition: record.h:59
char * fmtp
Codec-specific info (e.g., H.264 or VP9 profile)
Definition: record.h:51
volatile int header
Whether the info header for this recorder instance has already been written or not.
Definition: record.h:65
Definition: refcount.h:78
RTP context, in order to make sure SSRC changes result in coherent seq/ts increases.
Definition: rtp.h:295