• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* GStreamer openaptx audio plugin
2  *
3  * Copyright (C) 2020 Igor V. Kovalenko <igor.v.kovalenko@gmail.com>
4  * Copyright (C) 2020 Thomas Weißschuh <thomas@t-8ch.de>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the
18  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  */
21 #ifndef __GST_OPENAPTX_PLUGIN_H__
22 #define __GST_OPENAPTX_PLUGIN_H__
23 
24 #include <glib.h>
25 
26 #define APTX_HD_DEFAULT 1
27 #define APTX_AUTOSYNC_DEFAULT TRUE
28 
29 #define APTX_LATENCY_SAMPLES 90
30 
31 /* always stereo */
32 #define APTX_NUM_CHANNELS 2
33 
34 /* always S24LE */
35 #define APTX_SAMPLE_SIZE 3
36 
37 /* always 4 samples per channel*/
38 #define APTX_SAMPLES_PER_CHANNEL 4
39 
40 /* always 4 stereo samples */
41 #define APTX_SAMPLES_PER_FRAME (APTX_SAMPLES_PER_CHANNEL * APTX_NUM_CHANNELS)
42 
43 /* fixed encoded frame size hd=0: LLRR, hd=1: LLLRRR */
44 #define APTX_FRAME_SIZE    (2 * APTX_NUM_CHANNELS)
45 #define APTX_HD_FRAME_SIZE (3 * APTX_NUM_CHANNELS)
46 
47 /* while finishing encoding, up to 92 frames will be produced */
48 #define APTX_FINISH_FRAMES 92
49 
aptx_name(gboolean hd)50 static inline const char* aptx_name(gboolean hd)
51 {
52     return hd ? "aptX-HD" : "aptX";
53 }
54 
55 /* fixed encoded frame size hd=FALSE: LLRR, hd=TRUE: LLLRRR */
aptx_frame_size(gboolean hd)56 static inline gsize aptx_frame_size(gboolean hd)
57 {
58   return hd ? APTX_HD_FRAME_SIZE : APTX_FRAME_SIZE;
59 }
60 
61 #endif /* __GST_OPENAPTX_PLUGIN_H__ */
62