⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 a2dpd_protocol.h

📁 linux蓝牙剖面实现
💻 H
字号:
/***  A2DPD - Bluetooth A2DP daemon for Linux**  Copyright (C) 2006  Frédéric DALLEAU <frederic.dalleau@palmsource.com>**  This program is free software; you can redistribute it and/or modify*  it under the terms of the GNU General Public License as published by*  the Free Software Foundation; either version 2 of the License, or*  (at your option) any later version.**  This program is distributed in the hope that it will be useful,*  but WITHOUT ANY WARRANTY; without even the implied warranty of*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the*  GNU General Public License for more details.**  You should have received a copy of the GNU General Public License*  along with this program; if not, write to the Free Software*  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.*/#ifndef __A2DPD_PROTOCOL_H__#define __A2DPD_PROTOCOL_H__#include <stdio.h>#include <stdint.h>#include <time.h>#include <unistd.h>#include <sys/time.h>#include <errno.h>#include <string.h>extern int g_bdebug;#ifdef S_SPLINT_S// Splint don't like the arg...  syntax#	define DBG printf #else#ifndef NDEBUG#	define DBG(fmt, arg...)\do {\	if(g_bdebug) {\		struct timeval dbg_time;\		char szTime [32]="";\		(void)gettimeofday(&dbg_time, 0);\		(void)snprintf(szTime, sizeof(szTime), "[%03d.%03d]", (int)(dbg_time.tv_sec%1000), (int)(dbg_time.tv_usec/1000));\		szTime[sizeof(szTime)-1] = '\0';\		if(errno!=0 && errno!=EAGAIN)\			(void)printf("A2DPD%s: %s: (errno=%d:%s)" fmt "\r\n" , szTime, __FUNCTION__ , errno, strerror(errno), ## arg);\		else\			(void)printf("A2DPD%s: %s: " fmt "\n", szTime, __FUNCTION__ , ## arg);\		fflush(stdout);\        }\        errno=0;\} while(0)#else#	define DBG(fmt, arg...) do { (void)0; } while(0)#endif#endif#define RETURNERROR(fmt, arg...) do { DBG(fmt, ## arg); return -1; } while (0)#define min(X, Y)  ((X) < (Y) ? (X) : (Y))#define max(X, Y)  ((X) > (Y) ? (X) : (Y))// parameters used to describe device statetypedef struct {	int16_t volume_speaker_right;	int16_t volume_speaker_left;	int16_t volume_micro_right;	int16_t volume_micro_left;} __attribute__ ((packed)) AUDIOMIXERDATA;#define INVALIDAUDIOMIXERDATA   { -1, -1, -1, -1 }#define A2DPMAXIMUMTRANSFERUNITSIZE 610// PCM formats defined in alsa, we will restrict our selves to 8 and 16 bits#define A2DPD_PCM_FORMAT_UNKNOWN 0x00000000#define A2DPD_PCM_FORMAT_S8      0x00000001#define A2DPD_PCM_FORMAT_U8      0x00000002#define A2DPD_PCM_FORMAT_S16_LE  0x00000003//#define A2DPD_FORMAT_S16_BE        0x00000004//#define A2DPD_FORMAT_U16_LE        0x00000005//#define A2DPD_FORMAT_U16_BE        0x00000006// parameters used to describe device statetypedef struct {	uint32_t format;	uint16_t rate;	uint8_t channels;	uint16_t bitspersample;	uint32_t streamid;} __attribute__ ((packed)) AUDIOSTREAMINFOS;typedef struct {	struct timeval packet_date;	int pcm_buffer_size;} __attribute__ ((packed)) AUDIOPACKETHEADER;#define INVALIDAUDIOSTREAMINFOS   { 0, 0, 0 }// Different types of client plugin for the daemon#define INVALID_CLIENT_TYPE     0xFFFFFFFF#define A2DPD_PLUGIN_CTL_WRITE  0x00000001#define A2DPD_PLUGIN_CTL_READ   0x00000002#define A2DPD_PLUGIN_PCM_WRITE  0x00000003#define A2DPD_PLUGIN_PCM_READ   0x00000004#define A2DPD_VOLUME_MIN        0#define A2DPD_VOLUME_MAX        16#define A2DPD_FRAME_BYTES       4	// 16bits * 2 channels#define A2DPD_FRAME_RATE        44100	// Can be 32000, tested with HP, iPhono and needed Sonorix, but quality decreases, 48000 nearly never works// a2dp->sbc.channels*44100*2/(size*a2dp->frame_bytes);// 344.53125=channels*freq*16 bits/sizeof(buf)#define A2DPD_BLOCK_SIZE        (512*1)#define PIDFILE                "/tmp/a2dp.pid"#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -