mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -05:00
bluetooth: Add a generic GStreamer codec module
This adds a generic gstreamer codec module based on which other bluetooth codecs viz. aptX, aptX-HD, LDAC and AAC can be supported. The GStreamer codec plugins used here themselves depend on the native codec implementation. aptX/aptX-HD -> libopenaptx LDAC -> libldac AAC -> Fraunhofer FDK AAC Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/440>
This commit is contained in:
parent
3447335da9
commit
a407e9aafa
5 changed files with 828 additions and 1 deletions
60
src/modules/bluetooth/a2dp-codec-gst.h
Normal file
60
src/modules/bluetooth/a2dp-codec-gst.h
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
/***
|
||||
This file is part of PulseAudio.
|
||||
|
||||
Copyright (C) 2020 Asymptotic <sanchayan@asymptotic.io>
|
||||
|
||||
PulseAudio is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation; either version 2.1 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
PulseAudio 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 Lesser General Public
|
||||
License along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
|
||||
***/
|
||||
|
||||
#include <gst/gst.h>
|
||||
#include <gst/app/gstappsrc.h>
|
||||
#include <gst/app/gstappsink.h>
|
||||
#include <gst/base/gstadapter.h>
|
||||
#include <pulsecore/fdsem.h>
|
||||
|
||||
enum a2dp_codec_type {
|
||||
AAC = 0,
|
||||
APTX,
|
||||
APTX_HD,
|
||||
LDAC_EQMID_HQ,
|
||||
LDAC_EQMID_SQ,
|
||||
LDAC_EQMID_MQ
|
||||
};
|
||||
|
||||
struct gst_info {
|
||||
pa_sample_spec *ss;
|
||||
enum a2dp_codec_type codec_type;
|
||||
union {
|
||||
const a2dp_aac_t *aac_config;
|
||||
const a2dp_aptx_t *aptx_config;
|
||||
const a2dp_aptx_hd_t *aptx_hd_config;
|
||||
const a2dp_ldac_t *ldac_config;
|
||||
} a2dp_codec_t;
|
||||
|
||||
GstElement *gst_enc, *gst_dec;
|
||||
GstElement *enc_src, *enc_sink;
|
||||
GstElement *dec_src, *dec_sink;
|
||||
GstElement *enc_pipeline, *dec_pipeline;
|
||||
GstAdapter *enc_adapter, *dec_adapter;
|
||||
|
||||
pa_fdsem *enc_fdsem;
|
||||
pa_fdsem *dec_fdsem;
|
||||
|
||||
uint16_t seq_num;
|
||||
};
|
||||
|
||||
void *gst_codec_init(enum a2dp_codec_type codec_type, const uint8_t *config_buffer, uint8_t config_size, pa_sample_spec *ss);
|
||||
size_t gst_encode_buffer(void *codec_info, uint32_t timestamp, const uint8_t *input_buffer, size_t input_size, uint8_t *output_buffer, size_t output_size, size_t *processed);
|
||||
size_t gst_decode_buffer(void *codec_info, const uint8_t *input_buffer, size_t input_size, uint8_t *output_buffer, size_t output_size, size_t *processed);
|
||||
void gst_codec_deinit(void *codec_info);
|
||||
Loading…
Add table
Add a link
Reference in a new issue