module-rtp: add opus encoding

This commit is contained in:
Wim Taymans 2023-03-10 17:39:51 +01:00
parent bcc052f5f1
commit 345582dd15
10 changed files with 452 additions and 4 deletions

View file

@ -28,6 +28,7 @@ extern "C" {
#include <spa/param/audio/alac.h>
#include <spa/param/audio/flac.h>
#include <spa/param/audio/ape.h>
#include <spa/param/audio/opus.h>
struct spa_audio_info {
uint32_t media_type;
@ -46,6 +47,7 @@ struct spa_audio_info {
struct spa_audio_info_alac alac;
struct spa_audio_info_flac flac;
struct spa_audio_info_ape ape;
struct spa_audio_info_ape opus;
} info;
};

View file

@ -0,0 +1,29 @@
/* Simple Plugin API */
/* SPDX-FileCopyrightText: Copyright © 2023 Wim Taymans */
/* SPDX-License-Identifier: MIT */
#ifndef SPA_AUDIO_OPUS_H
#define SPA_AUDIO_OPUS_H
#ifdef __cplusplus
extern "C" {
#endif
#include <spa/param/audio/raw.h>
struct spa_audio_info_opus {
uint32_t rate; /*< sample rate */
uint32_t channels; /*< number of channels */
};
#define SPA_AUDIO_INFO_OPUS_INIT(...) ((struct spa_audio_info_opus) { __VA_ARGS__ })
/**
* \}
*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* SPA_AUDIO_OPUS_H */

View file

@ -63,6 +63,7 @@ static const struct spa_type_info spa_type_media_subtype[] = {
{ SPA_MEDIA_SUBTYPE_alac, SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_SUBTYPE_BASE "alac", NULL },
{ SPA_MEDIA_SUBTYPE_flac, SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_SUBTYPE_BASE "flac", NULL },
{ SPA_MEDIA_SUBTYPE_ape, SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_SUBTYPE_BASE "ape", NULL },
{ SPA_MEDIA_SUBTYPE_opus, SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_SUBTYPE_BASE "opus", NULL },
/* video subtypes */
{ SPA_MEDIA_SUBTYPE_h264, SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_SUBTYPE_BASE "h264", NULL },
{ SPA_MEDIA_SUBTYPE_mjpg, SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_SUBTYPE_BASE "mjpg", NULL },

View file

@ -51,6 +51,7 @@ enum spa_media_subtype {
SPA_MEDIA_SUBTYPE_alac, /** since 0.3.65 */
SPA_MEDIA_SUBTYPE_flac, /** since 0.3.65 */
SPA_MEDIA_SUBTYPE_ape, /** since 0.3.65 */
SPA_MEDIA_SUBTYPE_opus, /** since 0.3.68 */
SPA_MEDIA_SUBTYPE_START_Video = 0x20000,
SPA_MEDIA_SUBTYPE_h264,

View file

@ -74,7 +74,9 @@ if get_option('spa-plugins').allowed()
endif
endif
summary({'LC3plus': lc3plus_dep.found()}, bool_yn: true, section: 'Bluetooth audio codecs')
opus_dep = dependency('opus', required : get_option('bluez5-codec-opus'))
if get_option('bluez5-codec-opus').enabled() and not opus_dep.found()
error('bluez5-codec-opus enabled, but opus dependency not found')
endif
summary({'Opus': opus_dep.found()}, bool_yn: true, section: 'Bluetooth audio codecs')
lc3_dep = dependency('lc3', required : get_option('bluez5-codec-lc3'))
summary({'LC3': lc3_dep.found()}, bool_yn: true, section: 'Bluetooth audio codecs')