Fork me on GitHub
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 
31 
33 typedef enum janus_recorder_medium {
38 
40 typedef struct janus_recorder {
42  char *dir;
44  char *filename;
46  FILE *file;
48  char *codec;
50  char *fmtp;
52  gint64 created, started;
56  volatile int header;
58  volatile int writable;
62  volatile gint destroyed;
66 
70 void janus_recorder_init(gboolean tempnames, const char *extension);
72 void janus_recorder_deinit(void);
73 
81 janus_recorder *janus_recorder_create(const char *dir, const char *codec, const char *filename);
90 janus_recorder *janus_recorder_create_full(const char *dir, const char *codec, const char *fmtp, const char *filename);
96 int janus_recorder_save_frame(janus_recorder *recorder, char *buffer, uint length);
100 int janus_recorder_close(janus_recorder *recorder);
103 void janus_recorder_destroy(janus_recorder *recorder);
104 
105 #endif
Reference counter mechanism.
char * codec
Codec the packets to record are encoded in ("vp8", "vp9", "h264", "opus", "pcma", "pcmu"...
Definition: record.h:48
gint64 created
When the recording file has been created and started.
Definition: record.h:52
Definition: record.h:36
janus_mutex mutex
Mutex to lock/unlock this recorder instance.
Definition: record.h:60
GMutex janus_mutex
Janus mutex implementation.
Definition: mutex.h:61
int janus_recorder_save_frame(janus_recorder *recorder, char *buffer, uint length)
Save an RTP frame in the recorder.
Definition: record.c:255
char * dir
Absolute path to the directory where the recorder file is stored.
Definition: record.h:42
Definition: refcount.h:78
volatile int writable
Whether this recorder instance can be used for writing or not.
Definition: record.h:58
Definition: record.h:35
char * fmtp
Codec-specific info (e.g., H.264 or VP9 profile)
Definition: record.h:50
Definition: record.h:34
volatile int header
Whether the info header for this recorder instance has already been written or not.
Definition: record.h:56
void janus_recorder_deinit(void)
De-initialize the recorder code.
Definition: record.c:60
janus_recorder * janus_recorder_create(const char *dir, const char *codec, const char *filename)
Create a new recorder.
Definition: record.c:83
FILE * file
Recording file.
Definition: record.h:46
janus_recorder_medium type
Media this instance is recording.
Definition: record.h:54
int janus_recorder_close(janus_recorder *recorder)
Close the recorder.
Definition: record.c:351
Structure that represents a recorder.
Definition: record.h:40
void janus_recorder_init(gboolean tempnames, const char *extension)
Initialize the recorder code.
Definition: record.c:46
struct janus_recorder janus_recorder
Structure that represents a recorder.
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
Semaphors, Mutexes and Conditions.
janus_refcount ref
Reference counter for this instance.
Definition: record.h:64
gint64 started
Definition: record.h:52
char * filename
Filename of this recorder file.
Definition: record.h:44
void janus_recorder_destroy(janus_recorder *recorder)
Destroy the recorder instance.
Definition: record.c:389
janus_recorder_medium
Media types we can record.
Definition: record.h:33
volatile gint destroyed
Atomic flag to check if this instance has been destroyed.
Definition: record.h:62