summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Fergeau <cfergeau@redhat.com>2011-04-01 17:47:36 +0200
committerChristophe Fergeau <cfergeau@redhat.com>2011-04-01 17:53:41 +0200
commitbb5573726d6ad24870cba850f28239d32162887c (patch)
tree24612dea8f85ba649347ed739de0aeaf5285ba27
parentc23141739309d8a59c467cc8bd0df027fa899a5b (diff)
add support for celt 0.11.1celt
This drops support for celt 0.5.1.1 though, and thus break backward compatibility since celt doesn't guarantee bitstream format compatibility between versions.
-rw-r--r--client/audio_channels.h2
-rw-r--r--client/playback_channel.cpp26
-rw-r--r--client/record_channel.cpp24
-rw-r--r--client/windows/Makefile.am4
-rw-r--r--client/x11/Makefile.am6
-rw-r--r--configure.ac10
-rw-r--r--server/Makefile.am4
-rw-r--r--server/snd_worker.c44
8 files changed, 61 insertions, 59 deletions
diff --git a/client/audio_channels.h b/client/audio_channels.h
index 695573ab..8feabb5e 100644
--- a/client/audio_channels.h
+++ b/client/audio_channels.h
@@ -18,7 +18,7 @@
#ifndef _H_AUDIO_CHANNELS
#define _H_AUDIO_CHANNELS
-#include <celt051/celt.h>
+#include <celt/celt.h>
#include "red_channel.h"
#include "debug.h"
diff --git a/client/playback_channel.cpp b/client/playback_channel.cpp
index 1e902a90..73a9c7d0 100644
--- a/client/playback_channel.cpp
+++ b/client/playback_channel.cpp
@@ -20,6 +20,8 @@
#include "audio_channels.h"
#include "audio_devices.h"
+#define FRAME_SIZE (256)
+
//#define WAVE_CAPTURE
#ifdef WAVE_CAPTURE
@@ -174,11 +176,11 @@ PlaybackChannel::~PlaybackChannel(void)
delete _wave_player;
if (_celt_decoder) {
- celt051_decoder_destroy(_celt_decoder);
+ celt_decoder_destroy(_celt_decoder);
}
if (_celt_mode) {
- celt051_mode_destroy(_celt_mode);
+ celt_mode_destroy(_celt_mode);
}
}
@@ -245,13 +247,13 @@ void PlaybackChannel::handle_start(RedPeer::InMessage* message)
#endif
if (!_wave_player) {
// for now support only one setting
- int celt_mode_err;
+ int celt_err;
if (start->format != SPICE_AUDIO_FMT_S16) {
THROW("unexpected format");
}
int bits_per_sample = 16;
- int frame_size = 256;
+ int frame_size = FRAME_SIZE;
_frame_bytes = frame_size * start->channels * bits_per_sample / 8;
try {
_wave_player = Platform::create_player(start->frequency, bits_per_sample,
@@ -263,13 +265,15 @@ void PlaybackChannel::handle_start(RedPeer::InMessage* message)
return;
}
- if (!(_celt_mode = celt051_mode_create(start->frequency, start->channels,
- frame_size, &celt_mode_err))) {
- THROW("create celt mode failed %d", celt_mode_err);
+ if (!(_celt_mode = celt_mode_create(start->frequency, frame_size,
+ &celt_err))) {
+ THROW("create celt mode failed %d", celt_err);
}
- if (!(_celt_decoder = celt051_decoder_create(_celt_mode))) {
- THROW("create celt decoder");
+ if (!(_celt_decoder = celt_decoder_create_custom(_celt_mode,
+ start->channels,
+ &celt_err))) {
+ THROW("create celt decoder %d", celt_err);
}
}
_playing = true;
@@ -317,9 +321,9 @@ void PlaybackChannel::handle_celt_data(RedPeer::InMessage* message)
SpiceMsgPlaybackPacket* packet = (SpiceMsgPlaybackPacket*)message->data();
uint8_t* data = packet->data;
uint32_t size = packet->data_size;
- celt_int16_t pcm[256 * 2];
+ celt_int16 pcm[FRAME_SIZE * 2];
- if (celt051_decode(_celt_decoder, data, size, pcm) != CELT_OK) {
+ if (celt_decode(_celt_decoder, data, size, pcm, FRAME_SIZE) != CELT_OK) {
THROW("celt decode failed");
}
#ifdef WAVE_CAPTURE
diff --git a/client/record_channel.cpp b/client/record_channel.cpp
index 084866cc..c2aaa172 100644
--- a/client/record_channel.cpp
+++ b/client/record_channel.cpp
@@ -101,10 +101,10 @@ RecordChannel::~RecordChannel(void)
delete _wave_recorder;
if (_celt_encoder) {
- celt051_encoder_destroy(_celt_encoder);
+ celt_encoder_destroy(_celt_encoder);
}
if (_celt_mode) {
- celt051_mode_destroy(_celt_mode);
+ celt_mode_destroy(_celt_mode);
}
}
@@ -159,15 +159,15 @@ void RecordChannel::handle_start(RedPeer::InMessage* message)
}
int frame_size = 256;
- int celt_mode_err;
+ int celt_err;
_frame_bytes = frame_size * bits_per_sample * start->channels / 8;
- if (!(_celt_mode = celt051_mode_create(start->frequency, start->channels, frame_size,
- &celt_mode_err))) {
- THROW("create celt mode failed %d", celt_mode_err);
+ if (!(_celt_mode = celt_mode_create(start->frequency, frame_size,
+ &celt_err))) {
+ THROW("create celt mode failed %d", celt_err);
}
- if (!(_celt_encoder = celt051_encoder_create(_celt_mode))) {
- THROW("create celt encoder failed");
+ if (!(_celt_encoder = celt_encoder_create_custom(_celt_mode, start->channels, &celt_err))) {
+ THROW("create celt encoder failed %d", celt_err);
}
send_start_mark();
@@ -184,9 +184,9 @@ void RecordChannel::handle_stop(RedPeer::InMessage* message)
}
ASSERT(_celt_mode && _celt_encoder);
_wave_recorder->stop();
- celt051_encoder_destroy(_celt_encoder);
+ celt_encoder_destroy(_celt_encoder);
_celt_encoder = NULL;
- celt051_mode_destroy(_celt_mode);
+ celt_mode_destroy(_celt_mode);
_celt_mode = NULL;
delete _wave_recorder;
_wave_recorder = NULL;
@@ -246,8 +246,8 @@ void RecordChannel::push_frame(uint8_t *frame)
int n;
if (_mode == SPICE_AUDIO_DATA_MODE_CELT_0_5_1) {
- n = celt051_encode(_celt_encoder, (celt_int16_t *)frame, NULL, celt_buf,
- CELT_COMPRESSED_FRAME_BYTES);
+ n = celt_encode(_celt_encoder, (celt_int16 *)frame, FRAME_SIZE,
+ celt_buf, CELT_COMPRESSED_FRAME_BYTES);
if (n < 0) {
THROW("celt encode failed");
}
diff --git a/client/windows/Makefile.am b/client/windows/Makefile.am
index 041f57bc..27e46b57 100644
--- a/client/windows/Makefile.am
+++ b/client/windows/Makefile.am
@@ -16,7 +16,7 @@ INCLUDES = \
$(PROTOCOL_CFLAGS) \
$(GL_CFLAGS) \
$(PIXMAN_CFLAGS) \
- $(CELT051_CFLAGS) \
+ $(CELT_CFLAGS) \
$(SSL_CFLAGS) \
$(CEGUI_CFLAGS) \
$(WARN_CFLAGS) \
@@ -181,7 +181,7 @@ spicec_SOURCES = \
spicec_LDFLAGS = \
$(SPICEC_STATIC_LINKAGE_BSTATIC) \
- $(CELT051_LIBS) \
+ $(CELT_LIBS) \
$(SSL_LIBS) \
$(CEGUI_LIBS) \
$(JPEG_LIBS) \
diff --git a/client/x11/Makefile.am b/client/x11/Makefile.am
index 7504833c..8ff8f398 100644
--- a/client/x11/Makefile.am
+++ b/client/x11/Makefile.am
@@ -19,13 +19,13 @@ INCLUDES = \
$(GL_CFLAGS) \
$(ALSA_CFLAGS) \
$(PIXMAN_CFLAGS) \
- $(CELT051_CFLAGS) \
+ $(CELT_CFLAGS) \
$(SSL_CFLAGS) \
$(XRANDR_CFLAGS) \
$(XFIXES_CFLAGS) \
$(MISC_X_CFLAGS) \
$(CEGUI_CFLAGS) \
- $(CEGUI06_CFLAGS) \
+ $(CEGUI06_CFLAGS) \
$(WARN_CFLAGS) \
$(SPICE_NONPKGCONFIG_CFLAGS) \
$(SMARTCARD_CFLAGS) \
@@ -204,7 +204,7 @@ spicec_SOURCES = \
spicec_LDFLAGS = \
$(SPICEC_STATIC_LINKAGE_BSTATIC) \
- $(CELT051_LIBS) \
+ $(CELT_LIBS) \
$(SSL_LIBS) \
$(CEGUI_LIBS) \
$(CEGUI06_LIBS) \
diff --git a/configure.ac b/configure.ac
index 5580a5d0..8621db2d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -203,11 +203,11 @@ AC_SUBST(PIXMAN_CFLAGS)
AC_SUBST(PIXMAN_LIBS)
SPICE_REQUIRES+=" pixman-1 >= 0.17.7"
-PKG_CHECK_MODULES(CELT051, celt051 >= 0.5.1.1)
-AC_SUBST(CELT051_CFLAGS)
-AC_SUBST(CELT051_LIBS)
-AC_SUBST(CELT051_LIBDIR)
-SPICE_REQUIRES+=" celt051 >= 0.5.1.1"
+PKG_CHECK_MODULES(CELT, celt = 0.11.1)
+AC_SUBST(CELT_CFLAGS)
+AC_SUBST(CELT_LIBS)
+AC_SUBST(CELT_LIBDIR)
+SPICE_REQUIRES+=" celt = 0.11.1"
if test "$os_linux" = yes; then
PKG_CHECK_MODULES(ALSA, alsa)
diff --git a/server/Makefile.am b/server/Makefile.am
index 37ff1830..b4e07408 100644
--- a/server/Makefile.am
+++ b/server/Makefile.am
@@ -12,7 +12,7 @@ INCLUDES = \
$(GL_CFLAGS) \
$(SSL_CFLAGS) \
$(SASL_CFLAGS) \
- $(CELT051_CFLAGS) \
+ $(CELT_CFLAGS) \
$(SLIRP_CFLAGS) \
-DSW_CANVAS_IMAGE_CACHE \
-DRED_STATISTICS \
@@ -70,7 +70,7 @@ libspice_server_la_LIBADD = \
$(PIXMAN_LIBS) \
$(SSL_LIBS) \
$(SASL_LIBS) \
- $(CELT051_LIBS) \
+ $(CELT_LIBS) \
$(SLIRP_LIBS) \
$(LIBRT) \
$(Z_LIBS) \
diff --git a/server/snd_worker.c b/server/snd_worker.c
index 1a4840c7..4ec4fa42 100644
--- a/server/snd_worker.c
+++ b/server/snd_worker.c
@@ -21,7 +21,7 @@
#include <sys/socket.h>
#include <netinet/ip.h>
#include <netinet/tcp.h>
-#include <celt051/celt.h>
+#include <celt/celt.h>
#include "spice.h"
#include "red_common.h"
@@ -285,8 +285,8 @@ static int snd_record_handle_write(RecordChannel *record_channel, size_t size, v
size = packet->data_size;
if (record_channel->mode == SPICE_AUDIO_DATA_MODE_CELT_0_5_1) {
- int celt_err = celt051_decode(record_channel->celt_decoder, packet->data, size,
- (celt_int16_t *)record_channel->celt_buf);
+ int celt_err = celt_decode(record_channel->celt_decoder, packet->data, size,
+ (celt_int16 *)record_channel->celt_buf, FRAME_SIZE);
if (celt_err != CELT_OK) {
red_printf("celt decode failed (%d)", celt_err);
return FALSE;
@@ -637,8 +637,8 @@ static int snd_playback_send_write(PlaybackChannel *playback_channel)
spice_marshall_msg_playback_data(channel->send_data.marshaller, &msg);
if (playback_channel->mode == SPICE_AUDIO_DATA_MODE_CELT_0_5_1) {
- int n = celt051_encode(playback_channel->celt_encoder, (celt_int16_t *)frame->samples, NULL,
- playback_channel->send_data.celt_buf, CELT_COMPRESSED_FRAME_BYTES);
+ int n = celt_encode(playback_channel->celt_encoder, (celt_int16 *)frame->samples, FRAME_SIZE,
+ playback_channel->send_data.celt_buf, CELT_COMPRESSED_FRAME_BYTES);
if (n < 0) {
red_printf("celt encode failed");
snd_disconnect_channel(channel);
@@ -929,8 +929,8 @@ static void snd_playback_cleanup(SndChannel *channel)
reds_enable_mm_timer();
}
- celt051_encoder_destroy(playback_channel->celt_encoder);
- celt051_mode_destroy(playback_channel->celt_mode);
+ celt_encoder_destroy(playback_channel->celt_encoder);
+ celt_mode_destroy(playback_channel->celt_mode);
}
static void snd_set_playback_peer(Channel *channel, RedsStream *stream, int migration,
@@ -946,15 +946,14 @@ static void snd_set_playback_peer(Channel *channel, RedsStream *stream, int migr
snd_disconnect_channel(worker->connection);
- if (!(celt_mode = celt051_mode_create(SPICE_INTERFACE_PLAYBACK_FREQ,
- SPICE_INTERFACE_PLAYBACK_CHAN,
- FRAME_SIZE, &celt_error))) {
+ if (!(celt_mode = celt_mode_create(SPICE_INTERFACE_PLAYBACK_FREQ,
+ FRAME_SIZE, &celt_error))) {
red_printf("create celt mode failed %d", celt_error);
return;
}
- if (!(celt_encoder = celt051_encoder_create(celt_mode))) {
- red_printf("create celt encoder failed");
+ if (!(celt_encoder = celt_encoder_create_custom(celt_mode, SPICE_INTERFACE_PLAYBACK_CHAN, &celt_error))) {
+ red_printf("create celt encoder failed %d", celt_error);
goto error_1;
}
@@ -988,10 +987,10 @@ static void snd_set_playback_peer(Channel *channel, RedsStream *stream, int migr
return;
error_2:
- celt051_encoder_destroy(celt_encoder);
+ celt_encoder_destroy(celt_encoder);
error_1:
- celt051_mode_destroy(celt_mode);
+ celt_mode_destroy(celt_mode);
}
static void snd_record_migrate(Channel *channel)
@@ -1095,8 +1094,8 @@ static void snd_record_cleanup(SndChannel *channel)
{
RecordChannel *record_channel = (RecordChannel *)channel;
- celt051_decoder_destroy(record_channel->celt_decoder);
- celt051_mode_destroy(record_channel->celt_mode);
+ celt_decoder_destroy(record_channel->celt_decoder);
+ celt_mode_destroy(record_channel->celt_mode);
}
static void snd_set_record_peer(Channel *channel, RedsStream *stream, int migration,
@@ -1112,15 +1111,14 @@ static void snd_set_record_peer(Channel *channel, RedsStream *stream, int migrat
snd_disconnect_channel(worker->connection);
- if (!(celt_mode = celt051_mode_create(SPICE_INTERFACE_RECORD_FREQ,
- SPICE_INTERFACE_RECORD_CHAN,
- FRAME_SIZE, &celt_error))) {
+ if (!(celt_mode = celt_mode_create(SPICE_INTERFACE_RECORD_FREQ,
+ FRAME_SIZE, &celt_error))) {
red_printf("create celt mode failed %d", celt_error);
return;
}
- if (!(celt_decoder = celt051_decoder_create(celt_mode))) {
- red_printf("create celt decoder failed");
+ if (!(celt_decoder = celt_decoder_create_custom(celt_mode, SPICE_INTERFACE_PLAYBACK_CHAN, &celt_error))) {
+ red_printf("create celt decoder failed %d", celt_error);
goto error_1;
}
@@ -1149,10 +1147,10 @@ static void snd_set_record_peer(Channel *channel, RedsStream *stream, int migrat
return;
error_1:
- celt051_decoder_destroy(celt_decoder);
+ celt_decoder_destroy(celt_decoder);
error_2:
- celt051_mode_destroy(celt_mode);
+ celt_mode_destroy(celt_mode);
}
static void snd_playback_migrate(Channel *channel)