📄 mymad.h
字号:
#ifndef _HW4_MYMAD_H#define _HW4_MYMAD_H#include "myalsa.h"#include "error.h"#define MAD_BUF_SIZE (1152*4) struct buffer{ void * buf; /* buf for data to play */ int sockfd; /* socket descriptor */ ssize_t length; /* length of the current stream */ int finished; /* flag to identify whether finish playing a mp3 file */};//int decode(unsigned char const *, unsigned long);enum mad_flow /* input callback function, fetch data from the socket descriptor */input(void *data, struct mad_stream *stream);inline signed int /* scale the samples to 16 bits, this function is obtained from minimad.c */scale(mad_fixed_t sample);enum mad_flow /* output callback function, form PCM data and call alsa_play */output(void *data, struct mad_header const *header, struct mad_pcm *pcm);enum mad_flow /* error callback function */error(void *data, struct mad_stream *stream, struct mad_frame *frame);int /* this function will be called from main */mad(int sockfd); /* a function tackle mp3 files with libmad */#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -