initial commit

This commit is contained in:
2024-12-15 00:34:01 +06:00
commit 31efbc726f
1576 changed files with 657692 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
#ifndef _G711_CODEC_H
#define _G711_CODEC_H
#include "basic_types.h"
typedef enum {
I2S_MODE_UNKNOWN = -1,
I2S_MODE_G711A = 1,
I2S_MODE_G711U = 2
}I2S_mode;
typedef struct {
I2S_mode mode; //intend to encode as G711A or G711U
int len; //data length
// _sema RWSema;
unsigned char *raw_data; //address of buffered data (not encoded
int data_start; // a shift value to show where the data starts
int data_end; // a shift value shows data ending
}i2s_buf_context;
//void encoder_init(int mode);
int G711_encoder(short *source, unsigned char *des, int mode, int size);
int G711_decoder(unsigned char *source, short *des, int mode, int size);
int mono2stereo(unsigned char *src, unsigned char *dst, int size, int wl);
#endif

View File

@@ -0,0 +1,30 @@
#ifndef __MINIMP3_DEC_H_INCLUDED__
#define __MINIMP3_DEC_H_INCLUDED__
#define MP3_MAX_SAMPLES_PER_FRAME (1152*2)
#include <stdio.h>
#include <stdint.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#ifndef M_PI
#define M_PI (3.14159265358979323846)
#endif
typedef struct _mp3_info {
int sample_rate;
int channels;
int audio_bytes; // generated amount of audio per frame
} mp3_info_t;
typedef void* mp3_decoder_t;
extern mp3_decoder_t mp3_create(void);
extern int mp3_decode(mp3_decoder_t *dec, void *buf, int bytes, signed short *out, mp3_info_t *info);
extern void mp3_done(mp3_decoder_t *dec);
#define mp3_free(dec) do { mp3_done(dec); dec = NULL; } while(0)
#endif//__MINIMP3_DEC_H_INCLUDED__