From f5378b3cd99c51b124bcbd3f50ffcaef8aad5fdd Mon Sep 17 00:00:00 2001 From: Benjamin Franzke Date: Mon, 2 Dec 2013 18:45:49 +0100 Subject: Make use of CELT_GET_BITSTREAM_VERSION Instead of hardcoding this. --- src/audio.c | 5 ++++- src/audio.h | 2 ++ src/cmumble.c | 12 ++++++------ 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/audio.c b/src/audio.c index a373871..b8a1efb 100644 --- a/src/audio.c +++ b/src/audio.c @@ -207,11 +207,14 @@ static int setup_playback_gst_pipeline(struct cmumble *cm) { cm->audio.celt_mode = celt_mode_create(SAMPLERATE, - SAMPLERATE / 100, NULL); + SAMPLERATE / 100, NULL); celt_header_init(&cm->audio.celt_header, cm->audio.celt_mode, CHANNELS); celt_header_to_packet(&cm->audio.celt_header, cm->audio.celt_header_packet, sizeof(CELTHeader)); + celt_mode_info(cm->audio.celt_mode, CELT_GET_BITSTREAM_VERSION, + &cm->audio.celt_bitstream_version); + return 0; } diff --git a/src/audio.h b/src/audio.h index 90dc13d..1e1c47c 100644 --- a/src/audio.h +++ b/src/audio.h @@ -18,6 +18,8 @@ struct cmumble_audio { guint8 celt_header_packet[sizeof(CELTHeader)]; CELTHeader celt_header; CELTMode *celt_mode; + + gint32 celt_bitstream_version; }; struct cmumble; diff --git a/src/cmumble.c b/src/cmumble.c index 0b3a6f5..2613ea8 100644 --- a/src/cmumble.c +++ b/src/cmumble.c @@ -299,7 +299,7 @@ cmumble_protocol_init(struct cmumble *cm) authenticate.username = cm->user_name; authenticate.password = ""; authenticate.n_celt_versions = 1; - authenticate.celt_versions = (int32_t[]) { 0x8000000b }; + authenticate.celt_versions = &cm->audio.celt_bitstream_version; cmumble_send_authenticate(cm, &authenticate); source = g_timeout_source_new_seconds(5); @@ -362,16 +362,16 @@ int main(int argc, char **argv) if (cm.async_queue == NULL) return 1; - cmumble_commands_init(&cm); - if (cmumble_connection_init(&cm, host, port) < 0) - return 1; - gst_init(&argc, &argv); - if (cmumble_audio_init(&cm) < 0) return 1; + + cmumble_commands_init(&cm); cmumble_io_init(&cm); + if (cmumble_connection_init(&cm, host, port) < 0) + return 1; + g_main_loop_run(cm.loop); g_main_loop_unref(cm.loop); -- cgit