Macros | Functions | Variables
linuxrec.cpp File Reference
#include "linuxrec.h"
#include <alsa/asoundlib.h>
#include <fcntl.h>
#include <file_operation.h>
#include <pthread.h>
#include <signal.h>
#include <sys/stat.h>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <fstream>
#include "common_config.h"
#include "formats.h"
Include dependency graph for linuxrec.cpp:

Go to the source code of this file.

Macros

#define dbg   printf
 
#define DBG_ON   1
 
#define DEF_BUFF_TIME   500000
 
#define DEF_PERIOD_TIME   100000
 
#define FRAME_CNT   10
 
#define SAMPLE_BIT_SIZE   16
 
#define SAMPLE_RATE   16000
 

Functions

void closeRecorder (struct recorder *rec)
 
static void closeRecorderInternal (struct recorder *rec)
 
int createRecorder (struct recorder **out_rec, void(*on_data_ind)(char *data, unsigned long len, void *user_cb_para), void *user_cb_para)
 
static int createRecordThread (void *para, pthread_t *tidp, std::string base_path)
 
void destroyRecorder (struct recorder *rec)
 
static int format_ms_to_alsa (const WAVEFORMATEX *wavfmt, snd_pcm_format_t *format)
 
static void free_rec_buffer (struct recorder *rec)
 
record_dev_id getDefaultInputDevice ()
 
int getInputDeviceNum ()
 
static int getPcmDeviceCount (snd_pcm_stream_t stream)
 
int isRecordStopped (struct recorder *rec)
 
static int isStoppedInternal (struct recorder *rec)
 
record_dev_idlistInputDevice ()
 
int openRecorder (struct recorder *rec, record_dev_id dev, WAVEFORMATEX *fmt, std::string base_path)
 
static int openRecorderInternal (struct recorder *rec, record_dev_id dev, WAVEFORMATEX *fmt, std::string base_path)
 
static ssize_t pcm_read (struct recorder *rec, size_t rcount)
 
static int prepareRecBuffer (struct recorder *rec)
 
static void * recordThreadProc (void *para)
 
static int set_hwparams (struct recorder *rec, const WAVEFORMATEX *wavfmt, unsigned int buffertime, unsigned int periodtime)
 
static int set_params (struct recorder *rec, WAVEFORMATEX *fmt, unsigned int buffertime, unsigned int periodtime)
 
static int set_swparams (struct recorder *rec)
 
int startRecord (struct recorder *rec)
 
static int startRecordInternal (snd_pcm_t *pcm)
 
int stopRecord (struct recorder *rec)
 
static int stopRecordInternal (snd_pcm_t *pcm)
 
static int xrun_recovery (snd_pcm_t *handle, int err)
 

Variables

static int g_show_xrun = 1
 

Macro Definition Documentation

#define dbg   printf

Definition at line 17 of file linuxrec.cpp.

#define DBG_ON   1

Definition at line 15 of file linuxrec.cpp.

#define DEF_BUFF_TIME   500000

Definition at line 32 of file linuxrec.cpp.

#define DEF_PERIOD_TIME   100000

Definition at line 34 of file linuxrec.cpp.

#define FRAME_CNT   10

Definition at line 28 of file linuxrec.cpp.

#define SAMPLE_BIT_SIZE   16

Definition at line 26 of file linuxrec.cpp.

#define SAMPLE_RATE   16000

Definition at line 24 of file linuxrec.cpp.

Function Documentation

void closeRecorder ( struct recorder rec)

Definition at line 738 of file linuxrec.cpp.

static void closeRecorderInternal ( struct recorder rec)
static

Definition at line 621 of file linuxrec.cpp.

int createRecorder ( struct recorder **  out_rec,
void(*)(char *data, unsigned long len, void *user_cb_para)  on_data_ind,
void *  user_cb_para 
)

Definition at line 699 of file linuxrec.cpp.

static int createRecordThread ( void *  para,
pthread_t *  tidp,
std::string  base_path 
)
static

Definition at line 556 of file linuxrec.cpp.

void destroyRecorder ( struct recorder rec)

Definition at line 717 of file linuxrec.cpp.

static int format_ms_to_alsa ( const WAVEFORMATEX wavfmt,
snd_pcm_format_t *  format 
)
static

Definition at line 69 of file linuxrec.cpp.

static void free_rec_buffer ( struct recorder rec)
static

Definition at line 568 of file linuxrec.cpp.

record_dev_id getDefaultInputDevice ( )

Definition at line 680 of file linuxrec.cpp.

int getInputDeviceNum ( )

Definition at line 693 of file linuxrec.cpp.

static int getPcmDeviceCount ( snd_pcm_stream_t  stream)
static

Definition at line 643 of file linuxrec.cpp.

int isRecordStopped ( struct recorder rec)

Definition at line 786 of file linuxrec.cpp.

static int isStoppedInternal ( struct recorder rec)
static

Definition at line 235 of file linuxrec.cpp.

record_dev_id* listInputDevice ( )

Definition at line 687 of file linuxrec.cpp.

int openRecorder ( struct recorder rec,
record_dev_id  dev,
WAVEFORMATEX fmt,
std::string  base_path 
)

Definition at line 724 of file linuxrec.cpp.

static int openRecorderInternal ( struct recorder rec,
record_dev_id  dev,
WAVEFORMATEX fmt,
std::string  base_path 
)
static

Definition at line 589 of file linuxrec.cpp.

static ssize_t pcm_read ( struct recorder rec,
size_t  rcount 
)
static

Definition at line 480 of file linuxrec.cpp.

static int prepareRecBuffer ( struct recorder rec)
static

Definition at line 577 of file linuxrec.cpp.

static void* recordThreadProc ( void *  para)
static

Definition at line 517 of file linuxrec.cpp.

static int set_hwparams ( struct recorder rec,
const WAVEFORMATEX wavfmt,
unsigned int  buffertime,
unsigned int  periodtime 
)
static

Definition at line 251 of file linuxrec.cpp.

static int set_params ( struct recorder rec,
WAVEFORMATEX fmt,
unsigned int  buffertime,
unsigned int  periodtime 
)
static

Definition at line 413 of file linuxrec.cpp.

static int set_swparams ( struct recorder rec)
static

Definition at line 371 of file linuxrec.cpp.

int startRecord ( struct recorder rec)

Definition at line 749 of file linuxrec.cpp.

static int startRecordInternal ( snd_pcm_t *  pcm)
static

Definition at line 225 of file linuxrec.cpp.

int stopRecord ( struct recorder rec)

Definition at line 766 of file linuxrec.cpp.

static int stopRecordInternal ( snd_pcm_t *  pcm)
static

Definition at line 230 of file linuxrec.cpp.

static int xrun_recovery ( snd_pcm_t *  handle,
int  err 
)
static

Definition at line 442 of file linuxrec.cpp.

Variable Documentation

int g_show_xrun = 1
static

Definition at line 224 of file linuxrec.cpp.



xbot_talker
Author(s): wangxiaoyun
autogenerated on Sat Oct 10 2020 03:27:54