Fork me on GitHub
record.h
Go to the documentation of this file.
1 
19 #ifndef _JANUS_RECORD_H
20 #define _JANUS_RECORD_H
21 
22 #include <inttypes.h>
23 #include <string.h>
24 #include <stdio.h>
25 #include <stdlib.h>
26 
27 #include "mutex.h"
28 #include "refcount.h"
29 
30 
32 typedef enum janus_recorder_medium {
37 
39 typedef struct janus_recorder {
41  char *dir;
43  char *filename;
45  FILE *file;
47  char *codec;
49  gint64 created;
53  volatile int header;
55  volatile int writable;
59  volatile gint destroyed;
63 
67 void janus_recorder_init(gboolean tempnames, const char *extension);
69 void janus_recorder_deinit(void);
70 
78 janus_recorder *janus_recorder_create(const char *dir, const char *codec, const char *filename);
84 int janus_recorder_save_frame(janus_recorder *recorder, char *buffer, uint length);
92 
93 #endif
Reference counter mechanism.
char * codec
Codec the packets to record are encoded in ("vp8", "vp9", "h264", "opus", "pcma", "pcmu"...
Definition: record.h:47
gint64 created
When the recording file has been created.
Definition: record.h:49
Definition: record.h:35
janus_mutex mutex
Mutex to lock/unlock this recorder instance.
Definition: record.h:57
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:210
char * dir
Absolute path to the directory where the recorder file is stored.
Definition: record.h:41
Definition: refcount.h:78
volatile int writable
Whether this recorder instance can be used for writing or not.
Definition: record.h:55
Definition: record.h:34
Definition: record.h:33
volatile int header
Whether the info header for this recorder instance has already been written or not.
Definition: record.h:53
void janus_recorder_deinit(void)
De-initialize the recorder code.
Definition: record.c:59
janus_recorder * janus_recorder_create(const char *dir, const char *codec, const char *filename)
Create a new recorder.
Definition: record.c:79
FILE * file
Recording file.
Definition: record.h:45
janus_recorder_medium type
Media this instance is recording.
Definition: record.h:51
int janus_recorder_close(janus_recorder *recorder)
Close the recorder.
Definition: record.c:275
Structure that represents a recorder.
Definition: record.h:39
void janus_recorder_init(gboolean tempnames, const char *extension)
Initialize the recorder code.
Definition: record.c:45
struct janus_recorder janus_recorder
Structure that represents a recorder.
Semaphors, Mutexes and Conditions.
janus_refcount ref
Reference counter for this instance.
Definition: record.h:61
char * filename
Filename of this recorder file.
Definition: record.h:43
void janus_recorder_destroy(janus_recorder *recorder)
Destroy the recorder instance.
Definition: record.c:313
janus_recorder_medium
Media types we can record.
Definition: record.h:32
volatile gint destroyed
Atomic flag to check if this instance has been destroyed.
Definition: record.h:59