srs_tc_av_codec.hpp 1.0 KB
#ifndef TC_AV_CODEC_H
#define TC_AV_CODEC_H

#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define MAX_EXTRA 3

typedef void* handle_t;

typedef struct {
    int sample_rate;
    int channels;
    int frame_size;
    int buffer_size;
    int audio_profile;
    int audio_bitrate;

    handle_t handle;
    
    uint32_t extradata_size;
    uint8_t* extradata;
    
}tc_audio_opt;

typedef struct {
    int codec_id;
    
    const char* codec_name;
    
    int (*open_codec)(tc_audio_opt* opt);
    
    int (*decode_frame)(tc_audio_opt* opt, uint8_t* inData, uint32_t inDataSize, uint8_t* outData);
    //inoutTimeStamp is in ms
    int (*encode_frame)(tc_audio_opt* opt, uint8_t* inData, uint8_t* inoutData, uint32_t* inoutDataSize, int64_t * inoutTimeStamp);
    
    int (*close_codec)(tc_audio_opt* opt);
    
}tc_av_codec_t;


extern const tc_av_codec_t adc_aac;
extern const tc_av_codec_t aec_aac;

extern const tc_av_codec_t adc_spx;

#define freep(x) if(x){ free(x); x = NULL;}
#endif /* tc_av_codec_h */