mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-libstb-hal.git
synced 2025-08-26 15:02:43 +02:00
adding armbox
Origin commit data
------------------
Branch: master
Commit: d8c3c47b86
Author: TangoCash <eric@loxat.de>
Date: 2017-09-12 (Tue, 12 Sep 2017)
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
57
libarmbox/record_lib.h
Normal file
57
libarmbox/record_lib.h
Normal file
@@ -0,0 +1,57 @@
|
||||
#ifndef __RECORD_TD_H
|
||||
#define __RECORD_TD_H
|
||||
|
||||
#include <pthread.h>
|
||||
#include <semaphore.h>
|
||||
#include "dmx_lib.h"
|
||||
|
||||
#define REC_STATUS_OK 0
|
||||
#define REC_STATUS_SLOW 1
|
||||
#define REC_STATUS_OVERFLOW 2
|
||||
#define REC_STATUS_STOPPED 4
|
||||
|
||||
typedef enum {
|
||||
RECORD_RUNNING,
|
||||
RECORD_STOPPED,
|
||||
RECORD_FAILED_READ, /* failed to read from DMX */
|
||||
RECORD_FAILED_OVERFLOW, /* cannot write fast enough */
|
||||
RECORD_FAILED_FILE, /* cannot write to file */
|
||||
RECORD_FAILED_MEMORY /* out of memory */
|
||||
} record_state_t;
|
||||
|
||||
class cRecord
|
||||
{
|
||||
private:
|
||||
int file_fd;
|
||||
int dmx_num;
|
||||
cDemux *dmx;
|
||||
pthread_t record_thread;
|
||||
bool record_thread_running;
|
||||
record_state_t exit_flag;
|
||||
int state;
|
||||
int bufsize;
|
||||
int bufsize_dmx;
|
||||
void (*failureCallback)(void *);
|
||||
void *failureData;
|
||||
|
||||
sem_t sem;
|
||||
#define RECORD_WRITER_CHUNKS 16
|
||||
unsigned char *io_buf[RECORD_WRITER_CHUNKS];
|
||||
size_t io_len[RECORD_WRITER_CHUNKS];
|
||||
public:
|
||||
cRecord(int num = 0, int bs_dmx = 2048 * 1024, int bs = 4096 * 1024);
|
||||
void setFailureCallback(void (*f)(void *), void *d) { failureCallback = f; failureData = d; }
|
||||
~cRecord();
|
||||
|
||||
bool Open();
|
||||
bool Start(int fd, unsigned short vpid, unsigned short *apids, int numapids, uint64_t ch = 0);
|
||||
bool Stop(void);
|
||||
bool AddPid(unsigned short pid);
|
||||
int GetStatus();
|
||||
void ResetStatus();
|
||||
bool ChangePids(unsigned short vpid, unsigned short *apids, int numapids);
|
||||
|
||||
void RecordThread();
|
||||
void WriterThread();
|
||||
};
|
||||
#endif
|
Reference in New Issue
Block a user