diff options
Diffstat (limited to 'tinyDAV/include/tinydav')
80 files changed, 5458 insertions, 0 deletions
diff --git a/tinyDAV/include/tinydav/audio/alsa/tdav_common_alsa.h b/tinyDAV/include/tinydav/audio/alsa/tdav_common_alsa.h new file mode 100644 index 0000000..d6b0673 --- /dev/null +++ b/tinyDAV/include/tinydav/audio/alsa/tdav_common_alsa.h @@ -0,0 +1,74 @@ +/* Copyright (C) 2014 Mamadou DIOP. +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +*/ +#ifndef TINYDAV_COMMON_ALSA_H +#define TINYDAV_COMMON_ALSA_H + +#include "tinydav_config.h" + +#if HAVE_ALSA_ASOUNDLIB_H + +TDAV_BEGIN_DECLS + +#include "tsk_thread.h" +#include "tsk_memory.h" +#include "tsk_safeobj.h" +#include "tsk_timer.h" +#include "tsk_string.h" +#include "tsk_debug.h" + +#include <alsa/asoundlib.h> + +typedef struct tdav_common_alsa_s +{ + tsk_bool_t b_initialized; + tsk_bool_t b_muted; + tsk_bool_t b_started; + tsk_bool_t b_prepared; + tsk_bool_t b_paused; + tsk_bool_t b_capture; + + tsk_size_t n_buff_size_in_bytes; + tsk_size_t n_buff_size_in_samples; + uint8_t* p_buff_ptr; + + int channels; + int sample_rate; + + snd_pcm_t *p_handle; + snd_pcm_hw_params_t *p_params; + char* p_device_name; + + TSK_DECLARE_SAFEOBJ; +} +tdav_common_alsa_t; + +int tdav_common_alsa_init(tdav_common_alsa_t* p_self); +int tdav_common_alsa_lock(tdav_common_alsa_t* p_self); +int tdav_common_alsa_unlock(tdav_common_alsa_t* p_self); +int tdav_common_alsa_prepare(tdav_common_alsa_t* p_self, tsk_bool_t is_capture, int ptime, int channels, int sample_rate); +int tdav_common_alsa_unprepare(tdav_common_alsa_t* p_self); +int tdav_common_alsa_start(tdav_common_alsa_t* p_self); +int tdav_common_alsa_stop(tdav_common_alsa_t* p_self); +int tdav_common_alsa_deinit(tdav_common_alsa_t* p_self); + +TDAV_END_DECLS + +#endif /* HAVE_ALSA_ASOUNDLIB_H */ + +#endif /* TINYDAV_COMMON_ALSA_H */ + diff --git a/tinyDAV/include/tinydav/audio/alsa/tdav_consumer_alsa.h b/tinyDAV/include/tinydav/audio/alsa/tdav_consumer_alsa.h new file mode 100644 index 0000000..ae9f0f9 --- /dev/null +++ b/tinyDAV/include/tinydav/audio/alsa/tdav_consumer_alsa.h @@ -0,0 +1,36 @@ +/* Copyright (C) 2014 Mamadou DIOP. +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +*/ +#ifndef TINYDAV_CONSUMER_ALSA_H +#define TINYDAV_CONSUMER_ALSA_H + +#include "tinydav_config.h" + +#if HAVE_ALSA_ASOUNDLIB_H + +#include "tinydav/audio/tdav_consumer_audio.h" + +TDAV_BEGIN_DECLS + +extern const tmedia_consumer_plugin_def_t *tdav_consumer_alsa_plugin_def_t; + +TDAV_END_DECLS + +#endif /* HAVE_ALSA_ASOUNDLIB_H */ + +#endif /* TINYDAV_CONSUMER_ALSA_H */ + diff --git a/tinyDAV/include/tinydav/audio/alsa/tdav_producer_alsa.h b/tinyDAV/include/tinydav/audio/alsa/tdav_producer_alsa.h new file mode 100644 index 0000000..78fd4eb --- /dev/null +++ b/tinyDAV/include/tinydav/audio/alsa/tdav_producer_alsa.h @@ -0,0 +1,35 @@ +/* Copyright (C) 2014 Mamadou DIOP. +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +*/ +#ifndef TINYDAV_PRODUCER_ALSA_H +#define TINYDAV_PRODUCER_ALSA_H + +#include "tinydav_config.h" + +#if HAVE_ALSA_ASOUNDLIB_H + +#include "tinydav/audio/tdav_producer_audio.h" + +TDAV_BEGIN_DECLS + +extern const tmedia_producer_plugin_def_t *tdav_producer_alsa_plugin_def_t; + +TDAV_END_DECLS + +#endif /* HAVE_ALSA_ASOUNDLIB_H */ + +#endif /* TINYDAV_PRODUCER_ALSA_H */ diff --git a/tinyDAV/include/tinydav/audio/coreaudio/tdav_audiounit.h b/tinyDAV/include/tinydav/audio/coreaudio/tdav_audiounit.h new file mode 100644 index 0000000..128681a --- /dev/null +++ b/tinyDAV/include/tinydav/audio/coreaudio/tdav_audiounit.h @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2010-2011 Mamadou Diop. + * + * Contact: Mamadou Diop <diopmamadou(at)doubango.org> + * + * This file is part of Open Source Doubango Framework. + * + * DOUBANGO is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * DOUBANGO 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 General Public License + * along with DOUBANGO. + * + */ +#ifndef TDAV_AUDIO_UNIT_H +#define TDAV_AUDIO_UNIT_H + +#include "tinydav_config.h" + +#if HAVE_COREAUDIO_AUDIO_UNIT + +#include <AudioUnit/AudioUnit.h> +#include <AudioToolbox/AudioToolbox.h> +#include "tsk_object.h" + +TDAV_BEGIN_DECLS + + +#if TARGET_OS_MAC +# if AUDIO_UNIT_VERSION < 1060 +# define AudioComponent Component +# define AudioComponentInstance ComponentInstance +# define AudioComponentDescription ComponentDescription +# define AudioComponentFindNext FindNextComponent +# define AudioComponentInstanceNew OpenAComponent +# define AudioComponentInstanceDispose CloseComponent +# endif +#endif /* TARGET_OS_MAC */ + +typedef void* tdav_audiounit_handle_t; + +tdav_audiounit_handle_t* tdav_audiounit_handle_create(uint64_t session_id); +AudioComponentInstance tdav_audiounit_handle_get_instance(tdav_audiounit_handle_t* self); +int tdav_audiounit_handle_signal_consumer_prepared(tdav_audiounit_handle_t* self); +int tdav_audiounit_handle_signal_producer_prepared(tdav_audiounit_handle_t* self); +int tdav_audiounit_handle_start(tdav_audiounit_handle_t* self); +uint32_t tdav_audiounit_handle_get_frame_duration(tdav_audiounit_handle_t* self); +int tdav_audiounit_handle_configure(tdav_audiounit_handle_t* self, tsk_bool_t consumer, uint32_t ptime, AudioStreamBasicDescription* audioFormat); +int tdav_audiounit_handle_mute(tdav_audiounit_handle_t* self, tsk_bool_t mute); +int tdav_audiounit_handle_interrupt(tdav_audiounit_handle_t* self, tsk_bool_t interrupt); +int tdav_audiounit_handle_stop(tdav_audiounit_handle_t* self); +int tdav_audiounit_handle_destroy(tdav_audiounit_handle_t** self); + +TDAV_END_DECLS + +#endif /* HAVE_COREAUDIO_AUDIO_UNIT */ + +#endif /* TDAV_AUDIO_UNIT_H */ diff --git a/tinyDAV/include/tinydav/audio/coreaudio/tdav_consumer_audioqueue.h b/tinyDAV/include/tinydav/audio/coreaudio/tdav_consumer_audioqueue.h new file mode 100644 index 0000000..c7b1954 --- /dev/null +++ b/tinyDAV/include/tinydav/audio/coreaudio/tdav_consumer_audioqueue.h @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2010-2015 Mamadou DIOP. + * + * This file is part of Open Source Doubango Framework. + * + * DOUBANGO is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * DOUBANGO 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 General Public License + * along with DOUBANGO. + * + */ + +/**@file tdav_consumer_audioqueue.h + * @brief Audio Consumer for MacOSX and iOS platforms using AudioQueue. + * + * @author Laurent Etiemble <laurent.etiemble(at)gmail.com> + * @author Mamadou Diop <diopmamadou(at)doubango(dot)org> + */ +#ifndef TINYDAV_CONSUMER_COREAUDIO_AUDIO_QUEUE_H +#define TINYDAV_CONSUMER_COREAUDIO_AUDIO_QUEUE_H + +#include "tinydav_config.h" + +#if HAVE_COREAUDIO_AUDIO_QUEUE + +#include <AudioToolbox/AudioToolbox.h> +#include "tinydav/audio/tdav_consumer_audio.h" + +TDAV_BEGIN_DECLS + +#ifndef CoreAudioPlayBuffers +# define CoreAudioPlayBuffers 3 +#endif + +typedef struct tdav_consumer_audioqueue_s +{ + TDAV_DECLARE_CONSUMER_AUDIO; + + tsk_bool_t started; + + AudioStreamBasicDescription description; + AudioQueueRef queue; + AudioQueueBufferRef buffers[CoreAudioPlayBuffers]; + + tsk_size_t buffer_size; +} +tdav_consumer_audioqueue_t; + +TINYDAV_GEXTERN const tmedia_consumer_plugin_def_t *tdav_consumer_audioqueue_plugin_def_t; + +TDAV_END_DECLS + +#endif /* HAVE_COREAUDIO_AUDIO_QUEUE */ + +#endif /* TINYDAV_CONSUMER_COREAUDIO_AUDIO_QUEUE_H */ diff --git a/tinyDAV/include/tinydav/audio/coreaudio/tdav_consumer_audiounit.h b/tinyDAV/include/tinydav/audio/coreaudio/tdav_consumer_audiounit.h new file mode 100644 index 0000000..509f787 --- /dev/null +++ b/tinyDAV/include/tinydav/audio/coreaudio/tdav_consumer_audiounit.h @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2010-2011 Mamadou Diop. + * + * Contact: Mamadou Diop <diopmamadou(at)doubango.org> + * + * This file is part of Open Source Doubango Framework. + * + * DOUBANGO is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * DOUBANGO 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 General Public License + * along with DOUBANGO. + * + */ +#ifndef TINYDAV_CONSUMER_COREAUDIO_AUDIO_UNIT_H +#define TINYDAV_CONSUMER_COREAUDIO_AUDIO_UNIT_H + +#include "tinydav_config.h" + +#if HAVE_COREAUDIO_AUDIO_UNIT + +#include <AudioToolbox/AudioToolbox.h> +#include <speex/speex_buffer.h> +#include "tinydav/audio/coreaudio/tdav_audiounit.h" +#include "tinydav/audio/tdav_consumer_audio.h" +#import "tinymedia/tmedia_resampler.h" + +#include "tsk_mutex.h" + +TDAV_BEGIN_DECLS + +typedef struct tdav_consumer_audiounit_s +{ + TDAV_DECLARE_CONSUMER_AUDIO; + + tdav_audiounit_handle_t* audioUnitHandle; + unsigned started:1; + unsigned paused:1; + + struct { + struct { + void* buffer; + tsk_size_t size; + } chunck; + tsk_ssize_t leftBytes; + SpeexBuffer* buffer; + tsk_size_t size; + tsk_mutex_handle_t* mutex; + } ring; + + tmedia_resampler_t *resampler; +} +tdav_consumer_audiounit_t; + +TINYDAV_GEXTERN const tmedia_consumer_plugin_def_t *tdav_consumer_audiounit_plugin_def_t; + +TDAV_END_DECLS + +#endif /* HAVE_COREAUDIO_AUDIO_UNIT */ + +#endif /* TINYDAV_CONSUMER_COREAUDIO_AUDIO_UNIT_H */ diff --git a/tinyDAV/include/tinydav/audio/coreaudio/tdav_producer_audioqueue.h b/tinyDAV/include/tinydav/audio/coreaudio/tdav_producer_audioqueue.h new file mode 100644 index 0000000..27c9b98 --- /dev/null +++ b/tinyDAV/include/tinydav/audio/coreaudio/tdav_producer_audioqueue.h @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2010-2011 Mamadou Diop. + * + * Contact: Mamadou Diop <diopmamadou(at)doubango.org> + * + * This file is part of Open Source Doubango Framework. + * + * DOUBANGO is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * DOUBANGO 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 General Public License + * along with DOUBANGO. + * + */ +/**@file tdav_producer_audioqueue.h + * @brief Audio Producer for MacOSX and iOS platforms using AudioQueue. + * + * @author Laurent Etiemble <laurent.etiemble(at)gmail.com> + * @author Mamadou Diop <diopmamadou(at)doubango(dot)org> + * + */ +#ifndef TINYDAV_PRODUCER_COREAUDIO_AUDIO_QUEUE_H +#define TINYDAV_PRODUCER_COREAUDIO_AUDIO_QUEUE_H + +#include "tinydav_config.h" + +#if HAVE_COREAUDIO_AUDIO_QUEUE + +#include <AudioToolbox/AudioToolbox.h> +#include "tinydav/audio/tdav_producer_audio.h" + +TDAV_BEGIN_DECLS + +#define CoreAudioRecordBuffers 3 + +typedef struct tdav_producer_audioqueue_s +{ + TDAV_DECLARE_PRODUCER_AUDIO; + + tsk_bool_t started; + + AudioStreamBasicDescription description; + AudioQueueRef queue; + AudioQueueBufferRef buffers[CoreAudioRecordBuffers]; + + tsk_size_t buffer_size; +} +tdav_producer_audioqueue_t; + +TINYDAV_GEXTERN const tmedia_producer_plugin_def_t *tdav_producer_audioqueue_plugin_def_t; + +TDAV_END_DECLS + +#endif /* HAVE_COREAUDIO_AUDIO_QUEUE */ + +#endif /* TINYDAV_PRODUCER_COREAUDIO_AUDIO_QUEUE_H */ diff --git a/tinyDAV/include/tinydav/audio/coreaudio/tdav_producer_audiounit.h b/tinyDAV/include/tinydav/audio/coreaudio/tdav_producer_audiounit.h new file mode 100644 index 0000000..c1a99cb --- /dev/null +++ b/tinyDAV/include/tinydav/audio/coreaudio/tdav_producer_audiounit.h @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2010-2011 Mamadou Diop. + * + * Contact: Mamadou Diop <diopmamadou(at)doubango.org> + * + * This file is part of Open Source Doubango Framework. + * + * DOUBANGO is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * DOUBANGO 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 General Public License + * along with DOUBANGO. + * + */ +#ifndef TINYDAV_PRODUCER_COREAUDIO_AUDIO_UNIT_H +#define TINYDAV_PRODUCER_COREAUDIO_AUDIO_UNIT_H + +#include "tinydav_config.h" + +#if HAVE_COREAUDIO_AUDIO_UNIT + +#include <AudioToolbox/AudioToolbox.h> +#include <speex/speex_buffer.h> +#include "tinydav/audio/coreaudio/tdav_audiounit.h" +#include "tinydav/audio/tdav_producer_audio.h" +#include "tsk_condwait.h" +#include "tsk_mutex.h" + +TDAV_BEGIN_DECLS + +typedef struct tdav_producer_audiounit_s +{ + TDAV_DECLARE_PRODUCER_AUDIO; + + tdav_audiounit_handle_t* audioUnitHandle; + unsigned started:1; + unsigned paused:1; + unsigned muted; + + struct { + struct { + void* buffer; + tsk_size_t size; + } chunck; + SpeexBuffer* buffer; + tsk_size_t size; + } ring; +} +tdav_producer_audiounit_t; + +TINYDAV_GEXTERN const tmedia_producer_plugin_def_t *tdav_producer_audiounit_plugin_def_t; + +TDAV_END_DECLS + +#endif /* HAVE_COREAUDIO_AUDIO_UNIT */ + +#endif /* TINYDAV_PRODUCER_COREAUDIO_AUDIO_UNIT_H */ + + + diff --git a/tinyDAV/include/tinydav/audio/directsound/tdav_consumer_dsound.h b/tinyDAV/include/tinydav/audio/directsound/tdav_consumer_dsound.h new file mode 100644 index 0000000..dbba1a8 --- /dev/null +++ b/tinyDAV/include/tinydav/audio/directsound/tdav_consumer_dsound.h @@ -0,0 +1,47 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +* +*/ + +/**@file tdav_consumer_dsound.h + * @brief Microsoft DirectSound consumer. + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#ifndef TINYDAV_CONSUMER_DSOUND_H +#define TINYDAV_CONSUMER_DSOUND_H + +#include "tinydav_config.h" + +#if HAVE_DSOUND_H + +#include "tinydav/audio/tdav_consumer_audio.h" + +TDAV_BEGIN_DECLS + +TINYDAV_GEXTERN const tmedia_consumer_plugin_def_t *tdav_consumer_dsound_plugin_def_t; + +TDAV_END_DECLS + +#endif /* HAVE_DSOUND_H */ + +#endif /* TINYDAV_CONSUMER_DSOUND_H */ diff --git a/tinyDAV/include/tinydav/audio/directsound/tdav_producer_dsound.h b/tinyDAV/include/tinydav/audio/directsound/tdav_producer_dsound.h new file mode 100644 index 0000000..1f68008 --- /dev/null +++ b/tinyDAV/include/tinydav/audio/directsound/tdav_producer_dsound.h @@ -0,0 +1,46 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +* +*/ + +/**@file tdav_producer_dsound.h + * @brief Microsoft DirectSound producer. + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + */ +#ifndef TINYDAV_PRODUCER_DSOUND_H +#define TINYDAV_PRODUCER_DSOUND_H + +#include "tinydav_config.h" + +#if HAVE_DSOUND_H || HAVE_DSOUND + +#include "tinydav/audio/tdav_producer_audio.h" + +TDAV_BEGIN_DECLS + +TINYDAV_GEXTERN const tmedia_producer_plugin_def_t *tdav_producer_dsound_plugin_def_t; + +TDAV_END_DECLS + +#endif /* HAVE_DSOUND_H || HAVE_DSOUND */ + +#endif /* TINYDAV_PRODUCER_DSOUND_H */ diff --git a/tinyDAV/include/tinydav/audio/oss/tdav_consumer_oss.h b/tinyDAV/include/tinydav/audio/oss/tdav_consumer_oss.h new file mode 100644 index 0000000..64deeef --- /dev/null +++ b/tinyDAV/include/tinydav/audio/oss/tdav_consumer_oss.h @@ -0,0 +1,36 @@ +/* Copyright (C) 2014 Mamadou DIOP. +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +*/ +#ifndef TINYDAV_CONSUMER_OSS_H +#define TINYDAV_CONSUMER_OSS_H + +#include "tinydav_config.h" + +#if HAVE_LINUX_SOUNDCARD_H + +#include "tinydav/audio/tdav_consumer_audio.h" + +TDAV_BEGIN_DECLS + +extern const tmedia_consumer_plugin_def_t *tdav_consumer_oss_plugin_def_t; + +TDAV_END_DECLS + +#endif /* HAVE_LINUX_SOUNDCARD_H */ + +#endif /* TINYDAV_CONSUMER_OSS_H */ + diff --git a/tinyDAV/include/tinydav/audio/oss/tdav_producer_oss.h b/tinyDAV/include/tinydav/audio/oss/tdav_producer_oss.h new file mode 100644 index 0000000..2fa00ff --- /dev/null +++ b/tinyDAV/include/tinydav/audio/oss/tdav_producer_oss.h @@ -0,0 +1,35 @@ +/* Copyright (C) 2014 Mamadou DIOP. +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +*/ +#ifndef TINYDAV_PRODUCER_OSS_H +#define TINYDAV_PRODUCER_OSS_H + +#include "tinydav_config.h" + +#if HAVE_LINUX_SOUNDCARD_H + +#include "tinydav/audio/tdav_producer_audio.h" + +TDAV_BEGIN_DECLS + +extern const tmedia_producer_plugin_def_t *tdav_producer_oss_plugin_def_t; + +TDAV_END_DECLS + +#endif /* HAVE_LINUX_SOUNDCARD_HH */ + +#endif /* TINYDAV_PRODUCER_OSS_H */ diff --git a/tinyDAV/include/tinydav/audio/tdav_consumer_audio.h b/tinyDAV/include/tinydav/audio/tdav_consumer_audio.h new file mode 100644 index 0000000..c561d84 --- /dev/null +++ b/tinyDAV/include/tinydav/audio/tdav_consumer_audio.h @@ -0,0 +1,73 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +* +*/ + +/**@file tdav_consumer_audio.h + * @brief Base class for all Audio consumers. + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + */ +#ifndef TINYDAV_CONSUMER_AUDIO_H +#define TINYDAV_CONSUMER_AUDIO_H + +#include "tinydav_config.h" + +#include "tinymedia/tmedia_consumer.h" + +#include "tsk_safeobj.h" + +TDAV_BEGIN_DECLS + +#define TDAV_CONSUMER_AUDIO(self) ((tdav_consumer_audio_t*)(self)) + +typedef struct tdav_consumer_audio_s +{ + TMEDIA_DECLARE_CONSUMER; + + struct tmedia_denoise_s* denoise; + struct tmedia_resampler_s* resampler; + struct tmedia_jitterbuffer_s* jitterbuffer; + + TSK_DECLARE_SAFEOBJ; +} +tdav_consumer_audio_t; + +TINYDAV_API int tdav_consumer_audio_init(tdav_consumer_audio_t* self); +TINYDAV_API int tdav_consumer_audio_cmp(const tsk_object_t* consumer1, const tsk_object_t* consumer2); +#define tdav_consumer_audio_prepare(self, codec) tmedia_consumer_prepare(TDAV_CONSUMER_AUDIO(self), codec) +#define tdav_consumer_audio_start(self) tmedia_consumer_start(TDAV_CONSUMER_AUDIO(self)) +#define tdav_consumer_audio_consume(self, buffer, size) tmedia_consumer_consume(TDAV_CONSUMER_AUDIO(self), buffer, size) +#define tdav_consumer_audio_pause(self) tmedia_consumer_pause(TDAV_CONSUMER_AUDIO(self)) +#define tdav_consumer_audio_stop(self) tmedia_consumer_stop(TDAV_CONSUMER_AUDIO(self)) +TINYDAV_API int tdav_consumer_audio_set(tdav_consumer_audio_t* self, const tmedia_param_t* param); +TINYDAV_API int tdav_consumer_audio_put(tdav_consumer_audio_t* self, const void* data, tsk_size_t data_size, const tsk_object_t* proto_hdr); +TINYDAV_API tsk_size_t tdav_consumer_audio_get(tdav_consumer_audio_t* self, void* out_data, tsk_size_t out_size); +TINYDAV_API int tdav_consumer_audio_tick(tdav_consumer_audio_t* self); +void tdav_consumer_audio_set_denoise(tdav_consumer_audio_t* self, struct tmedia_denoise_s* denoise); +void tdav_consumer_audio_set_jitterbuffer(tdav_consumer_audio_t* self, struct tmedia_jitterbuffer_s* jitterbuffer); +TINYDAV_API int tdav_consumer_audio_reset(tdav_consumer_audio_t* self); +TINYDAV_API int tdav_consumer_audio_deinit(tdav_consumer_audio_t* self); + +#define TDAV_DECLARE_CONSUMER_AUDIO tdav_consumer_audio_t __consumer_audio__ + +TDAV_END_DECLS + +#endif /* TINYDAV_CONSUMER_AUDIO_H */ diff --git a/tinyDAV/include/tinydav/audio/tdav_jitterbuffer.h b/tinyDAV/include/tinydav/audio/tdav_jitterbuffer.h new file mode 100644 index 0000000..c6d2449 --- /dev/null +++ b/tinyDAV/include/tinydav/audio/tdav_jitterbuffer.h @@ -0,0 +1,333 @@ +/* File from: http://cms.speakup.nl/tech/opensource/jitterbuffer/verslag-20051209.pdf/ */ + +/******************************************************* + * jitterbuffer: + * an application-independent jitterbuffer, which tries + * to achieve the maximum user perception during a call. + * For more information look at: + * http://www.speakup.nl/opensource/jitterbuffer/ + * + * Copyright on this file is held by: + * - Jesse Kaijen <jesse@speakup.nl> + * - SpeakUp <info@speakup.nl> + * + * Contributors: + * Jesse Kaijen <jesse@speakup.nl> + * + * Version: 1.1 + * + * Changelog: +* 1.0 => 1.1 (2006-03-24) (thanks to Micheal Jerris, freeswitch.org) + * - added MSVC 2005 project files + * - added JB_NOJB as return value + * + * + * This program is free software, distributed under the terms of: + * - the GNU Lesser (Library) General Public License + * - the Mozilla Public License + * + * if you are interested in an different licence type, please contact us. + * + * How to use the jitterbuffer, please look at the comments + * in the headerfile. + * + * Further details on specific implementations, + * please look at the comments in the code file. + */ + +#ifndef TINYDAV_JITTERBUFFER_H_ +#define TINYDAV_JITTERBUFFER_H_ + +#include "tinydav_config.h" + +#if !(HAVE_SPEEX_DSP && HAVE_SPEEX_JB) + +TDAV_BEGIN_DECLS + +/*********** + * The header file consists of four parts. + * - configuration constants, structs and parameter definitions + * - functions + * - How to use the jitterbuffer and + * which responsibilities do YOU have + * - debug messages explained + */ + + +// configuration constants +/* Number of historical timestamps to use in calculating jitter and jitterbuffer size */ +#ifndef JB_HISTORY_SIZE +# define JB_HISTORY_SIZE 500 +#endif + +/* minimum jitterbuffer size, disabled if 0 */ +#define JB_MIN_SIZE 0 +/* maximum jitterbuffer size, disabled if 0 */ +#define JB_MAX_SIZE 0 + /* maximum successive interpolating frames, disabled if 0 */ +#define JB_MAX_SUCCESSIVE_INTERP 0 +/* amount of extra delay allowed before shrinking */ +#define JB_ALLOW_EXTRA_DELAY 30 +/* ms between growing */ +#define JB_WAIT_GROW 60 +/* ms between shrinking */ +#define JB_WAIT_SHRINK 250 +/* ms that the JB max may be off */ +#define JB_MAX_DIFF 6000 //in a RTP stream the max_diff may be 3000 packets (most packets are 20ms) + +//structs +typedef struct jb_info { + long frames_received; /* Number of frames received by the jitterbuffer */ + long frames_late; /* Number of frames that were late */ + long frames_lost; /* Number of frames that were lost */ + long frames_ooo; /* Number of frames that were Out Of Order */ + long frames_dropped; /* Number of frames that were dropped due shrinkage of the jitterbuffer */ + long frames_dropped_twice; /* Number of frames that were dropped because this timestamp was already in the jitterbuffer */ + + long delay; /* Current delay due the jitterbuffer */ + long jitter; /* jitter measured within current history interval*/ + long losspct; /* recent lost frame percentage (network and jitterbuffer loss) */ + + long delay_target; /* The delay where we want to grow to */ + long losspct_jb; /* recent lost percentage due the jitterbuffer */ + long last_voice_ms; /* the duration of the last voice frame */ + short silence; /* If we are in silence 1-yes 0-no */ + long iqr; /* Inter Quartile Range of current history, if the squareroot is taken it is a good estimate of jitter */ +} jb_info; + +typedef struct jb_frame { + void *data; /* the frame data */ + long ts; /* the senders timestamp */ + long ms; /* length of this frame in ms */ + int type; /* the type of frame */ + int codec; /* codec of this frame, undefined if nonvoice */ + struct jb_frame *next, *prev; /* pointers to the next and previous frames in the queue */ +} jb_frame; + +typedef struct jb_hist_element { + long delay; /* difference between time of arrival and senders timestamp */ + long ts; /* senders timestamp */ + long ms; /* length of this frame in ms */ + int codec; /* wich codec this frame has */ +} jb_hist_element; + +typedef struct jb_settings { + /* settings */ + long min_jb; /* defines a hard clamp to use in setting the jitterbuffer delay */ + long max_jb; /* defines a hard clamp to use in setting the jitterbuffer delay */ + long max_successive_interp; /* the maximum count of successive interpolations before assuming silence */ + long extra_delay; /* amount of extra delay allowed before shrinking */ + long wait_grow; /* ms between growing */ + long wait_shrink; /* ms between shrinking */ + long max_diff; /* maximum number of milliseconds the jitterbuffer may be off */ +} jb_settings; + +typedef struct jitterbuffer { + struct jb_hist_element hist[JB_HISTORY_SIZE]; /* the history of the last received frames */ + long hist_sorted_delay[JB_HISTORY_SIZE]; /* a sorted buffer of the delays (lowest first) */ + long hist_sorted_timestamp[JB_HISTORY_SIZE]; /* a sorted buffer of the timestamps (lowest first) */ + + int hist_pointer; /* points to index in history for next entry */ + long last_adjustment; /* the time of the last adjustment (growing or shrinking) */ + long next_voice_time; /* the next ts is to be read from the jb (senders timestamp) */ + long cnt_successive_interp; /* the count of consecutive interpolation frames */ + long silence_begin_ts; /* the time of the last CNG frame, when in silence */ + long min; /* the clock difference within current history interval */ + long current; /* the present jitterbuffer adjustment */ + long target; /* the target jitterbuffer adjustment */ + long last_delay; /* the delay of the last packet, used for calc. jitter */ + + jb_frame *voiceframes; /* queued voiceframes */ + jb_frame *controlframes; /* queued controlframes */ + jb_settings settings; /* the settings of the jitterbuffer */ + jb_info info; /* the statistics of the jitterbuffer */ +} jitterbuffer; + +//parameter definitions +/* return codes */ +#define JB_OK 0 +#define JB_EMPTY 1 +#define JB_NOFRAME 2 +#define JB_INTERP 3 +#define JB_NOJB 4 + + +/* frame types */ +#define JB_TYPE_CONTROL 1 +#define JB_TYPE_VOICE 2 +#define JB_TYPE_SILENCE 3 + +/* the jitterbuffer behaives different for each codec. */ +/* Look in the code if a codec has his function defined */ +/* default is g711x behaiviour */ +#define JB_CODEC_SPEEX 10 //NOT defined +#define JB_CODEC_ILBC 9 //NOT defined +#define JB_CODEC_GSM_EFR 8 +#define JB_CODEC_GSM_FR 7 //NOT defined +#define JB_CODEC_G723_1 6 +#define JB_CODEC_G729A 5 +#define JB_CODEC_G729 4 +#define JB_CODEC_G711x_PLC 3 +#define JB_CODEC_G711x 2 +#define JB_CODEC_OTHER 1 //NOT defined + + +/* + * Creates a new jitterbuffer and sets the default settings. + * Always use this function for creating a new jitterbuffer. + */ +jitterbuffer *jb_new(); + +/* + * The control frames and possible personal settings are kept. + * History and voice/silence frames are destroyed. + */ +void jb_reset(jitterbuffer *jb); + +/* + * Resets the jitterbuffer totally, all the control/voice/silence frames are destroyed + * default settings are put as well. + */ +void jb_reset_all(jitterbuffer *jb); + +/* + * Destroy the jitterbuffer and any frame within. + * Always use this function for destroying a jitterbuffer, + * otherwise there is a chance of memory leaking. + */ +void jb_destroy(jitterbuffer *jb); + +/* + * Define your own settings for the jitterbuffer. Only settings !=0 + * are put in the jitterbuffer. + */ +void jb_set_settings(jitterbuffer *jb, jb_settings *settings); + +/* + * Get the statistics for the jitterbuffer. + * Copying the statistics directly for the jitterbuffer won't work because + * The statistics are only calculated when calling this function. + */ +void jb_get_info(jitterbuffer *jb, jb_info *stats); + +/* + * Get the current settings of the jitterbuffer. + */ +void jb_get_settings(jitterbuffer *jb, jb_settings *settings); + +/* + * Gives an estimation of the MOS of a call given the + * packetloss p, delay d, and wich codec is used. + * The assumption is made that the echo cancelation is around 37dB. + */ +float jb_guess_mos(float p, long d, int codec); + +/* + * returns JB_OK if there are still frames left in the jitterbuffer + * otherwise JB_EMPTY is returned. + */ +int jb_has_frames(jitterbuffer *jb); + +/* + * put a packet(frame) into the jitterbuffer. + * *data - points to the packet + * type - type of packet, JB_CONTROL|JB_VOICE|JB_SILENCE + * ms - duration of frame (only voice) + * ts - timestamp sender + * now - current timestamp (timestamp of arrival) + * codec - which codec the frame holds (only voice), if not defined, g711x will be used + * + * if type==control @REQUIRE: *data, type, ts, now + * if type==voice @REQUIRE: *data, type, ms, ts, now @OPTIONAL: codec + * if type==silence @REQUIRE: *data, type, ts, now + * on return *data is undefined + */ +void jb_put(jitterbuffer *jb, void *data, int type, long ms, long ts, long now, int codec); + +/* + * Get a packet from the jitterbuffer if it's available. + * control packets have a higher priority above voice and silence packets + * they are always delivered as fast as possible. The delay of the jitterbuffer + * doesn't work for these packets. + * @REQUIRE 1<interpl <= jb->settings->extra_delay (=default JB_ALLOW_EXTRA_DELAY) + * + * return will be: + * JB_OK, *data points to the packet + * JB_INTERP, please interpolate for interpl milliseconds + * JB_NOFRAME, no frame scheduled + * JB_EMPTY, the jitterbuffer is empty + */ +int jb_get(jitterbuffer *jb, void **data, long now, long interpl); + +/* debug functions */ +typedef void (*jb_output_function_t)(const char *fmt, ...); +void jb_setoutput(jb_output_function_t warn, jb_output_function_t err, jb_output_function_t dbg); + + +/******************************* + * The use of the jitterbuffer * + ******************************* + * Always create a new jitterbuffer with jb_new(). + * Always destroy a jitterbuffer with jb_destroy(). + * + * There is no lock(mutex) mechanism, that your responsibility. + * The reason for this is that different environments require + * different ways of implementing a lock. + * + * The following functions require a lock on the jitterbuffer: + * jb_reset(), jb_reset_all(), jb_destroy(), jb_set_settings(), + * jb_get_info(), jb_get_settings(), jb_has_frames(), jb_put(), + * jb_get() + * + * The following functions do NOT require a lock on the jitterbuffer: + * jb_new(), jb_guess_mos() + * + * Since control packets have a higher priority above any other packet + * a call may already be ended while there is audio left to play. We + * advice that you poll the jitterbuffer if there are frames left. + * + * If the audiopath is oneway (eg. voicemailbox) and the latency doesn't + * matter, we advice to set a minimum jitterbuffer size. Then there is + * less loss and the quality is better. + */ + + +/**************************** + * debug messages explained * + **************************** + * N - jb_new() + * R - jb_reset() + * r - jb_reset_all() + * D - jb_destroy() + * S - jb_set_settings() + * H - jb_has_frames() + * I - jb_get_info() + * S - jb_get_settings() + * pC - jb_put() put Control packet + * pT - jb_put() Timestamp was already in the queue + * pV - jb_put() put Voice packet + * pS - jb_put() put Silence packet + * + * A - jb_get() + * // below are all the possible debug info when trying to get a packet + * gC - get_control() - there is a control message + * gs - get_voice() - there is a silence frame + * gS - get_voice() - we are in silence + * gL - get_voice() - are in silence, frame is late + * gP - get_voice() - are in silence, play frame (end of silence) + * ag - get_voicecase() - grow little bit (diff < interpl/2) + * aG - get_voicecase() - grow interpl + * as - get_voicecase() - shrink by voiceframe we throw out + * aS - get_voicecase() - shrink by interpl + * aN - get_voicecase() - no time yet + * aL - get_voicecase() - frame is late + * aP - get_voicecase() - play frame + * aI - get_voicecase() - interpolate + */ + +TDAV_END_DECLS + +#endif /* !(HAVE_SPEEX_DSP && HAVE_SPEEX_JB) */ + +#endif /* TINYDAV_JITTERBUFFER_H_ */ + diff --git a/tinyDAV/include/tinydav/audio/tdav_producer_audio.h b/tinyDAV/include/tinydav/audio/tdav_producer_audio.h new file mode 100644 index 0000000..47e0a4f --- /dev/null +++ b/tinyDAV/include/tinydav/audio/tdav_producer_audio.h @@ -0,0 +1,64 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +* +*/ + +/**@file tdav_producer_audio.h + * @brief Base class for all Audio producers. + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#ifndef TINYDAV_PRODUCER_AUDIO_H +#define TINYDAV_PRODUCER_AUDIO_H + +#include "tinydav_config.h" + +#include "tinymedia/tmedia_producer.h" + +TDAV_BEGIN_DECLS + +#define TDAV_BITS_PER_SAMPLE_DEFAULT 16 + +#define TDAV_PRODUCER_AUDIO(self) ((tdav_producer_audio_t*)(self)) + +typedef struct tdav_producer_audio_s +{ + TMEDIA_DECLARE_PRODUCER; +} +tdav_producer_audio_t; + +TINYDAV_API int tdav_producer_audio_init(tdav_producer_audio_t* self); +TINYDAV_API int tdav_producer_audio_cmp(const tsk_object_t* producer1, const tsk_object_t* producer2); +#define tdav_producer_audio_prepare(self, codec) tmedia_producer_prepare(TMEDIA_PRODUCER(self), codec) +#define tmedia_producer_audio_set_callback(self, callback, callback_data) tmedia_producer_set_callback(TMEDIA_PRODUCER(self), callback, callback_data) +#define tdav_producer_audio_start(self) tdav_producer_start(TMEDIA_PRODUCER(self)) +#define tdav_producer_audio_pause(self) tdav_producer_pause(TMEDIA_PRODUCER(self)) +#define tdav_producer_audio_stop(self) tdav_producer_stop(TMEDIA_PRODUCER(self)) +TINYDAV_API int tdav_producer_audio_set(tdav_producer_audio_t* self, const tmedia_param_t* param); +TINYDAV_API int tdav_producer_audio_deinit(tdav_producer_audio_t* self); + +#define TDAV_DECLARE_PRODUCER_AUDIO tdav_producer_audio_t __producer_audio__ + +TDAV_END_DECLS + +#endif /* TINYDAV_PRODUCER_AUDIO_H */ + diff --git a/tinyDAV/include/tinydav/audio/tdav_session_audio.h b/tinyDAV/include/tinydav/audio/tdav_session_audio.h new file mode 100644 index 0000000..e2ab66f --- /dev/null +++ b/tinyDAV/include/tinydav/audio/tdav_session_audio.h @@ -0,0 +1,96 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +* +*/ + +/**@file tdav_session_audio.h + * @brief Audio Session plugin. + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + */ +#ifndef TINYDAV_SESSION_AUDIO_H +#define TINYDAV_SESSION_AUDIO_H + +#include "tinydav_config.h" + +#include "tinydav/tdav_session_av.h" + +#include "tsk_timer.h" + +TDAV_BEGIN_DECLS + +typedef tsk_list_t tdav_session_audio_dtmfe_L_t; + +typedef struct tdav_session_audio_s +{ + TDAV_DECLARE_SESSION_AV; + + tsk_bool_t is_started; + + struct { + unsigned started:1; + tsk_timer_manager_handle_t* handle_mgr_global; + } timer; + + struct { + uint32_t payload_type; + struct tmedia_codec_s* codec; + + void* buffer; + tsk_size_t buffer_size; + + struct { + void* buffer; + tsk_size_t buffer_size; + struct tmedia_resampler_s* instance; + } resampler; + } encoder; + + struct { + uint32_t payload_type; + struct tmedia_codec_s* codec; + + void* buffer; + tsk_size_t buffer_size; + + struct { + void* buffer; + tsk_size_t buffer_size; + struct tmedia_resampler_s* instance; + } resampler; + } decoder; + + struct tmedia_denoise_s* denoise; + struct tmedia_jitterbuffer_s* jitterbuffer; + + tdav_session_audio_dtmfe_L_t* dtmf_events; + tsk_bool_t is_sending_dtmf_events; +} +tdav_session_audio_t; + +#define TDAV_SESSION_AUDIO(self) ((tdav_session_audio_t*)(self)) + +TINYDAV_GEXTERN const tmedia_session_plugin_def_t *tdav_session_audio_plugin_def_t; +TINYDAV_GEXTERN const tmedia_session_plugin_def_t *tdav_session_bfcpaudio_plugin_def_t; + +TDAV_END_DECLS + +#endif /* TINYDAV_SESSION_AUDIO_H */ diff --git a/tinyDAV/include/tinydav/audio/tdav_speakup_jitterbuffer.h b/tinyDAV/include/tinydav/audio/tdav_speakup_jitterbuffer.h new file mode 100644 index 0000000..e80c7b5 --- /dev/null +++ b/tinyDAV/include/tinydav/audio/tdav_speakup_jitterbuffer.h @@ -0,0 +1,62 @@ +/* +* Copyright (C) 2011 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +* +*/ + +/**@file tdav_speakup_JitterBuffer.h + * @brief Speakup audio JitterBuffer Plugin + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + */ +#ifndef TINYDAV_SPEAKUP_JITTER_BUFFER_H +#define TINYDAV_SPEAKUP_JITTER_BUFFER_H + +#include "tinydav_config.h" + +#if !(HAVE_SPEEX_DSP && HAVE_SPEEX_JB) + +#include "tinymedia/tmedia_jitterbuffer.h" + +#include "tinydav/audio/tdav_jitterbuffer.h" + +TDAV_BEGIN_DECLS + +/** Speakuo JitterBufferr*/ +typedef struct tdav_speakup_jitterBuffer_s +{ + TMEDIA_DECLARE_JITTER_BUFFER; + + jitterbuffer *jbuffer; + uint8_t jcodec; + uint64_t ref_timestamp; + uint32_t frame_duration; + uint32_t rate; + uint32_t channels; + uint32_t _10ms_size_bytes; +} +tdav_speakup_jitterbuffer_t; + +TINYDAV_GEXTERN const tmedia_jitterbuffer_plugin_def_t *tdav_speakup_jitterbuffer_plugin_def_t; + +TDAV_END_DECLS + +#endif /* !(HAVE_SPEEX_DSP && HAVE_SPEEX_JB) */ + +#endif /* TINYDAV_SPEAKUP_JITTER_BUFFER_H */ diff --git a/tinyDAV/include/tinydav/audio/tdav_speex_denoise.h b/tinyDAV/include/tinydav/audio/tdav_speex_denoise.h new file mode 100644 index 0000000..3271066 --- /dev/null +++ b/tinyDAV/include/tinydav/audio/tdav_speex_denoise.h @@ -0,0 +1,47 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +* +*/ + +/**@file tdav_speex_denoise.h + * @brief Speex Denoiser (Noise suppression, AGC, AEC) Plugin + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#ifndef TINYDAV_SPEEX_DENOISE_H +#define TINYDAV_SPEEX_DENOISE_H + +#include "tinydav_config.h" + +#if HAVE_SPEEX_DSP && (!defined(HAVE_SPEEX_DENOISE) || HAVE_SPEEX_DENOISE) + +#include "tinymedia/tmedia_denoise.h" + +TDAV_BEGIN_DECLS + +extern const tmedia_denoise_plugin_def_t *tdav_speex_denoise_plugin_def_t; + +TDAV_END_DECLS + +#endif /* #if HAVE_SPEEX_DSP */ + +#endif /* TINYDAV_SPEEX_DENOISE_H */ diff --git a/tinyDAV/include/tinydav/audio/tdav_speex_jitterbuffer.h b/tinyDAV/include/tinydav/audio/tdav_speex_jitterbuffer.h new file mode 100644 index 0000000..019db5d --- /dev/null +++ b/tinyDAV/include/tinydav/audio/tdav_speex_jitterbuffer.h @@ -0,0 +1,45 @@ +/* +* Copyright (C) 2011 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +* +*/ + +/**@file tdav_speex_JitterBuffer.h + * @brief Speex audio JitterBuffer Plugin + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + */ +#ifndef TINYDAV_SPEEX_JITTER_BUFFER_H +#define TINYDAV_SPEEX_JITTER_BUFFER_H + +#include "tinydav_config.h" + +#if HAVE_SPEEX_DSP && HAVE_SPEEX_JB + +#include "tinymedia/tmedia_jitterbuffer.h" + +TDAV_BEGIN_DECLS + +extern const tmedia_jitterbuffer_plugin_def_t *tdav_speex_jitterbuffer_plugin_def_t; + +TDAV_END_DECLS + +#endif /* #if HAVE_SPEEX_DSP */ + +#endif /* TINYDAV_SPEEX_JITTER_BUFFER_H */ diff --git a/tinyDAV/include/tinydav/audio/tdav_speex_resampler.h b/tinyDAV/include/tinydav/audio/tdav_speex_resampler.h new file mode 100644 index 0000000..635882d --- /dev/null +++ b/tinyDAV/include/tinydav/audio/tdav_speex_resampler.h @@ -0,0 +1,45 @@ +/* +* Copyright (C) 2011 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +* +*/ + +/**@file tdav_speex_resampler.h + * @brief Speex audio resampler Plugin + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + */ +#ifndef TINYDAV_SPEEX_RESAMPLER_H +#define TINYDAV_SPEEX_RESAMPLER_H + +#include "tinydav_config.h" + +#if HAVE_SPEEX_DSP && (!defined(HAVE_SPEEX_RESAMPLER) || HAVE_SPEEX_RESAMPLER) + +#include "tinymedia/tmedia_resampler.h" + +TDAV_BEGIN_DECLS + +extern const tmedia_resampler_plugin_def_t *tdav_speex_resampler_plugin_def_t; + +TDAV_END_DECLS + +#endif /* #if HAVE_SPEEX_DSP */ + +#endif /* TINYDAV_SPEEX_RESAMPLER_H */ diff --git a/tinyDAV/include/tinydav/audio/tdav_webrtc_denoise.h b/tinyDAV/include/tinydav/audio/tdav_webrtc_denoise.h new file mode 100644 index 0000000..7c5e956 --- /dev/null +++ b/tinyDAV/include/tinydav/audio/tdav_webrtc_denoise.h @@ -0,0 +1,90 @@ +/* +* Copyright (C) 2011 Doubango Telecom <http://www.doubango.org> +* +* Contact: Mamadou Diop <diopmamadou(at)doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +* +*/ + +/**@file tdav_webrtc_denoise.h + * @brief Google WebRTC Denoiser (Noise suppression, AGC, AEC) Plugin + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#ifndef TINYDAV_WEBRTC_DENOISE_H +#define TINYDAV_WEBRTC_DENOISE_H + +#include "tinydav_config.h" + +#if HAVE_WEBRTC && (!defined(HAVE_WEBRTC_DENOISE) || HAVE_WEBRTC_DENOISE) + +#include "tinymedia/tmedia_denoise.h" + +#include "tsk_safeobj.h" + +/* Speex denoiser works better than WebRTC's denoiser. This is obvious on Android. */ +#if !defined(PREFER_SPEEX_DENOISER) +# define PREFER_SPEEX_DENOISER 1 +#endif + +#if TDAV_UNDER_MOBILE +# include <webrtc/echo_control_mobile.h> +# define TDAV_WebRtcAec_Create(aecInst) WebRtcAecm_Create(aecInst) +# define TDAV_WebRtcAec_Free(aecInst) WebRtcAecm_Free(aecInst) +# define TDAV_WebRtcAec_Init(aecInst, sampFreq, scSampFreq) WebRtcAecm_Init(aecInst, sampFreq) +# define TDAV_WebRtcAec_BufferFarend(aecInst, farend, nrOfSamples) WebRtcAecm_BufferFarend(aecInst, farend, nrOfSamples) +# define TDAV_WebRtcAec_Process(aecInst, nearend, nearendH, out, outH, nrOfSamples, msInSndCardBuf, skew) WebRtcAecm_Process(aecInst, nearend, nearend, out, nrOfSamples, msInSndCardBuf) +#else +# include <webrtc/echo_cancellation.h> +# define TDAV_WebRtcAec_Create(aecInst) WebRtcAec_Create(aecInst) +# define TDAV_WebRtcAec_Free(aecInst) WebRtcAec_Free(aecInst) +# define TDAV_WebRtcAec_Init(aecInst, sampFreq, scSampFreq) WebRtcAec_Init(aecInst, sampFreq, scSampFreq) +# define TDAV_WebRtcAec_BufferFarend(aecInst, farend, nrOfSamples) WebRtcAec_BufferFarend(aecInst, farend, nrOfSamples) +# define TDAV_WebRtcAec_Process(aecInst, nearend, nearendH, out, outH, nrOfSamples, msInSndCardBuf, skew) WebRtcAec_Process(aecInst, nearend, nearendH, out, outH, nrOfSamples, msInSndCardBuf, skew) +#endif + +#if HAVE_SPEEX_DSP && PREFER_SPEEX_DENOISER +# include <speex/speex_preprocess.h> +#else +# if TDAV_UNDER_MOBILE // Use fixed implementation for Noise Suppression +# include <webrtc/noise_suppression_x.h> +# define TDAV_WebRtcNs_Process(NS_inst, spframe, spframe_H, outframe, outframe_H) WebRtcNsx_Process(NS_inst, spframe, spframe_H, outframe, outframe_H) +# define TDAV_WebRtcNs_Init(NS_inst, fs) WebRtcNsx_Init(NS_inst, fs) +# define TDAV_WebRtcNs_Free(NS_inst) WebRtcNsx_Free(NS_inst) +# define TDAV_WebRtcNs_Create(NS_inst) WebRtcNsx_Create(NS_inst) +# define TDAV_NsHandle NsxHandle +# else +# include <webrtc/noise_suppression.h> +# define TDAV_WebRtcNs_Process(NS_inst, spframe, spframe_H, outframe, outframe_H) WebRtcNs_Process(NS_inst, spframe, spframe_H, outframe, outframe_H) +# define TDAV_WebRtcNs_Init(NS_inst, fs) WebRtcNs_Init(NS_inst, fs) +# define TDAV_WebRtcNs_Free(NS_inst) WebRtcNs_Free(NS_inst) +# define TDAV_WebRtcNs_Create(NS_inst) WebRtcNs_Create(NS_inst) +# define TDAV_NsHandle NsHandle +# endif +#endif + +TDAV_BEGIN_DECLS + +extern const tmedia_denoise_plugin_def_t *tdav_webrtc_denoise_plugin_def_t; + +TDAV_END_DECLS + +#endif /* #if HAVE_WEBRTC */ + +#endif /* TINYDAV_WEBRTC_DENOISE_H */ diff --git a/tinyDAV/include/tinydav/audio/wasapi/tdav_consumer_wasapi.h b/tinyDAV/include/tinydav/audio/wasapi/tdav_consumer_wasapi.h new file mode 100644 index 0000000..0da22e8 --- /dev/null +++ b/tinyDAV/include/tinydav/audio/wasapi/tdav_consumer_wasapi.h @@ -0,0 +1,39 @@ +/*Copyright (C) 2013 Doubango Telecom <http://www.doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +*/ +/**@file tdav_consumer_wasapi.h + * @brief Microsoft Windows Audio Session API (WASAPI) consumer. + * + */ +#ifndef TINYDAV_CONSUMER_WASAPI_H +#define TINYDAV_CONSUMER_WASAPI_H + +#include "tinydav_config.h" + +#if HAVE_WASAPI + +#include "tinydav/audio/tdav_consumer_audio.h" + +TDAV_BEGIN_DECLS + +TINYDAV_GEXTERN const struct tmedia_consumer_plugin_def_s *tdav_consumer_wasapi_plugin_def_t; + +TDAV_END_DECLS + +#endif /* HAVE_WASAPI */ + +#endif /* TINYDAV_CONSUMER_WASAPI_H */ diff --git a/tinyDAV/include/tinydav/audio/wasapi/tdav_producer_wasapi.h b/tinyDAV/include/tinydav/audio/wasapi/tdav_producer_wasapi.h new file mode 100644 index 0000000..e215769 --- /dev/null +++ b/tinyDAV/include/tinydav/audio/wasapi/tdav_producer_wasapi.h @@ -0,0 +1,40 @@ +/*Copyright (C) 2013 Mamadou Diop +* Copyright (C) 2013 Doubango Telecom <http://www.doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +*/ +/**@file tdav_producer_wasapi.h + * @brief Microsoft Windows Audio Session API (WASAPI) producer. + * + */ +#ifndef TINYDAV_PRODUCER_WASAPI_H +#define TINYDAV_PRODUCER_WASAPI_H + +#include "tinydav_config.h" + +#if HAVE_WASAPI + +#include "tinydav/audio/tdav_producer_audio.h" + +TDAV_BEGIN_DECLS + +TINYDAV_GEXTERN const struct tmedia_producer_plugin_def_s *tdav_producer_wasapi_plugin_def_t; + +TDAV_END_DECLS + +#endif /* HAVE_WASAPI */ + +#endif /* TINYDAV_PRODUCER_WASAPI_H */ diff --git a/tinyDAV/include/tinydav/audio/waveapi/tdav_consumer_waveapi.h b/tinyDAV/include/tinydav/audio/waveapi/tdav_consumer_waveapi.h new file mode 100644 index 0000000..7e136cd --- /dev/null +++ b/tinyDAV/include/tinydav/audio/waveapi/tdav_consumer_waveapi.h @@ -0,0 +1,68 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +* +*/ + +/**@file tdav_consumer_waveapi.h + * @brief Audio Consumer for Win32 and WinCE platforms. + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#ifndef TINYDAV_CONSUMER_WAVEAPI_H +#define TINYDAV_CONSUMER_WAVEAPI_H + +#include "tinydav_config.h" + +#if HAVE_WAVE_API + +#include "tinydav/audio/tdav_consumer_audio.h" + +#include <windows.h> + +TDAV_BEGIN_DECLS + +#define TDAV_WAVEAPI_CONSUMER_NOTIF_POS_COUNT 4 + +typedef struct tdav_consumer_waveapi_s +{ + TDAV_DECLARE_CONSUMER_AUDIO; + + tsk_bool_t started; + + WAVEFORMATEX wfx; + HWAVEOUT hWaveOut; + LPWAVEHDR hWaveHeaders[TDAV_WAVEAPI_CONSUMER_NOTIF_POS_COUNT]; + tsk_size_t bytes_per_notif; + + void* tid[1]; + HANDLE events[2]; + CRITICAL_SECTION cs; +} +tdav_consumer_waveapi_t; + +TINYDAV_GEXTERN const tmedia_consumer_plugin_def_t *tdav_consumer_waveapi_plugin_def_t; + +TDAV_END_DECLS + +#endif /* HAVE_WAVE_API */ + +#endif /* TINYDAV_CONSUMER_WAVEAPI_H */ diff --git a/tinyDAV/include/tinydav/audio/waveapi/tdav_producer_waveapi.h b/tinyDAV/include/tinydav/audio/waveapi/tdav_producer_waveapi.h new file mode 100644 index 0000000..67614cf --- /dev/null +++ b/tinyDAV/include/tinydav/audio/waveapi/tdav_producer_waveapi.h @@ -0,0 +1,68 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +* +*/ + +/**@file tdav_producer_waveapi.h + * @brief Audio Consumer for Win32 and WinCE platforms. + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#ifndef TINYDAV_PRODUCER_WAVEAPI_H +#define TINYDAV_PRODUCER_WAVEAPI_H + +#include "tinydav_config.h" + +#if HAVE_WAVE_API + +#include "tinydav/audio/tdav_producer_audio.h" + +#include <windows.h> + +TDAV_BEGIN_DECLS + +#define TDAV_WAVEAPI_PRODUCER_NOTIF_POS_COUNT 4 + +typedef struct tdav_producer_waveapi_s +{ + TDAV_DECLARE_PRODUCER_AUDIO; + + tsk_bool_t started; + + WAVEFORMATEX wfx; + HWAVEIN hWaveIn; + LPWAVEHDR hWaveHeaders[TDAV_WAVEAPI_PRODUCER_NOTIF_POS_COUNT]; + tsk_size_t bytes_per_notif; + + void* tid[1]; + HANDLE events[2]; + CRITICAL_SECTION cs; +} +tdav_producer_waveapi_t; + +TINYDAV_GEXTERN const tmedia_producer_plugin_def_t *tdav_producer_waveapi_plugin_def_t; + +TDAV_END_DECLS + +#endif /* HAVE_WAVE_API */ + +#endif /* TINYDAV_PRODUCER_WAVEAPI_H */ diff --git a/tinyDAV/include/tinydav/bfcp/tdav_session_bfcp.h b/tinyDAV/include/tinydav/bfcp/tdav_session_bfcp.h new file mode 100644 index 0000000..5fbc057 --- /dev/null +++ b/tinyDAV/include/tinydav/bfcp/tdav_session_bfcp.h @@ -0,0 +1,40 @@ +/* Copyright (C) 2014 Mamadou DIOP. +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +* +*/ + +/**@file tdav_session_bfcp.h + * @brief The The Binary Floor Control Protocol (BFCP, rfc4582) session. + */ + +#ifndef TINYDAV_SESSION_BFCP_H +#define TINYDAV_SESSION_BFCP_H + +#include "tinydav_config.h" + +#if !defined(HAVE_TINYBFCP) || HAVE_TINYBFCP +#include "tinymedia/tmedia_session.h" + +TDAV_BEGIN_DECLS + +TINYDAV_GEXTERN const tmedia_session_plugin_def_t *tdav_session_bfcp_plugin_def_t; + +TDAV_END_DECLS + +#endif /* !defined(HAVE_TINYBFCP) || HAVE_TINYBFCP */ + +#endif /* TINYDAV_SESSION_BFCP_H */ diff --git a/tinyDAV/include/tinydav/codecs/amr/tdav_codec_amr.h b/tinyDAV/include/tinydav/codecs/amr/tdav_codec_amr.h new file mode 100644 index 0000000..cb0e33e --- /dev/null +++ b/tinyDAV/include/tinydav/codecs/amr/tdav_codec_amr.h @@ -0,0 +1,95 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +* +*/ + +/**@file tdav_codec_amr.h + * @brief AMR-NB and AMR-WB codecs. + * RTP payloader/depayloader are based on RFC 4867 + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#ifndef TINYDAV_CODEC_AMR_H +#define TINYDAV_CODEC_AMR_H + +#include "tinydav_config.h" + +#if HAVE_OPENCORE_AMR + +#include "tinymedia/tmedia_codec.h" + +#include <opencore-amrnb/interf_dec.h> +#include <opencore-amrnb/interf_enc.h> + +TDAV_BEGIN_DECLS + +#define TDAV_CODEC_AMR(self) ((tdav_codec_amr_t*)(self)) + +typedef enum tdav_codec_amr_type_e +{ + tdav_codec_amr_type_nb, + tdav_codec_amr_type_wb, +} +tdav_codec_amr_type_t; + +typedef enum tdav_codec_amr_mode_e +{ + tdav_codec_amr_mode_oa, + tdav_codec_amr_mode_be, +} +tdav_codec_amr_mode_t; + +/** Base class for all AMR codecs */ +typedef struct tdav_codec_amr_s +{ + TMEDIA_DECLARE_CODEC_AUDIO; + + tdav_codec_amr_type_t type; + tdav_codec_amr_mode_t mode; + + enum Mode encoder_mode; + void* encoder; + void* decoder; + + unsigned modes:16; /**< 0..7 for NB and 0..8 for WB plus SID, SPEECH_LOST, NO_DATA etc etc */ + unsigned mcp:2; /**< mode-change-periode (1 or 2) */ + unsigned mcc:2; /**< mode-change-capability (1 or 2) */ + unsigned mcn:1; /**< mode-change-neighnor (0 or 1) */ + unsigned crc:1; /**< 0 or 1 */ + unsigned robust_sorting:1; /**< robust-sorting (0 or 1) */ +} +tdav_codec_amr_t; + +#define TDAV_DECLARE_CODEC_AMR tdav_codec_amr_t __codec_amr__ + + +TINYDAV_GEXTERN const tmedia_codec_plugin_def_t *tdav_codec_amrnb_oa_plugin_def_t; +TINYDAV_GEXTERN const tmedia_codec_plugin_def_t *tdav_codec_amrnb_be_plugin_def_t; + +TINYDAV_GEXTERN const tmedia_codec_plugin_def_t *tdav_codec_amrwb_oa_plugin_def_t; +TINYDAV_GEXTERN const tmedia_codec_plugin_def_t *tdav_codec_amrwb_be_plugin_def_t; + +TDAV_END_DECLS + +#endif /* HAVE_OPENCORE_AMR */ + +#endif /* TINYDAV_CODEC_AMR_H */ diff --git a/tinyDAV/include/tinydav/codecs/bfcp/tdav_codec_bfcp.h b/tinyDAV/include/tinydav/codecs/bfcp/tdav_codec_bfcp.h new file mode 100644 index 0000000..e0a0dca --- /dev/null +++ b/tinyDAV/include/tinydav/codecs/bfcp/tdav_codec_bfcp.h @@ -0,0 +1,44 @@ +/* +* Copyright (C) 2014 Mamadou DIOP. +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +* +*/ + +/**@file tdav_codec_bfcp.h + * @brief The The Binary Floor Control Protocol (BFCP, rfc4582) session. + */ +#ifndef TINYDAV_CODEC_BFCP_H +#define TINYDAV_CODEC_BFCP_H + +#include "tinydav_config.h" + +#include "tinymedia/tmedia_codec.h" + +TDAV_BEGIN_DECLS + +/** BFCP codec */ +typedef struct tdav_codec_bfcp_s +{ + TMEDIA_DECLARE_CODEC_BFCP; +} +tdav_codec_bfcp_t; + +TINYDAV_GEXTERN const tmedia_codec_plugin_def_t *tdav_codec_bfcp_plugin_def_t; + +TDAV_END_DECLS + +#endif /* TINYDAV_CODEC_BFCP_H */ diff --git a/tinyDAV/include/tinydav/codecs/bv/tdav_codec_bv16.h b/tinyDAV/include/tinydav/codecs/bv/tdav_codec_bv16.h new file mode 100644 index 0000000..3790a71 --- /dev/null +++ b/tinyDAV/include/tinydav/codecs/bv/tdav_codec_bv16.h @@ -0,0 +1,67 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +* +*/ + +/**@file tdav_codec_bv16.h + * @brief BroadVoice16 codec + * The payloader/depayloader follow RFC 4298 + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#ifndef TINYDAV_CODEC_BV16_H +#define TINYDAV_CODEC_BV16_H + +#include "tinydav_config.h" + +#if HAVE_BV16 + +#include "tinymedia/tmedia_codec.h" + + +TDAV_BEGIN_DECLS + +/** BV16 codec */ +typedef struct tdav_codec_bv16_s +{ + TMEDIA_DECLARE_CODEC_AUDIO; + + struct { + void *state; + void *bs; + void *x; + } encoder; + + struct { + void *state; + void *bs; + void *x; + } decoder; +} +tdav_codec_bv16_t; + +TINYDAV_GEXTERN const tmedia_codec_plugin_def_t *tdav_codec_bv16_plugin_def_t; + +TDAV_END_DECLS + +#endif /* HAVE_BV16 */ + +#endif /* TINYDAV_CODEC_BV16_H */ diff --git a/tinyDAV/include/tinydav/codecs/bv/tdav_codec_bv32.h b/tinyDAV/include/tinydav/codecs/bv/tdav_codec_bv32.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tinyDAV/include/tinydav/codecs/bv/tdav_codec_bv32.h diff --git a/tinyDAV/include/tinydav/codecs/dtmf/tdav_codec_dtmf.h b/tinyDAV/include/tinydav/codecs/dtmf/tdav_codec_dtmf.h new file mode 100644 index 0000000..6082de7 --- /dev/null +++ b/tinyDAV/include/tinydav/codecs/dtmf/tdav_codec_dtmf.h @@ -0,0 +1,49 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +* +*/ + +/**@file tdav_codec_dtmf.h + * @brief DTMF (RFC 4733) codec plugins. + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#ifndef TINYDAV_CODEC_DTMF_H +#define TINYDAV_CODEC_DTMF_H + +#include "tinydav_config.h" + +#include "tinymedia/tmedia_codec.h" + +TDAV_BEGIN_DECLS + +typedef struct tdav_codec_dtmf_s +{ + TMEDIA_DECLARE_CODEC_AUDIO; +} +tdav_codec_dtmf_t; + +TINYDAV_GEXTERN const tmedia_codec_plugin_def_t *tdav_codec_dtmf_plugin_def_t; + +TDAV_END_DECLS + +#endif /* TINYDAV_CODEC_DTMF_H */ diff --git a/tinyDAV/include/tinydav/codecs/fec/tdav_codec_red.h b/tinyDAV/include/tinydav/codecs/fec/tdav_codec_red.h new file mode 100644 index 0000000..80659b8 --- /dev/null +++ b/tinyDAV/include/tinydav/codecs/fec/tdav_codec_red.h @@ -0,0 +1,49 @@ +/* +* Copyright (C) 2012 Doubango Telecom <http://www.doubango.org> +* +* Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +* +*/ + +/**@file tdav_codec_red.h + * @brief RTP Payload for Redundant Audio Data as per RFC 2198 + */ +#ifndef TINYDAV_CODEC_RED_H +#define TINYDAV_CODEC_RED_H + +#include "tinydav_config.h" + +#include "tinymedia/tmedia_codec.h" + +TDAV_BEGIN_DECLS + +#define TDAV_CODEC_RED_MIN_PKT_SIZE 4 + +struct trtp_rtp_packet_s; +struct tdav_codec_red_s; + +/** callback for redundant data */ +typedef int (*tdav_codec_red_rtppacket_cb_f)(const void* callback_data, const struct trtp_rtp_packet_s* packet); + +int tdav_codec_red_set_callback(struct tdav_codec_red_s *self, tdav_codec_red_rtppacket_cb_f callback, const void* callback_data); + +TINYDAV_GEXTERN const tmedia_codec_plugin_def_t *tdav_codec_red_plugin_def_t; + +TDAV_END_DECLS + +#endif /* TINYDAV_CODEC_RED_H */ diff --git a/tinyDAV/include/tinydav/codecs/fec/tdav_codec_ulpfec.h b/tinyDAV/include/tinydav/codecs/fec/tdav_codec_ulpfec.h new file mode 100644 index 0000000..bfd9a50 --- /dev/null +++ b/tinyDAV/include/tinydav/codecs/fec/tdav_codec_ulpfec.h @@ -0,0 +1,46 @@ +/* +* Copyright (C) 2012 Doubango Telecom <http://www.doubango.org> +* +* Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +* +*/ + +/**@file tdav_codec_ulpfec.h + * @brief Forward Error Correction (FEC) implementation as per RFC 5109 + */ +#ifndef TINYDAV_CODEC_ULPFEC_H +#define TINYDAV_CODEC_ULPFEC_H + +#include "tinydav_config.h" + +#include "tinymedia/tmedia_codec.h" + +TDAV_BEGIN_DECLS + +struct tdav_codec_ulpfec_s; +struct trtp_rtp_packet_s; + +int tdav_codec_ulpfec_enc_reset(struct tdav_codec_ulpfec_s* self); +int tdav_codec_ulpfec_enc_protect(struct tdav_codec_ulpfec_s* self, const struct trtp_rtp_packet_s* rtp_packet); +tsk_size_t tdav_codec_ulpfec_enc_serialize(const struct tdav_codec_ulpfec_s* self, void** out_data, tsk_size_t* out_max_size); + +TINYDAV_GEXTERN const tmedia_codec_plugin_def_t *tdav_codec_ulpfec_plugin_def_t; + +TDAV_END_DECLS + +#endif /* TINYDAV_CODEC_ULPFEC_H */
\ No newline at end of file diff --git a/tinyDAV/include/tinydav/codecs/g711/g711.h b/tinyDAV/include/tinydav/codecs/g711/g711.h new file mode 100644 index 0000000..cb79793 --- /dev/null +++ b/tinyDAV/include/tinydav/codecs/g711/g711.h @@ -0,0 +1,44 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +* +*/ + +/**@file tdav_codec_g711.h + * @brief G.711u and G.711a (a.k.a PCMU and PCMA) codec plugins. + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#ifndef TINYDAV_CODEC_G711_IMPLEMENTATION_H +#define TINYDAV_CODEC_G711_IMPLEMENTATION_H + +#include "tinydav_config.h" + +TDAV_BEGIN_DECLS + +unsigned char linear2alaw(short pcm_val); +short alaw2linear(unsigned char a_val); +unsigned char linear2ulaw(short pcm_val); +short ulaw2linear(unsigned char u_val); + +TDAV_END_DECLS + +#endif /* TINYDAV_CODEC_G711_IMPLEMENTATION_H */ diff --git a/tinyDAV/include/tinydav/codecs/g711/tdav_codec_g711.h b/tinyDAV/include/tinydav/codecs/g711/tdav_codec_g711.h new file mode 100644 index 0000000..3343636 --- /dev/null +++ b/tinyDAV/include/tinydav/codecs/g711/tdav_codec_g711.h @@ -0,0 +1,58 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +* +*/ + +/**@file tdav_codec_g711.h + * @brief G.711u and G.711a (a.k.a PCMU and PCMA) codec plugins. + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + */ +#ifndef TINYDAV_CODEC_G711_H +#define TINYDAV_CODEC_G711_H + +#include "tinydav_config.h" + +#include "tinymedia/tmedia_codec.h" + +TDAV_BEGIN_DECLS + +/** G.711u codec */ +typedef struct tdav_codec_g711u_s +{ + TMEDIA_DECLARE_CODEC_AUDIO; +} +tdav_codec_g711u_t; + +/** G.711a codec */ +typedef struct tdav_codec_g711a_s +{ + TMEDIA_DECLARE_CODEC_AUDIO; +} +tdav_codec_g711a_t; + + +TINYDAV_GEXTERN const tmedia_codec_plugin_def_t *tdav_codec_g711a_plugin_def_t; +TINYDAV_GEXTERN const tmedia_codec_plugin_def_t *tdav_codec_g711u_plugin_def_t; + +TDAV_END_DECLS + +#endif /* TINYDAV_CODEC_G711_H */ diff --git a/tinyDAV/include/tinydav/codecs/g722/g722_enc_dec.h b/tinyDAV/include/tinydav/codecs/g722/g722_enc_dec.h new file mode 100644 index 0000000..efa45ec --- /dev/null +++ b/tinyDAV/include/tinydav/codecs/g722/g722_enc_dec.h @@ -0,0 +1,156 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * g722.h - The ITU G.722 codec. + * + * Written by Steve Underwood <steveu@coppice.org> + * + * Copyright (C) 2005 Steve Underwood + * + * Despite my general liking of the GPL, I place my own contributions + * to this code in the public domain for the benefit of all mankind - + * even the slimy ones who might try to proprietize my work and use it + * to my detriment. + * + * Based on a single channel G.722 codec which is: + * + ***** Copyright (c) CMU 1993 ***** + * Computer Science, Speech Group + * Chengxiang Lu and Alex Hauptmann + * + * $Id: g722.h,v 1.10 2006/06/16 12:45:53 steveu Exp $ + * + * Modifications for WebRtc, 2011/04/28, by tlegrand: + * -Changed to use WebRtc types + * -Added new defines for minimum and maximum values of short int + */ + + +/*! \file */ + +#if !defined(_G722_ENC_DEC_H_) +#define _G722_ENC_DEC_H_ + +#include "tinydav_config.h" + +/*! \page g722_page G.722 encoding and decoding +\section g722_page_sec_1 What does it do? +The G.722 module is a bit exact implementation of the ITU G.722 specification for all three +specified bit rates - 64000bps, 56000bps and 48000bps. It passes the ITU tests. + +To allow fast and flexible interworking with narrow band telephony, the encoder and decoder +support an option for the linear audio to be an 8k samples/second stream. In this mode the +codec is considerably faster, and still fully compatible with wideband terminals using G.722. + +\section g722_page_sec_2 How does it work? +???. +*/ + +#define TDAV_INT16_MAX 32767 +#define TDAV_INT16_MIN -32768 + +enum +{ + G722_SAMPLE_RATE_8000 = 0x0001, + G722_PACKED = 0x0002 +}; + +typedef struct +{ + /*! TRUE if the operating in the special ITU test mode, with the band split filters + disabled. */ + int itu_test_mode; + /*! TRUE if the G.722 data is packed */ + int packed; + /*! TRUE if encode from 8k samples/second */ + int eight_k; + /*! 6 for 48000kbps, 7 for 56000kbps, or 8 for 64000kbps. */ + int bits_per_sample; + + /*! Signal history for the QMF */ + int x[24]; + + struct + { + int s; + int sp; + int sz; + int r[3]; + int a[3]; + int ap[3]; + int p[3]; + int d[7]; + int b[7]; + int bp[7]; + int sg[7]; + int nb; + int det; + } band[2]; + + unsigned int in_buffer; + int in_bits; + unsigned int out_buffer; + int out_bits; +} g722_encode_state_t; + +typedef struct +{ + /*! TRUE if the operating in the special ITU test mode, with the band split filters + disabled. */ + int itu_test_mode; + /*! TRUE if the G.722 data is packed */ + int packed; + /*! TRUE if decode to 8k samples/second */ + int eight_k; + /*! 6 for 48000kbps, 7 for 56000kbps, or 8 for 64000kbps. */ + int bits_per_sample; + + /*! Signal history for the QMF */ + int x[24]; + + struct + { + int s; + int sp; + int sz; + int r[3]; + int a[3]; + int ap[3]; + int p[3]; + int d[7]; + int b[7]; + int bp[7]; + int sg[7]; + int nb; + int det; + } band[2]; + + unsigned int in_buffer; + int in_bits; + unsigned int out_buffer; + int out_bits; +} g722_decode_state_t; + +#ifdef __cplusplus +extern "C" { +#endif + +g722_encode_state_t *g722_encode_init(g722_encode_state_t *s, int rate, int options); +int g722_encode_release(g722_encode_state_t *s); +int g722_encode(g722_encode_state_t *s, + uint8_t g722_data[], + const int16_t amp[], + int len); + +g722_decode_state_t *g722_decode_init(g722_decode_state_t *s, int rate, int options); +int g722_decode_release(g722_decode_state_t *s); +int g722_decode(g722_decode_state_t *s, + int16_t amp[], + const uint8_t g722_data[], + int len); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/tinyDAV/include/tinydav/codecs/g722/tdav_codec_g722.h b/tinyDAV/include/tinydav/codecs/g722/tdav_codec_g722.h new file mode 100644 index 0000000..6484022 --- /dev/null +++ b/tinyDAV/include/tinydav/codecs/g722/tdav_codec_g722.h @@ -0,0 +1,44 @@ +/* +* Copyright (C) 2011 Doubango Telecom <http://www.doubango.org> +* +* Contact: Mamadou Diop <diopmamadou(at)doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +* +*/ + +/**@file tdav_codec_g722.h + * @brief G.722 codec plugins. + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + */ +#ifndef TINYDAV_CODEC_G722_H +#define TINYDAV_CODEC_G722_H + +#include "tinydav_config.h" + +#include "tinydav/codecs/g722/g722_enc_dec.h" + +#include "tinymedia/tmedia_codec.h" + +TDAV_BEGIN_DECLS + +TINYDAV_GEXTERN const tmedia_codec_plugin_def_t *tdav_codec_g722_plugin_def_t; + +TDAV_END_DECLS + +#endif /* TINYDAV_CODEC_G722_H */ diff --git a/tinyDAV/include/tinydav/codecs/g729/tdav_codec_g729.h b/tinyDAV/include/tinydav/codecs/g729/tdav_codec_g729.h new file mode 100644 index 0000000..3b4ec05 --- /dev/null +++ b/tinyDAV/include/tinydav/codecs/g729/tdav_codec_g729.h @@ -0,0 +1,79 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +* +*/ + +/**@file tdav_codec_g729.h + * @brief G729a codec. + * Source from: http://www.itu.int/rec/T-REC-G.729-199611-S!AnnA/en + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + */ +#ifndef TINYDAV_CODEC_G729_H +#define TINYDAV_CODEC_G729_H + +#include "tinydav_config.h" + +#if HAVE_G729 + +#include "tinymedia/tmedia_codec.h" + +#include "g729b/typedef.h" +#include "g729b/ld8a.h" + + +TDAV_BEGIN_DECLS + +/** G.729abb codec */ +typedef struct tdav_codec_g729ab_s +{ + TMEDIA_DECLARE_CODEC_AUDIO; + + struct{ + Word16 prm[PRM_SIZE+1]; /* Analysis parameters + frame type */ + Word16 serial[SERIAL_SIZE]; /* Output bitstream buffer */ + + Word16 frame; /* frame counter */ + + /* For G.729B */ + Word16 vad_enable; + } encoder; + + struct{ + Word16 serial[SERIAL_SIZE]; /* Serial stream */ + Word16 synth_buf[L_FRAME+M], *synth; /* Synthesis */ + Word16 parm[PRM_SIZE+2]; /* Synthesis parameters */ + Word16 Az_dec[MP1*2]; /* Decoded Az for post-filter */ + Word16 T2[2]; /* Pitch lag for 2 subframes */ + + /* For G.729B */ + Word16 Vad; + } decoder; +} +tdav_codec_g729ab_t; + +TINYDAV_GEXTERN const tmedia_codec_plugin_def_t *tdav_codec_g729ab_plugin_def_t; + +TDAV_END_DECLS + +#endif /* TINYDAV_CODEC_G729_H */ + +#endif diff --git a/tinyDAV/include/tinydav/codecs/gsm/tdav_codec_gsm.h b/tinyDAV/include/tinydav/codecs/gsm/tdav_codec_gsm.h new file mode 100644 index 0000000..1fff744 --- /dev/null +++ b/tinyDAV/include/tinydav/codecs/gsm/tdav_codec_gsm.h @@ -0,0 +1,59 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +* +*/ + +/**@file tdav_codec_gsm.h + * @brief GSM Full Rate Codec (Based on libgsm) + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#ifndef TINYDAV_CODEC_GSM_H +#define TINYDAV_CODEC_GSM_H + +#include "tinydav_config.h" + +#if HAVE_LIBGSM + +#include "tinymedia/tmedia_codec.h" + +#include <gsm.h> + +TDAV_BEGIN_DECLS + +/** GSM codec */ +typedef struct tdav_codec_gsm_s +{ + TMEDIA_DECLARE_CODEC_AUDIO; + + gsm encoder; + gsm decoder; +} +tdav_codec_gsm_t; + +TINYDAV_GEXTERN const tmedia_codec_plugin_def_t *tdav_codec_gsm_plugin_def_t; + +TDAV_END_DECLS + +#endif /* HAVE_LIBGSM */ + +#endif /* TINYDAV_CODEC_GSM_H */ diff --git a/tinyDAV/include/tinydav/codecs/h261/tdav_codec_h261.h b/tinyDAV/include/tinydav/codecs/h261/tdav_codec_h261.h new file mode 100644 index 0000000..7f66a3a --- /dev/null +++ b/tinyDAV/include/tinydav/codecs/h261/tdav_codec_h261.h @@ -0,0 +1,87 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +* +*/ + +/**@file tdav_codec_h261.h + * @brief H.261 codec plugin. + * RTP payloader follows RFC 4587 + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#ifndef TINYDAV_CODEC_H261_H +#define TINYDAV_CODEC_H261_H + +#include "tinydav_config.h" + +#if HAVE_FFMPEG + +#include "tinymedia/tmedia_codec.h" + +#include <libavcodec/avcodec.h> + +TDAV_BEGIN_DECLS + +#define TDAV_CODEC_H261(self) ((tdav_codec_h261_t*)(self)) + +/** H.2261 codec */ +typedef struct tdav_codec_h261_s +{ + TMEDIA_DECLARE_CODEC_VIDEO; + + struct{ + uint8_t* ptr; + tsk_size_t size; + } rtp; + + // Encoder + struct{ + AVCodec* codec; + AVCodecContext* context; + AVFrame* picture; + void* buffer; + } encoder; + + // decoder + struct{ + AVCodec* codec; + AVCodecContext* context; + AVFrame* picture; + + void* accumulator; + uint8_t ebit; + tsk_size_t accumulator_pos; + uint16_t last_seq; + } decoder; +} +tdav_codec_h261_t; + +TINYDAV_GEXTERN const tmedia_codec_plugin_def_t *tdav_codec_h261_plugin_def_t; + +tsk_bool_t tdav_codec_ffmpeg_h261_is_supported(); + +TDAV_END_DECLS + + +#endif /* HAVE_FFMPEG */ + +#endif /* TINYDAV_CODEC_H261_H */ diff --git a/tinyDAV/include/tinydav/codecs/h263/tdav_codec_h263.h b/tinyDAV/include/tinydav/codecs/h263/tdav_codec_h263.h new file mode 100644 index 0000000..6a2880f --- /dev/null +++ b/tinyDAV/include/tinydav/codecs/h263/tdav_codec_h263.h @@ -0,0 +1,56 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +* +*/ + +/**@file tdav_codec_h263.h + * @brief H.263-1996 and H.263-1998 codec plugins. + * RTP payloader follows RFC 4629 for H263+ and RFC 2190 for H263. + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#ifndef TINYDAV_CODEC_H263_H +#define TINYDAV_CODEC_H263_H + +#include "tinydav_config.h" + +#if HAVE_FFMPEG + +#include "tinymedia/tmedia_codec.h" + +TDAV_BEGIN_DECLS + + +TINYDAV_GEXTERN const tmedia_codec_plugin_def_t *tdav_codec_h263_plugin_def_t; +TINYDAV_GEXTERN const tmedia_codec_plugin_def_t *tdav_codec_h263p_plugin_def_t; +TINYDAV_GEXTERN const tmedia_codec_plugin_def_t *tdav_codec_h263pp_plugin_def_t; + +tsk_bool_t tdav_codec_ffmpeg_h263_is_supported(); +tsk_bool_t tdav_codec_ffmpeg_h263p_is_supported(); +tsk_bool_t tdav_codec_ffmpeg_h263pp_is_supported(); + +TDAV_END_DECLS + + +#endif /* HAVE_FFMPEG */ + +#endif /* TINYDAV_CODEC_H263_H */ diff --git a/tinyDAV/include/tinydav/codecs/h264/tdav_codec_h264.h b/tinyDAV/include/tinydav/codecs/h264/tdav_codec_h264.h new file mode 100644 index 0000000..9de6fdd --- /dev/null +++ b/tinyDAV/include/tinydav/codecs/h264/tdav_codec_h264.h @@ -0,0 +1,56 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +* +*/ + +/**@file tdav_codec_h264.h + * @brief H.264 codec plugin using FFmpeg for decoding and x264 for encoding + * RTP payloader/depayloader follows RFC 3984. + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + */ +#ifndef TINYDAV_CODEC_H264_H +#define TINYDAV_CODEC_H264_H + +#include "tinydav_config.h" + +#if HAVE_FFMPEG || HAVE_H264_PASSTHROUGH + +#include "tinydav/codecs/h264/tdav_codec_h264_common.h" + +TDAV_BEGIN_DECLS + +TINYDAV_GEXTERN const tmedia_codec_plugin_def_t *tdav_codec_h264_base_plugin_def_t; +TINYDAV_GEXTERN const tmedia_codec_plugin_def_t *tdav_codec_h264_main_plugin_def_t; + +tsk_bool_t tdav_codec_ffmpeg_h264_is_supported(); +tsk_bool_t tdav_codec_passthrough_h264_is_supported(); + +static inline tsk_bool_t tdav_codec_h264_is_ffmpeg_plugin(const tmedia_codec_plugin_def_t *plugin) +{ + return(plugin && ((plugin == tdav_codec_h264_base_plugin_def_t) || (plugin == tdav_codec_h264_main_plugin_def_t))); +} + +TDAV_END_DECLS + +#endif /* HAVE_FFMPEG || HAVE_H264_PASSTHROUGH */ + +#endif /* TINYDAV_CODEC_H264_H */ diff --git a/tinyDAV/include/tinydav/codecs/h264/tdav_codec_h264_cisco.h b/tinyDAV/include/tinydav/codecs/h264/tdav_codec_h264_cisco.h new file mode 100644 index 0000000..b464f12 --- /dev/null +++ b/tinyDAV/include/tinydav/codecs/h264/tdav_codec_h264_cisco.h @@ -0,0 +1,40 @@ +/* +* Copyright (C) 2014-2015 Mamadou DIOP. +* +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +* +*/ + +/**@file tdav_codec_h264_cisco.h + * @brief H.264 codec plugin using OpenH264 (https://github.com/cisco/openh264) v1.1 for encoding/decoding. + */ +#ifndef TINYDAV_CODEC_H264_CISCO_H +#define TINYDAV_CODEC_H264_CISCO_H + +#include "tinydav_config.h" + +#if HAVE_OPENH264 + +TDAV_BEGIN_DECLS + +extern const struct tmedia_codec_plugin_def_s *tdav_codec_h264_cisco_base_plugin_def_t; + +TDAV_END_DECLS + +#endif /* HAVE_OPENH264 */ + +#endif /* TINYDAV_CODEC_H264_CISCO_H */ diff --git a/tinyDAV/include/tinydav/codecs/h264/tdav_codec_h264_common.h b/tinyDAV/include/tinydav/codecs/h264/tdav_codec_h264_common.h new file mode 100644 index 0000000..1cf2e97 --- /dev/null +++ b/tinyDAV/include/tinydav/codecs/h264/tdav_codec_h264_common.h @@ -0,0 +1,433 @@ +/* +* Copyright (C) 2011 Doubango Telecom <http://www.doubango.org>. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango(DOT)org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +* +*/ +#ifndef TINYDAV_CODEC_H264_COMMON_H +#define TINYDAV_CODEC_H264_COMMON_H + +#include "tinydav_config.h" +#include "tinydav/codecs/h264/tdav_codec_h264_rtp.h" + +#include "tinymedia/tmedia_codec.h" +#include "tinymedia/tmedia_defaults.h" + +#include "tsk_memory.h" +#include "tsk_string.h" +#include "tsk_params.h" +#include "tsk_debug.h" + +#include <string.h> + + +TDAV_BEGIN_DECLS + +#if !defined(H264_MAX_BR) +# define H264_MAX_BR 452 +#endif +#if !defined(H264_MAX_MBPS) +# define H264_MAX_MBPS 11880 +#endif + +#if !defined(H264_PACKETIZATION_MODE) +# if METROPOLIS || 1 +# define H264_PACKETIZATION_MODE Single_NAL_Unit_Mode +# else +# define H264_PACKETIZATION_MODE Non_Interleaved_Mode +#endif +#endif + +#if !defined(H264_FS_MAX_COUNT) +# define H264_FS_MAX_COUNT 16 // max number of DPBFS in the list +#endif +#if !defined(H264_LEVEL_MAX_COUNT) +# define H264_LEVEL_MAX_COUNT 16 // Table A-1 – Level limits: "1", "1b"... "5.1" +#endif + +// Table A-1 – Level limits +static const int32_t MaxMBPS[H264_LEVEL_MAX_COUNT] = { 1485, 1485, 3000, 6000, 11880, 11880, 19800, 20250, 40500, 108000, 216000, 245760, 245760, 522240, 589824, 983040 }; +static const int32_t MaxFS[H264_LEVEL_MAX_COUNT] = { 99, 99, 396, 396, 396, 396, 792, 1620, 1620, 3600, 5120, 8192, 8192, 8704, 22080, 36864 }; +static const int32_t MaxDpbMbs[H264_LEVEL_MAX_COUNT] = { 396, 396, 900, 2376, 2376, 2376, 4752, 8100, 8100, 18000, 20480, 32768, 32768, 34816, 110400, 184320 }; +static const int32_t MaxBR[H264_LEVEL_MAX_COUNT] = { 64, 128, 192, 384, 768, 2000, 4000, 4000, 10000, 14000, 20000, 20000, 50000, 50000, 135000, 240000 }; +static const int32_t MaxCPB[H264_LEVEL_MAX_COUNT] = { 175, 350, 500, 1000, 2000, 2000, 4000, 4000, 10000, 14000, 20000, 25000, 62500, 62500, 135000, 240000 }; + +// From "enum level_idc_e" to zero-based index +// level_idc = (level.prefix * 10) + level.suffix. For example: 3.1 = 31. Exception for 1b = 9. +// usage: int32_t maxDpbMbs = MaxDpbMbs[HL_CODEC_264_LEVEL_TO_ZERO_BASED_INDEX[level_idc]]; +static const int32_t H264_LEVEL_TO_ZERO_BASED_INDEX[255] = { + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 2, 3, 4, 4, 4, 4, 4, + 4, 4, 5, 6, 7, 7, 7, 7, 7, 7, 7, 7, 8, 9, 10, 10, 10, 10, 10, + 10, 10, 10, 11, 12, 13, 13, 13, 13, 13, 13, 13, 13, 14, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16 +}; + +// Because of FD, declare it here +typedef enum packetization_mode_e{ + Unknown_Mode = -1, + Single_NAL_Unit_Mode = 0, /* Single NAL mode (Only nals from 1-23 are allowed) */ + Non_Interleaved_Mode = 1, /* Non-interleaved Mode: 1-23, 24 (STAP-A), 28 (FU-A) are allowed */ + Interleaved_Mode = 2 /* 25 (STAP-B), 26 (MTAP16), 27 (MTAP24), 28 (FU-A), and 29 (FU-B) are allowed.*/ +} +packetization_mode_t; + +typedef struct tdav_codec_h264_common_s +{ + TMEDIA_DECLARE_CODEC_VIDEO; + + profile_idc_t profile; + uint8_t profile_iop; + level_idc_t level; + unsigned maxFS; + + packetization_mode_t pack_mode_remote; // remote packetization mode + packetization_mode_t pack_mode_local; // local packetization mode + + struct{ + uint8_t* ptr; + tsk_size_t size; + } rtp; +} +tdav_codec_h264_common_t; +#define TDAV_CODEC_H264_COMMON(self) ((tdav_codec_h264_common_t*)(self)) +#define TDAV_DECLARE_CODEC_H264_COMMON tdav_codec_h264_common_t __video__ + +typedef struct tdav_codec_h264_common_level_size_xs +{ + level_idc_t level; + unsigned width; + unsigned height; + unsigned maxFS; // From "Table A-1 – Level limits" +} +tdav_codec_h264_common_level_size_xt; + +static const tdav_codec_h264_common_level_size_xt tdav_codec_h264_common_level_sizes [] = +{ + {level_idc_1_0, 128, 96, 99}, +#if 0 + {level_idc_1_b, 128, 96, 99}, +#endif + {level_idc_1_1, 176, 144, 396}, + {level_idc_1_2, 320, 240, 396}, + {level_idc_1_3, 352, 288, 396}, + {level_idc_2_0, 352, 288, 396}, + {level_idc_2_1, 480, 352, 792}, // Swap(352x480) + {level_idc_2_2, 720, 480, 1620}, + {level_idc_3_0, 720, 576, 1620}, + {level_idc_3_1, 1280, 720, 3600}, + {level_idc_3_2, 1280, 720, 5120}, + {level_idc_4_0, 2048, 1024, 8192}, + {level_idc_4_1, 2048, 1024, 8192}, + {level_idc_4_2, 2048, 1080, 8704}, + {level_idc_5_0, 2560, 1920, 22080}, + {level_idc_5_1, 3840, 2160, 32400}, + {level_idc_5_2, 4096, 2048, 32768} +}; + +static int tdav_codec_h264_common_size_from_level(level_idc_t level, unsigned *width, unsigned *height) +{ + tsk_size_t i; + for(i = 0; i < sizeof(tdav_codec_h264_common_level_sizes)/sizeof(tdav_codec_h264_common_level_sizes[0]); ++i){ + if(tdav_codec_h264_common_level_sizes[i].level == level){ + *width = tdav_codec_h264_common_level_sizes[i].width; + *height = tdav_codec_h264_common_level_sizes[i].height; + return 0; + } + } + return -1; +} + +static int tdav_codec_h264_common_size_from_fs(unsigned maxFS, unsigned *width, unsigned *height) +{ + tsk_size_t i; + int ret = -1; + for (i = 0; i < sizeof(tdav_codec_h264_common_level_sizes)/sizeof(tdav_codec_h264_common_level_sizes[0]); ++i){ + if (tdav_codec_h264_common_level_sizes[i].maxFS <= maxFS){ + *width = tdav_codec_h264_common_level_sizes[i].width; + *height = tdav_codec_h264_common_level_sizes[i].height; + ret = 0; + } + else { + break; + } + } + return ret; +} + +static int tdav_codec_h264_common_level_from_size(unsigned width, unsigned height, level_idc_t *level) +{ + tsk_size_t i; + unsigned maxFS = (((width + 15) >> 4) * ((height + 15) >> 4)); + static const tsk_size_t __tdav_codec_h264_common_level_sizes_count = sizeof(tdav_codec_h264_common_level_sizes)/sizeof(tdav_codec_h264_common_level_sizes[0]); + for (i = 0; i < __tdav_codec_h264_common_level_sizes_count; ++i){ + if (/*tdav_codec_h264_common_level_sizes[i].maxFS*/ ((tdav_codec_h264_common_level_sizes[i].width * tdav_codec_h264_common_level_sizes[i].height) >> 8) >= maxFS){ + *level = tdav_codec_h264_common_level_sizes[i].level; + return 0; + } + } + TSK_DEBUG_WARN("Failed to find default level for size=(%ux%u)", width, height); + *level = tdav_codec_h264_common_level_sizes[__tdav_codec_h264_common_level_sizes_count - 1].level; + return 0; +} + + +static int tdav_codec_h264_common_init(tdav_codec_h264_common_t * h264) +{ + if (h264) { + level_idc_t level; + // because at this step 'tmedia_codec_init()' is not called yet and we need default size to compute the H.264 level + if (TMEDIA_CODEC_VIDEO(h264)->out.width == 0 || TMEDIA_CODEC_VIDEO(h264)->in.width == 0) { + unsigned width, height; + tmedia_pref_video_size_t pref_size = tmedia_defaults_get_pref_video_size(); + if (tmedia_video_get_size(pref_size, &width, &height) == 0) { + TMEDIA_CODEC_VIDEO(h264)->out.width = TMEDIA_CODEC_VIDEO(h264)->in.width = width; + TMEDIA_CODEC_VIDEO(h264)->out.height = TMEDIA_CODEC_VIDEO(h264)->in.height = height; + } + } + h264->maxFS = (((TMEDIA_CODEC_VIDEO(h264)->out.width + 15) >> 4) * ((TMEDIA_CODEC_VIDEO(h264)->out.height + 15) >> 4)); + if ((tdav_codec_h264_common_level_from_size(TMEDIA_CODEC_VIDEO(h264)->out.width, TMEDIA_CODEC_VIDEO(h264)->out.height, &level)) == 0){ + h264->maxFS = TSK_MIN((int32_t)h264->maxFS, MaxFS[H264_LEVEL_TO_ZERO_BASED_INDEX[level]]); + h264->level = level; + } + h264->profile_iop = 0x80; + h264->pack_mode_local = H264_PACKETIZATION_MODE; + h264->pack_mode_remote = Unknown_Mode; + } + return 0; +} + +static int tdav_codec_h264_common_deinit(tdav_codec_h264_common_t * h264) +{ + TSK_DEBUG_INFO("tdav_codec_h264_common_deinit"); + if(h264){ + tmedia_codec_video_deinit(TMEDIA_CODEC_VIDEO(h264)); + TSK_FREE(h264->rtp.ptr); + h264->rtp.size = 0; + } + return 0; +} + +static int tdav_codec_h264_common_get_profile_and_level(const char* fmtp, profile_idc_t *profile, level_idc_t *level) +{ + tsk_size_t size = tsk_strlen(fmtp); + int start, end; + int ret = -1; + + *profile = profile_idc_none; + *level = level_idc_none; + + if((start = tsk_strindexOf(fmtp, size, "profile-level-id")) !=-1){ + tsk_param_t* param; + if((end = (int)tsk_strindexOf((fmtp+start), (tsk_size_t)(size-start), ";")) == -1){ + end = (int)size; + } + + if((param = tsk_params_parse_param((fmtp+start), (end-start)))){ + profile_idc_t p_idc; + level_idc_t l_idc; + if(param->value){ + tsk_strtrim_both(¶m->value); + } + + tdav_codec_h264_parse_profile(param->value, &p_idc, tsk_null, &l_idc); + + switch(p_idc){ + case profile_idc_baseline: + case profile_idc_main: + *profile = p_idc; + *level = l_idc; + ret = 0; + break; + case profile_idc_extended: + case profile_idc_high: + default: + /* Not supported */ + break; + } + + TSK_OBJECT_SAFE_FREE(param); + } + } + return ret; +} + +static tsk_bool_t tdav_codec_h264_common_sdp_att_match(tdav_codec_h264_common_t* h264, const char* att_name, const char* att_value) +{ + tsk_bool_t ret = tsk_true; + + if(!h264){ + TSK_DEBUG_ERROR("Invalid parameter"); + return tsk_false; + } + + TSK_DEBUG_INFO("[H.264] Trying to match [%s:%s]", att_name, att_value); + + if (tsk_striequals(att_name, "fmtp")) { + int val_int; + profile_idc_t profile; + level_idc_t level; + tsk_params_L_t* params; + + /* Check whether the profile match (If the profile is missing, then we consider that it's ok) */ + if (tdav_codec_h264_common_get_profile_and_level(att_value, &profile, &level) != 0) { + TSK_DEBUG_ERROR("Not valid profile-level: %s", att_value); + return tsk_false; + } + if (h264->profile != profile) { + return tsk_false; + } + else{ + if (h264->level != level) { + // change the output size only when the remote party request lower level. If it request higher (or same) level then, we send our preferred size. + if (h264->level > level) { + unsigned width, height; + h264->level = TSK_MIN(h264->level, level); + if (tdav_codec_h264_common_size_from_level(h264->level, &width, &height) != 0) { + return tsk_false; + } + // Do not change our size if it match the requested level + if (width < TMEDIA_CODEC_VIDEO(h264)->out.width || height < TMEDIA_CODEC_VIDEO(h264)->out.height) { + // Set "out" size. We must not send more than "MaxFS". + // Default "out" is equal to the preferred sized and initialized in init(). + // "TANDBERG/4120 (X7.2.2)" will terminate the call if frame size > maxFS + TMEDIA_CODEC_VIDEO(h264)->out.width = TSK_MIN(TMEDIA_CODEC_VIDEO(h264)->out.width, width); + TMEDIA_CODEC_VIDEO(h264)->out.height = TSK_MIN(TMEDIA_CODEC_VIDEO(h264)->out.height, height); + } + // Set default "in". Will be updated after receiving the first frame. + TMEDIA_CODEC_VIDEO(h264)->in.width = width; + TMEDIA_CODEC_VIDEO(h264)->in.height = height; + } + } + } + + /* e.g. profile-level-id=42e00a; packetization-mode=1; max-br=452; max-mbps=11880 */ + if ((params = tsk_params_fromstring(att_value, ";", tsk_true))) { + + /* === max-br ===*/ + if ((val_int = tsk_params_get_param_value_as_int(params, "max-br")) != -1) { + // should compare "max-br"? + TMEDIA_CODEC_VIDEO(h264)->out.max_br = val_int*1000; + } + + /* === max-fs ===*/ + if ((val_int = tsk_params_get_param_value_as_int(params, "max-fs")) != -1) { + unsigned width_max, height_max, maxFS, currFS; + currFS = (TMEDIA_CODEC_VIDEO(h264)->out.width * TMEDIA_CODEC_VIDEO(h264)->out.height) >> 8; + maxFS = TSK_MIN(h264->maxFS/*preferred*/, (unsigned)val_int/*proposed*/); // make sure we'll never send more than we advertised + if (currFS > maxFS) { // do not use default sizes when we already respect the MaxFS + if (tdav_codec_h264_common_size_from_fs(maxFS, &width_max, &height_max) == 0) { + TMEDIA_CODEC_VIDEO(h264)->out.width = TMEDIA_CODEC_VIDEO(h264)->in.width = width_max; + TMEDIA_CODEC_VIDEO(h264)->out.height = TMEDIA_CODEC_VIDEO(h264)->in.height = height_max; + } + } + } + + /* === max-mbps ===*/ + if ((val_int = tsk_params_get_param_value_as_int(params, "max-mbps")) != -1) { + // should compare "max-mbps"? + TMEDIA_CODEC_VIDEO(h264)->out.max_mbps = val_int*1000; + } + + /* === packetization-mode ===*/ + if ((val_int = tsk_params_get_param_value_as_int(params, "packetization-mode")) != -1) { + if ((packetization_mode_t)val_int == Single_NAL_Unit_Mode || (packetization_mode_t)val_int == Non_Interleaved_Mode) { + TDAV_CODEC_H264_COMMON(h264)->pack_mode_remote = (packetization_mode_t)val_int; + TDAV_CODEC_H264_COMMON(h264)->pack_mode_local = TSK_MAX(TDAV_CODEC_H264_COMMON(h264)->pack_mode_local, TDAV_CODEC_H264_COMMON(h264)->pack_mode_remote); + } + else { + TSK_DEBUG_INFO("packetization-mode not matching"); + ret = tsk_false; + goto bail; + } + } + } +bail: + TSK_OBJECT_SAFE_FREE(params); + } + else if(tsk_striequals(att_name, "imageattr")){ + unsigned in_width, in_height, out_width, out_height; + unsigned width, height; + tsk_size_t s; + if(tmedia_parse_video_imageattr(att_value, TMEDIA_CODEC_VIDEO(h264)->pref_size, &in_width, &in_height, &out_width, &out_height) != 0){ + return tsk_false; + } + // check that 'imageattr' is comform to H.264 'profile-level' + if(tdav_codec_h264_common_size_from_level(h264->level, &width, &height) != 0){ + return tsk_false; + } + if((s = ((width * height * 3) >> 1)) < ((in_width * in_height * 3) >> 1) || s < ((out_width * out_height * 3) >> 1)){ + return tsk_false; + } + + TMEDIA_CODEC_VIDEO(h264)->in.width = in_width; + TMEDIA_CODEC_VIDEO(h264)->in.height = in_height; + TMEDIA_CODEC_VIDEO(h264)->out.width = out_width; + TMEDIA_CODEC_VIDEO(h264)->out.height = out_height; + } + + return ret; +} + +static char* tdav_codec_h264_common_sdp_att_get(const tdav_codec_h264_common_t* h264, const char* att_name) +{ + if(!h264 || !att_name){ + TSK_DEBUG_ERROR("Invalid parameter"); + return tsk_null; + } + + if (tsk_striequals(att_name, "fmtp")) { + char* fmtp = tsk_null; +#if 1 + // Required by "TANDBERG/4120 (X7.2.2)" and CISCO TelePresence + tsk_sprintf(&fmtp, "profile-level-id=%x;max-mbps=%d;max-fs=%d", + ((h264->profile << 16) | (h264->profile_iop << 8) | (h264->level & 0xff)), + MaxMBPS[H264_LEVEL_TO_ZERO_BASED_INDEX[h264->level]], + h264->maxFS + ); + // Do not restrict packetisation-mode until we knwon what the remote party supports + if (h264->pack_mode_remote != Unknown_Mode) { + tsk_strcat_2(&fmtp, ";packetization-mode=%d", h264->pack_mode_local); + } +#else + tsk_sprintf(&fmtp, "profile-level-id=%x; packetization-mode=%d", ((h264->profile << 16) | (h264->profile_iop << 8) | (h264->level & 0xff)), h264->pack_mode); +#endif + return fmtp; + } + else if(tsk_striequals(att_name, "imageattr")){ + return tmedia_get_video_imageattr(TMEDIA_CODEC_VIDEO(h264)->pref_size, + TMEDIA_CODEC_VIDEO(h264)->in.width, TMEDIA_CODEC_VIDEO(h264)->in.height, TMEDIA_CODEC_VIDEO(h264)->out.width, TMEDIA_CODEC_VIDEO(h264)->out.height); + } + return tsk_null; +} + + +TDAV_END_DECLS + +#endif /* TINYDAV_CODEC_H264_COMMON_H */ diff --git a/tinyDAV/include/tinydav/codecs/h264/tdav_codec_h264_cuda.h b/tinyDAV/include/tinydav/codecs/h264/tdav_codec_h264_cuda.h new file mode 100644 index 0000000..5dfae9c --- /dev/null +++ b/tinyDAV/include/tinydav/codecs/h264/tdav_codec_h264_cuda.h @@ -0,0 +1,124 @@ +/* +* Copyright (C) 2011-2014 Mamadou DIOP. +* Copyright (C) 2011-2014 Doubango Telecom <http://www.doubango.org>. +* +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +* +*/ + +/**@file tdav_codec_h264_cuda.h + * @brief H.264 codec plugin using NVIDIA CUDA for encoding/decoding. + * Env: gpucomputingsdk_4.0.17_win_32, cudatoolkit_4.0.17_win_32 and 280.26-notebook-win7-winvista-32bit-international-whql. + * http://developer.download.nvidia.com/compute/DevZone/docs/html/C/doc/CUDA_VideoDecoder_Library.pdf + * http://developer.download.nvidia.com/compute/DevZone/docs/html/C/doc/CUDA_VideoEncoder_Library.pdf + * RTP payloader/depayloader follows RFC 3984. + * + */ +#ifndef TINYDAV_CODEC_H264_CUDA_H +#define TINYDAV_CODEC_H264_CUDA_H + +#include "tinydav_config.h" + +#if HAVE_CUDA + +#include "tinydav/codecs/h264/tdav_codec_h264_common.h" + +// I really don't want to use C++ code :( +#if !defined(__cplusplus) +typedef enum NVVE_FrameRate NVVE_FrameRate; +typedef enum NVVE_GPUOffloadLevel NVVE_GPUOffloadLevel; +typedef enum NVVE_ASPECT_RATIO_TYPE NVVE_ASPECT_RATIO_TYPE; +typedef enum NVVE_SurfaceFormat NVVE_SurfaceFormat; +typedef enum NVVE_PicStruct NVVE_PicStruct; +typedef enum NVVE_FIELD_MODE NVVE_FIELD_MODE; +typedef enum NVVE_RateCtrlType NVVE_RateCtrlType; +typedef enum NVVE_DI_MODE NVVE_DI_MODE; +typedef enum NVVE_PRESETS_TARGET NVVE_PRESETS_TARGET; +typedef enum NVVE_DI_MODE NVVE_DI_MODE; + +typedef struct NVEncoderParams NVEncoderParams; +#endif /* __cplusplus */ + +#include <stdio.h> +#include <stdlib.h> +#include <windows.h> +#include <unknwn.h> +#include <nvcuvid.h> +#include <cuviddec.h> +#include <NVEncoderAPI.h> +#include <NVEncodeDataTypes.h> +#include <d3d9.h> +#include <cudad3d9.h> +#include <cuda/types.h> + +#include "tsk_mutex.h" + +TDAV_BEGIN_DECLS + +typedef struct tdav_codec_h264_cuda_s +{ + TDAV_DECLARE_CODEC_H264_COMMON; + + struct { + NVEncoder context; + NVEncoderParams ctx_params; + NVVE_CallbackParams clb_params; + void *buffer; + tsk_size_t buffer_size; + int64_t frame_count; + } encoder; + + struct { + tsk_mutex_handle_t *mutex; + CUvideodecoder context; + CUVIDDECODECREATEINFO info; + CUvideoparser cu_parser; + CUVIDPARSERPARAMS cu_paser_params; + CUdevice cu_device; + IDirect3D9 *dx_d3d; + IDirect3DDevice9 *dx_d3ddevice; + CUcontext cu_context; + void* accumulator; + tsk_size_t accumulator_pos; + tsk_size_t accumulator_size; + void *cu_buffer; + tsk_size_t cu_buffer_size; + tsk_size_t cu_buffer_pitch; + tsk_bool_t cu_buffer_avail; + uint16_t last_seq; + } decoder; +} +tdav_codec_h264_cuda_t; + +TINYDAV_GEXTERN const tmedia_codec_plugin_def_t *tdav_codec_h264_cuda_bp10_plugin_def_t; +TINYDAV_GEXTERN const tmedia_codec_plugin_def_t *tdav_codec_h264_cuda_bp20_plugin_def_t; +TINYDAV_GEXTERN const tmedia_codec_plugin_def_t *tdav_codec_h264_cuda_bp30_plugin_def_t; + +tsk_bool_t tdav_codec_h264_cuda_is_supported(); +static inline tsk_bool_t tdav_codec_h264_is_cuda_plugin(const tmedia_codec_plugin_def_t *plugin) +{ + if(plugin && (plugin == tdav_codec_h264_cuda_bp10_plugin_def_t || plugin == tdav_codec_h264_cuda_bp20_plugin_def_t || plugin == tdav_codec_h264_cuda_bp30_plugin_def_t)){ + return tsk_true; + } + return tsk_false; +} + +TDAV_END_DECLS + +#endif /* HAVE_CUDA */ + +#endif /* TINYDAV_CODEC_H264_CUDA_H */ diff --git a/tinyDAV/include/tinydav/codecs/h264/tdav_codec_h264_intel.h b/tinyDAV/include/tinydav/codecs/h264/tdav_codec_h264_intel.h new file mode 100644 index 0000000..92dd672 --- /dev/null +++ b/tinyDAV/include/tinydav/codecs/h264/tdav_codec_h264_intel.h @@ -0,0 +1,40 @@ +/* +* Copyright (C) 2014-2015 Mamadou DIOP. +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +* +*/ + +/**@file tdav_codec_h264_intel.h +* @brief H.264 codec plugin using Intel Media SDK 2014 R2 for Clients (https://software.intel.com/en-us/media-solutions-portal) v1.1 for encoding/decoding. +*/ +#ifndef TINYDAV_CODEC_H264_INTEL_H +#define TINYDAV_CODEC_H264_INTEL_H + +#include "tinydav_config.h" + +#if HAVE_INTEL_MEDIA_SDK + +TDAV_BEGIN_DECLS + +extern const struct tmedia_codec_plugin_def_s *tdav_codec_h264_intel_base_plugin_def_t; +extern const struct tmedia_codec_plugin_def_s *tdav_codec_h264_intel_main_plugin_def_t; + +TDAV_END_DECLS + +#endif /* HAVE_INTEL_MEDIA_SDK */ + +#endif /* TINYDAV_CODEC_H264_INTEL_H */ diff --git a/tinyDAV/include/tinydav/codecs/h264/tdav_codec_h264_rtp.h b/tinyDAV/include/tinydav/codecs/h264/tdav_codec_h264_rtp.h new file mode 100644 index 0000000..88796e4 --- /dev/null +++ b/tinyDAV/include/tinydav/codecs/h264/tdav_codec_h264_rtp.h @@ -0,0 +1,126 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +* +*/ + +/**@file tdav_codec_h264_rtp.h + * @brief H.264 payloader/depayloder as per RFC 3984 + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#ifndef TINYDAV_CODEC_H264_RTP_H +#define TINYDAV_CODEC_H264_RTP_H + +#include "tinydav_config.h" + +#include "tsk_common.h" + +TDAV_BEGIN_DECLS + +#if !defined(H264_RTP_PAYLOAD_SIZE) +# define H264_RTP_PAYLOAD_SIZE 1300 +#endif + +#define H264_START_CODE_PREFIX_SIZE 4 + +struct tdav_codec_h264_common_s; + +extern uint8_t H264_START_CODE_PREFIX[4]; + +typedef enum profile_idc_e { + profile_idc_none = 0, + + profile_idc_baseline = 66, + profile_idc_extended = 88, + profile_idc_main = 77, + profile_idc_high = 100 +} +profile_idc_t; + +typedef struct profile_iop_s { + unsigned constraint_set0_flag:1; + unsigned constraint_set1_flag:1; + unsigned constraint_set2_flag:1; + unsigned reserved_zero_5bits:5; +} +profile_iop_t; + +typedef enum level_idc_e { + level_idc_none = 0, + + level_idc_1_0 = 10, + level_idc_1_b = 14, + level_idc_1_1 = 11, + level_idc_1_2 = 12, + level_idc_1_3 = 13, + level_idc_2_0 = 20, + level_idc_2_1 = 21, + level_idc_2_2 = 22, + level_idc_3_0 = 30, + level_idc_3_1 = 31, + level_idc_3_2 = 32, + level_idc_4_0 = 40, + level_idc_4_1 = 41, + level_idc_4_2 = 42, + level_idc_5_0 = 50, + level_idc_5_1 = 51, + level_idc_5_2 = 52, +} +level_idc_t; + + +/* 5.2. Common Structure of the RTP Payload Format + Type Packet Type name Section + --------------------------------------------------------- + 0 undefined - + 1-23 NAL unit Single NAL unit packet per H.264 5.6 + 24 STAP-A Single-time aggregation packet 5.7.1 + 25 STAP-B Single-time aggregation packet 5.7.1 + 26 MTAP16 Multi-time aggregation packet 5.7.2 + 27 MTAP24 Multi-time aggregation packet 5.7.2 + 28 FU-A Fragmentation unit 5.8 + 29 FU-B Fragmentation unit 5.8 + 30-31 undefined - +*/ +typedef enum nal_unit_type_e{ + undefined_0 = 0, + nal_unit, + stap_a = 24, + stap_b = 25, + mtap16 = 26, + mtap24 = 27, + fu_a = 28, + fu_b = 29, + undefined_30 = 30, + undefined_31 = 31 +} +nal_unit_type_t; + +int tdav_codec_h264_parse_profile(const char* profile_level_id, profile_idc_t *p_idc, profile_iop_t *p_iop, level_idc_t *l_idc); +int tdav_codec_h264_get_pay(const void* in_data, tsk_size_t in_size, const void** out_data, tsk_size_t *out_size, tsk_bool_t* append_scp, tsk_bool_t* end_of_unit); + +void tdav_codec_h264_rtp_encap(struct tdav_codec_h264_common_s* self, const uint8_t* pdata, tsk_size_t size); +void tdav_codec_h264_rtp_callback(struct tdav_codec_h264_common_s *self, const void *data, tsk_size_t size, tsk_bool_t marker); + +TDAV_END_DECLS + +#endif /* TINYDAV_CODEC_H264_RTP_H */ diff --git a/tinyDAV/include/tinydav/codecs/ilbc/tdav_codec_ilbc.h b/tinyDAV/include/tinydav/codecs/ilbc/tdav_codec_ilbc.h new file mode 100644 index 0000000..4a48fad --- /dev/null +++ b/tinyDAV/include/tinydav/codecs/ilbc/tdav_codec_ilbc.h @@ -0,0 +1,64 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +* +*/ + +/**@file tdav_codec_ilbc.h + * @brief iLBC codec + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#ifndef TINYDAV_CODEC_ILBC_H +#define TINYDAV_CODEC_ILBC_H + +#include "tinydav_config.h" + +#if HAVE_ILBC + +#include "tinymedia/tmedia_codec.h" + +#include <ilbc/iLBC_define.h> +#include <ilbc/iLBC_encode.h> +#include <ilbc/iLBC_decode.h> + +TDAV_BEGIN_DECLS + +/** iLBC codec */ +typedef struct tdav_codec_ilbc_s +{ + TMEDIA_DECLARE_CODEC_AUDIO; + + iLBC_Enc_Inst_t encoder; + iLBC_Dec_Inst_t decoder; + + float encblock[BLOCKL_MAX]; + float decblock[BLOCKL_MAX]; +} +tdav_codec_ilbc_t; + +TINYDAV_GEXTERN const tmedia_codec_plugin_def_t *tdav_codec_ilbc_plugin_def_t; + +TDAV_END_DECLS + +#endif /* HAVE_ILBC */ + +#endif /* TINYDAV_CODEC_ILBC_H */ diff --git a/tinyDAV/include/tinydav/codecs/mp4ves/tdav_codec_mp4ves.h b/tinyDAV/include/tinydav/codecs/mp4ves/tdav_codec_mp4ves.h new file mode 100644 index 0000000..c7bf35a --- /dev/null +++ b/tinyDAV/include/tinydav/codecs/mp4ves/tdav_codec_mp4ves.h @@ -0,0 +1,52 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +* +*/ + +/**@file tdav_codec_mp4ves.h + * @brief MP4V-ES codec plugin + * RTP payloader/depayloader follows RFC 3016. + * ISO-IEC-14496-2: http://www.csus.edu/indiv/p/pangj/aresearch/video_compression/presentation/ISO-IEC-14496-2_2001_MPEG4_Visual.pdf + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + * @date Created: Th Dec 2 16:54:58 2010 mdiop + */ +#ifndef TINYDAV_CODEC_MP4VES_H +#define TINYDAV_CODEC_MP4VES_H + +#include "tinydav_config.h" + +#if HAVE_FFMPEG + +#include "tinymedia/tmedia_codec.h" + +TDAV_BEGIN_DECLS + +TINYDAV_GEXTERN const tmedia_codec_plugin_def_t *tdav_codec_mp4ves_plugin_def_t; + +tsk_bool_t tdav_codec_ffmpeg_mp4ves_is_supported(); + +TDAV_END_DECLS + +#endif /* HAVE_FFMPEG */ + +#endif /* TINYDAV_CODEC_MP4VES_H */ + diff --git a/tinyDAV/include/tinydav/codecs/msrp/tdav_codec_msrp.h b/tinyDAV/include/tinydav/codecs/msrp/tdav_codec_msrp.h new file mode 100644 index 0000000..702c872 --- /dev/null +++ b/tinyDAV/include/tinydav/codecs/msrp/tdav_codec_msrp.h @@ -0,0 +1,45 @@ +/* +* Copyright (C) 2010-2011 Mamadou DIOP. +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +* +*/ + +/**@file tdav_codec_msrp.h + * @brief The Message Session Relay Protocol (MSRP) fake codec. + * Used for both Message (RFC 4975) and file transfer (RFC 5547). + */ +#ifndef TINYDAV_CODEC_MSRP_H +#define TINYDAV_CODEC_MSRP_H + +#include "tinydav_config.h" + +#include "tinymedia/tmedia_codec.h" + +TDAV_BEGIN_DECLS + +/** MSRP codec */ +typedef struct tdav_codec_msrp_s +{ + TMEDIA_DECLARE_CODEC_MSRP; +} +tdav_codec_msrp_t; + +TINYDAV_GEXTERN const tmedia_codec_plugin_def_t *tdav_codec_msrp_plugin_def_t; + +TDAV_END_DECLS + +#endif /* TINYDAV_CODEC_MSRP_H */ diff --git a/tinyDAV/include/tinydav/codecs/opus/tdav_codec_opus.h b/tinyDAV/include/tinydav/codecs/opus/tdav_codec_opus.h new file mode 100644 index 0000000..c505f6d --- /dev/null +++ b/tinyDAV/include/tinydav/codecs/opus/tdav_codec_opus.h @@ -0,0 +1,37 @@ +/* +* Copyright (C) 2010-2013 Doubango Telecom <http://www.doubango.org>. +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +* +*/ + +/**@file tdav_codec_opus.h + * @brief OPUS audio codec. + */ +#ifndef TINYDAV_CODEC_OPUS_H +#define TINYDAV_CODEC_OPUS_H + +#include "tinydav_config.h" + +#if HAVE_LIBOPUS + +#include "tinymedia/tmedia_codec.h" + +TINYDAV_GEXTERN const tmedia_codec_plugin_def_t *tdav_codec_opus_plugin_def_t; + +#endif /* HAVE_LIBOPUS */ + +#endif /* TINYDAV_CODEC_OPUS_H */ diff --git a/tinyDAV/include/tinydav/codecs/speex/tdav_codec_speex.h b/tinyDAV/include/tinydav/codecs/speex/tdav_codec_speex.h new file mode 100644 index 0000000..b577f02 --- /dev/null +++ b/tinyDAV/include/tinydav/codecs/speex/tdav_codec_speex.h @@ -0,0 +1,81 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +* +*/ + +/**@file tdav_codec_ilbc.h + * @brief Speex codecs + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#ifndef TINYDAV_CODEC_SPEEX_H +#define TINYDAV_CODEC_SPEEX_H + +#include "tinydav_config.h" + +#if HAVE_LIB_SPEEX + +#include "tinymedia/tmedia_codec.h" + +#include <speex/speex.h> + +TDAV_BEGIN_DECLS + +typedef enum tdav_codec_speex_type_e +{ + tdav_codec_speex_type_nb, + tdav_codec_speex_type_wb, + tdav_codec_speex_type_uwb, +} +tdav_codec_speex_type_t; + +/** Speex codec */ +typedef struct tdav_codec_speex_s +{ + TMEDIA_DECLARE_CODEC_AUDIO; + + tdav_codec_speex_type_t type; + + struct{ + void* state; + SpeexBits bits; + tsk_size_t size; + } encoder; + + struct { + void* state; + SpeexBits bits; + spx_int16_t* buffer; + tsk_size_t size; + } decoder; +} +tdav_codec_speex_t; + +TINYDAV_GEXTERN const tmedia_codec_plugin_def_t *tdav_codec_speex_nb_plugin_def_t; +TINYDAV_GEXTERN const tmedia_codec_plugin_def_t *tdav_codec_speex_wb_plugin_def_t; +TINYDAV_GEXTERN const tmedia_codec_plugin_def_t *tdav_codec_speex_uwb_plugin_def_t; + +TDAV_END_DECLS + +#endif /* TINYDAV_CODEC_SPEEX_H */ + +#endif /* TINYDAV_CODEC_SPEEX_H */ diff --git a/tinyDAV/include/tinydav/codecs/t140/tdav_codec_t140.h b/tinyDAV/include/tinydav/codecs/t140/tdav_codec_t140.h new file mode 100644 index 0000000..1b6d3c2 --- /dev/null +++ b/tinyDAV/include/tinydav/codecs/t140/tdav_codec_t140.h @@ -0,0 +1,43 @@ +/* +* Copyright (C) 2012 Mamadou Diop. +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +* +*/ + +/**@file tdav_codec_t140.h + * @brief T140 codec implementation (RFC 4103) + */ +#ifndef TINYDAV_CODEC_T140_H +#define TINYDAV_CODEC_T140_H + +#include "tinydav_config.h" + +#include "tinymedia/tmedia_codec.h" + +TDAV_BEGIN_DECLS + +typedef struct tdav_codec_t140_s +{ + TMEDIA_DECLARE_CODEC; +} +tdav_codec_t140_t; + +TINYDAV_GEXTERN const tmedia_codec_plugin_def_t *tdav_codec_t140_plugin_def_t; + +TDAV_END_DECLS + +#endif /* TINYDAV_CODEC_T140_H */ diff --git a/tinyDAV/include/tinydav/codecs/theora/tdav_codec_theora.h b/tinyDAV/include/tinydav/codecs/theora/tdav_codec_theora.h new file mode 100644 index 0000000..e0614ed --- /dev/null +++ b/tinyDAV/include/tinydav/codecs/theora/tdav_codec_theora.h @@ -0,0 +1,50 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +* +*/ + +/**@file tdav_codec_theora.h + * @brief Theora codec plugin + * RTP payloader/depayloader follows draft-barbato-avt-rtp-theora-01. + * For more information about Theora, http://www.theora.org/doc/Theora.pdf. + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#ifndef TINYDAV_CODEC_THEORA_H +#define TINYDAV_CODEC_THEORA_H + +#include "tinydav_config.h" + +#if HAVE_FFMPEG + +#include "tinymedia/tmedia_codec.h" + +TDAV_BEGIN_DECLS + +tsk_bool_t tdav_codec_ffmpeg_theora_is_supported(); + +TINYDAV_GEXTERN const tmedia_codec_plugin_def_t *tdav_codec_theora_plugin_def_t; + +TDAV_END_DECLS + +#endif /* HAVE_FFMPEG */ + +#endif /* TINYDAV_CODEC_THEORA_H */
\ No newline at end of file diff --git a/tinyDAV/include/tinydav/codecs/vpx/tdav_codec_vp8.h b/tinyDAV/include/tinydav/codecs/vpx/tdav_codec_vp8.h new file mode 100644 index 0000000..38580ad --- /dev/null +++ b/tinyDAV/include/tinydav/codecs/vpx/tdav_codec_vp8.h @@ -0,0 +1,47 @@ +/* +* Copyright (C) 2011 Doubango Telecom <http://www.doubango.org> +* +* Contact: Mamadou Diop <diopmamadou(at)doubango(dot)org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +* +*/ + +/**@file tdav_codec_vp8.h + * @brief Google's VP8 (http://www.webmproject.org/) encoder/decoder + * The RTP packetizer/depacketizer follows draft-ietf-payload-vp8 and draft-bankoski-vp8-bitstream-05 + * @author Mamadou Diop <diopmamadou(at)doubango(dot)org> + * + */ +#ifndef TINYDAV_CODEC_VP8_H +#define TINYDAV_CODEC_VP8_H + +#include "tinydav_config.h" + +#if HAVE_LIBVPX + +#include "tinymedia/tmedia_codec.h" + +TDAV_BEGIN_DECLS + +TINYDAV_GEXTERN const tmedia_codec_plugin_def_t *tdav_codec_vp8_plugin_def_t; + +TDAV_END_DECLS + +#endif /* HAVE_LIBVPX */ + + +#endif /* TINYDAV_CODEC_VP8_H */
\ No newline at end of file diff --git a/tinyDAV/include/tinydav/msrp/tdav_consumer_msrp.h b/tinyDAV/include/tinydav/msrp/tdav_consumer_msrp.h new file mode 100644 index 0000000..d46a345 --- /dev/null +++ b/tinyDAV/include/tinydav/msrp/tdav_consumer_msrp.h @@ -0,0 +1,51 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +* +*/ + +/**@file tdav_consumer_msrp.h + * @brief The Message Session Relay Protocol (MSRP) consumer. + * Used for both Message (RFC 4975) and file transfer (RFC 5547). + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#ifndef TINYDAV_CONSUMER_MSRP_H +#define TINYDAV_CONSUMER_MSRP_H + +#include "tinydav_config.h" + +TDAV_BEGIN_DECLS + + +#define TDAV_CONSUMER_MSRP(self) ((tdav_consumer_msrp_t*)(self)) + + +typedef struct tdav_consumer_msrp_s +{ + TMEDIA_DECLARE_CONSUMER; +} +tdav_consumer_msrp_t; + + +TDAV_END_DECLS + +#endif /* TINYDAV_CONSUMER_MSRP_H */ diff --git a/tinyDAV/include/tinydav/msrp/tdav_producer_msrp.h b/tinyDAV/include/tinydav/msrp/tdav_producer_msrp.h new file mode 100644 index 0000000..df85248 --- /dev/null +++ b/tinyDAV/include/tinydav/msrp/tdav_producer_msrp.h @@ -0,0 +1,39 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +* +*/ + +/**@file tdav_producer_msrp.h + * @brief The Message Session Relay Protocol (MSRP) producer. + * Used for both Message (RFC 4975) and file transfer (RFC 5547). + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#ifndef TINYDAV_PRODUCER_MSRP_H +#define TINYDAV_PRODUCER_MSRP_H + +#include "tinydav_config.h" + +TDAV_BEGIN_DECLS + + +TDAV_END_DECLS + +#endif /* TINYDAV_PRODUCER_MSRP_H */ diff --git a/tinyDAV/include/tinydav/msrp/tdav_session_msrp.h b/tinyDAV/include/tinydav/msrp/tdav_session_msrp.h new file mode 100644 index 0000000..6626ea9 --- /dev/null +++ b/tinyDAV/include/tinydav/msrp/tdav_session_msrp.h @@ -0,0 +1,112 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +* +*/ + +/**@file tdav_session_msrp.h + * @brief The Message Session Relay Protocol (MSRP) session. + * Used for both Message (RFC 4975) and file transfer (RFC 5547). + */ + +#ifndef TINYDAV_SESSION_MSRP_H +#define TINYDAV_SESSION_MSRP_H + +#include "tinydav_config.h" + +#if !defined(HAVE_TINYMSRP) || HAVE_TINYMSRP + +#include "tinymsrp/session/tmsrp_sender.h" +#include "tinymsrp/session/tmsrp_receiver.h" +#include "tmsrp.h" + +#include "tnet_transport.h" + +#include "tinymedia/tmedia_session.h" + +TDAV_BEGIN_DECLS + +typedef enum tdav_msrp_setup_e +{ + msrp_setup_active, + msrp_setup_passive, + msrp_setup_actpass, + msrp_setup_holdconn +} +tdav_msrp_setup_t; + +typedef enum tdav_msrp_dir_e +{ + tdav_msrp_dir_none = 0x00, + tdav_msrp_dir_sendonly = 0x01 << 0, + tdav_msrp_dir_recvonly = 0x01 << 1, + tdav_msrp_dir_sendrecv = (tdav_msrp_dir_sendonly | tdav_msrp_dir_recvonly), +} +tdav_msrp_dir_t; + +typedef struct tdav_session_msrp_s +{ + TMEDIA_DECLARE_SESSION_MSRP; + + tsk_bool_t useIPv6; + + tnet_transport_t *transport; + tmsrp_config_t* config; + tdav_msrp_setup_t setup; + tnet_fd_t connectedFD; // FullDuplex Socket + tmsrp_sender_t* sender; + tmsrp_receiver_t* receiver; + + char* local_ip; + //uint16_t local_port; + + /* NAT Traversal context */ + struct tnet_nat_ctx_s* natt_ctx; + + char* remote_ip; + uint16_t remote_port; + + tdav_msrp_dir_t dir; + char* neg_accept_type; + char* neg_accept_w_type; + char* accept_types; + char* accept_w_types; + uint64_t chunck_duration; + + struct { + char* path; //full-path + char* selector; + char* disposition; + char* date; + char* icon; + char* transfer_id; + unsigned sent:1; + } file; + + unsigned fresh_conn:1; + unsigned offerer:1; + unsigned send_bodiless:1; +} +tdav_session_msrp_t; + +TINYDAV_GEXTERN const tmedia_session_plugin_def_t *tdav_session_msrp_plugin_def_t; + +TDAV_END_DECLS + +#endif /* !defined(HAVE_TINYMSRP) || HAVE_TINYMSRP */ + +#endif /* TINYDAV_SESSION_MSRP_H */ diff --git a/tinyDAV/include/tinydav/t140/tdav_consumer_t140.h b/tinyDAV/include/tinydav/t140/tdav_consumer_t140.h new file mode 100644 index 0000000..822786c --- /dev/null +++ b/tinyDAV/include/tinydav/t140/tdav_consumer_t140.h @@ -0,0 +1,57 @@ +/* +* Copyright (C) 2012 Doubango Telecom <http://www.doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +* +*/ + +/**@file tdav_consumer_t140.h + * @brief Consumer for T140 protocol (RFC 4103) + */ +#ifndef TINYDAV_CONSUMER_T140_H +#define TINYDAV_CONSUMER_T140_H + +#include "tinydav_config.h" + +#include "tinymedia/tmedia_consumer.h" +#include "tinymedia/tmedia_session.h" + +#include "tsk_safeobj.h" + +TDAV_BEGIN_DECLS + +#define TDAV_CONSUMER_T140(self) ((tdav_consumer_t140_t*)(self)) + +typedef struct tdav_consumer_t140_s +{ + TMEDIA_DECLARE_CONSUMER; + + tsk_bool_t started; + + struct{ + const void* context; + tmedia_session_t140_ondata_cb_f func; + } cb_ondata; + + TSK_DECLARE_SAFEOBJ; +} +tdav_consumer_t140_t; + +int tdav_consumer_t140_set_ondata_cbfn(tdav_consumer_t140_t* self, const void* context, tmedia_session_t140_ondata_cb_f func); + +TINYDAV_GEXTERN const tmedia_consumer_plugin_def_t *tdav_consumer_t140_plugin_def_t; + +#endif /* TINYDAV_CONSUMER_T140_H */ diff --git a/tinyDAV/include/tinydav/t140/tdav_producer_t140.h b/tinyDAV/include/tinydav/t140/tdav_producer_t140.h new file mode 100644 index 0000000..4e47326 --- /dev/null +++ b/tinyDAV/include/tinydav/t140/tdav_producer_t140.h @@ -0,0 +1,49 @@ +/* +* Copyright (C) 2012 Doubango Telecom <http://www.doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +* +*/ + +/**@file tdav_producer_t140.h + * @brief Producer for T.140 protocol (RFC 4103) + */ +#ifndef TINYDAV_PRODUCER_T140_H +#define TINYDAV_PRODUCER_T140_H + +#include "tinydav_config.h" + +#include "tinymedia/tmedia_producer.h" + +TDAV_BEGIN_DECLS + +#define TDAV_PRODUCER_T140(self) ((tdav_producer_t140_t*)(self)) + +typedef struct tdav_producer_t140_s +{ + TMEDIA_DECLARE_PRODUCER; + + tsk_bool_t started; +} +tdav_producer_t140_t; + +int tdav_producer_send_data(tdav_producer_t140_t* self, enum tmedia_t140_data_type_e data_type, const void* data_ptr, unsigned data_size); + +TINYDAV_GEXTERN const tmedia_producer_plugin_def_t *tdav_producer_t140_plugin_def_t; + +TDAV_END_DECLS + +#endif /* TINYDAV_PRODUCER_T140_H */ diff --git a/tinyDAV/include/tinydav/t140/tdav_session_t140.h b/tinyDAV/include/tinydav/t140/tdav_session_t140.h new file mode 100644 index 0000000..a569d3a --- /dev/null +++ b/tinyDAV/include/tinydav/t140/tdav_session_t140.h @@ -0,0 +1,98 @@ +/* +* Copyright (C) 2012 Doubango Telecom <http://www.doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +* +*/ + +/**@file tdav_session_t140.h + * @brief Session for T140 protocol (RFC 4103) + */ +#ifndef TINYDAV_SESSION_T140_H +#define TINYDAV_SESSION_T140_H + +#include "tinydav_config.h" + +#include "tinydav/tdav_session_av.h" +#include "tsk_timer.h" + +TDAV_BEGIN_DECLS + +#define TDAV_SESSION_T140(self) ((tdav_session_t140_t*)(self)) + +typedef tsk_list_t tdav_session_t140_blocks_L_t; + +typedef struct tdav_session_t140_s +{ + TDAV_DECLARE_SESSION_AV; + + tsk_bool_t started; + tsk_timer_manager_handle_t *h_timer; + + struct{ + const void* context; + tmedia_session_t140_ondata_cb_f func; + } cb_ondata; + + struct { + uint32_t payload_type; + struct tmedia_codec_s* codec; + + void* buffer; + tsk_size_t buffer_size; + tsk_size_t buffer_idx; + + void* red_buffer; + tsk_size_t red_buffer_size; + + tdav_session_t140_blocks_L_t* blocks; + int64_t blocks_count; + struct{ + tsk_timer_id_t id; + int64_t timeout; + }timer_buffering; + struct{ + tsk_timer_id_t id; + int64_t timeout; + }timer_idle; + } encoder; + + struct { + uint32_t payload_type; + struct tmedia_codec_s* codec; + + void* buffer; + tsk_size_t buffer_size; + + void* consumer_buffer; + tsk_size_t consumer_buffer_size; + + tdav_session_t140_blocks_L_t* blocks; + int64_t blocks_count; + int32_t last_seq_num; + struct{ + tsk_timer_id_t id; + int64_t timeout; + }timer_pkt_loss; + } decoder; +} +tdav_session_t140_t; + +TINYDAV_GEXTERN const tmedia_session_plugin_def_t *tdav_session_t140_plugin_def_t; + +TDAV_END_DECLS + +#endif /* TINYDAV_SESSION_T140_H */ diff --git a/tinyDAV/include/tinydav/tdav.h b/tinyDAV/include/tinydav/tdav.h new file mode 100644 index 0000000..8318771 --- /dev/null +++ b/tinyDAV/include/tinydav/tdav.h @@ -0,0 +1,96 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +* +*/ +/**@file tdav.h + * @brief tinyDAV. + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#ifndef TINYMEDIA_TDAV_H +#define TINYMEDIA_TDAV_H + +#include "tinydav_config.h" + +#include "tsk_common.h" /* tsk_bool_t */ +#include "tinymedia/tmedia_codec.h" /* tmedia_codec_id_t */ + +TDAV_BEGIN_DECLS + +// @tinyWRAP +// @deprecated: to be replaced by "tmedia_codec_id_t" in Doubango 3.0 +typedef enum tdav_codec_id_e +{ + tdav_codec_id_none = tmedia_codec_id_none, + + tdav_codec_id_amr_nb_oa = tmedia_codec_id_amr_nb_oa, + tdav_codec_id_amr_nb_be = tmedia_codec_id_amr_nb_be, + tdav_codec_id_amr_wb_oa = tmedia_codec_id_amr_wb_oa, + tdav_codec_id_amr_wb_be = tmedia_codec_id_amr_wb_be, + tdav_codec_id_gsm = tmedia_codec_id_gsm, + tdav_codec_id_pcma = tmedia_codec_id_pcma, + tdav_codec_id_pcmu = tmedia_codec_id_pcmu, + tdav_codec_id_ilbc = tmedia_codec_id_ilbc, + tdav_codec_id_speex_nb = tmedia_codec_id_speex_nb, + tdav_codec_id_speex_wb = tmedia_codec_id_speex_wb, + tdav_codec_id_speex_uwb = tmedia_codec_id_speex_uwb, + tdav_codec_id_bv16 = tmedia_codec_id_bv16, + tdav_codec_id_bv32 = tmedia_codec_id_bv32, + tdav_codec_id_opus = tmedia_codec_id_opus, + tdav_codec_id_g729ab = tmedia_codec_id_g729ab, + tdav_codec_id_g722 = tmedia_codec_id_g722, + + /* room for new Audio codecs */ + + tdav_codec_id_h261 = tmedia_codec_id_h261, + tdav_codec_id_h263 = tmedia_codec_id_h263, + tdav_codec_id_h263p = tmedia_codec_id_h263p, + tdav_codec_id_h263pp = tmedia_codec_id_h263pp, + tdav_codec_id_h264_bp = tmedia_codec_id_h264_bp, + tdav_codec_id_h264_mp = tmedia_codec_id_h264_mp, + tdav_codec_id_h264_hp = tmedia_codec_id_h264_hp, + tdav_codec_id_h264_bp10 = tmedia_codec_id_h264_bp, // @deprecated + tdav_codec_id_h264_bp20 = tmedia_codec_id_h264_bp, // @deprecated + tdav_codec_id_h264_bp30 = tmedia_codec_id_h264_bp, // @deprecated + tdav_codec_id_h264_svc = tmedia_codec_id_h264_svc, + tdav_codec_id_theora = tmedia_codec_id_theora, + tdav_codec_id_mp4ves_es = tmedia_codec_id_mp4ves_es, + tdav_codec_id_vp8 = tmedia_codec_id_vp8, + + /* room for new Video codecs */ + + tdav_codec_id_t140 = tmedia_codec_id_t140, + tdav_codec_id_red = tmedia_codec_id_red, +} +tdav_codec_id_t; + +TINYDAV_API int tdav_init(); +TINYDAV_API int tdav_codec_set_priority(tdav_codec_id_t codec_id, int priority); +TINYDAV_API int tdav_set_codecs(tdav_codec_id_t codecs); +TINYDAV_API tsk_bool_t tdav_codec_is_supported(tdav_codec_id_t codec); +TINYDAV_API tsk_bool_t tdav_codec_is_enabled(tdav_codec_id_t codec); +TINYDAV_API tsk_bool_t tdav_ipsec_is_supported(); +TINYDAV_API int tdav_deinit(); + +TDAV_END_DECLS + +#endif /* TINYMEDIA_TDAV_H */ diff --git a/tinyDAV/include/tinydav/tdav_apple.h b/tinyDAV/include/tinydav/tdav_apple.h new file mode 100644 index 0000000..00a09d6 --- /dev/null +++ b/tinyDAV/include/tinydav/tdav_apple.h @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2010-2011 Mamadou Diop. + * + * Contact: Mamadou Diop <diopmamadou(at)doubango.org> + * + * This file is part of Open Source Doubango Framework. + * + * DOUBANGO is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * DOUBANGO 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 General Public License + * along with DOUBANGO. + * + */ + +#ifndef TDAV_APPLE_H +#define TDAV_APPLE_H + +#include "tinydav_config.h" + +#if TDAV_UNDER_APPLE + +TDAV_BEGIN_DECLS + +int tdav_apple_init(); +int tdav_apple_enable_audio(); +int tdav_apple_deinit(); + +TDAV_END_DECLS + +#endif /* TDAV_UNDER_APPLE */ + +#endif /* TDAV_APPLE_H */
\ No newline at end of file diff --git a/tinyDAV/include/tinydav/tdav_session_av.h b/tinyDAV/include/tinydav/tdav_session_av.h new file mode 100644 index 0000000..3460fbf --- /dev/null +++ b/tinyDAV/include/tinydav/tdav_session_av.h @@ -0,0 +1,153 @@ +/* +* Copyright (C) 2012-2013 Doubango Telecom <http://www.doubango.org> +* Copyright (C) 2012 Diop Mamadou Ibrahima +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +* +*/ + +/**@file tdav_session_av.h + * @brief Audio/Video/T.140 base Session plugin + */ + +#ifndef TINYDAV_SESSION_AV_H +#define TINYDAV_SESSION_AV_H + +#include "tinydav_config.h" + +#include "tinymedia/tmedia_session.h" + +#include "tnet_nat.h" + +#include "tsk_safeobj.h" + +TDAV_BEGIN_DECLS + +#define TDAV_SESSION_AV(self) ((tdav_session_av_t*)(self)) + +typedef struct tdav_session_av_s +{ + TMEDIA_DECLARE_SESSION; + + tsk_bool_t use_ipv6; + tsk_bool_t use_rtcp; + tsk_bool_t use_rtcpmux; + enum tmedia_type_e media_type; + enum tmedia_profile_e media_profile; + enum tmedia_mode_e avpf_mode_set; + enum tmedia_mode_e avpf_mode_neg; + tsk_bool_t is_fb_fir_neg; // a=rtcp-fb:* ccm fir + tsk_bool_t is_fb_nack_neg; // a=rtcp-fb:* nack + tsk_bool_t is_fb_googremb_neg; // a=rtcp-fb:* goog-remb + tsk_bool_t use_srtp; + tsk_bool_t is_webrtc2sip_mode_enabled; + uint32_t rtp_ssrc; + + tmedia_srtp_type_t srtp_type; + tmedia_srtp_mode_t srtp_mode; + struct { + uint64_t count_last_time; + uint64_t count; + } bytes_in; + struct { + uint64_t count_last_time; + uint64_t count; + } bytes_out; + uint64_t time_last_frame_loss_report; // from jb + int32_t bandwidth_max_upload_kbps; + int32_t bandwidth_max_download_kbps; + int32_t fps; + tsk_bool_t congestion_ctrl_enabled; + tmedia_pref_video_size_t pref_size; // output + + /* sdp capabilities (RFC 5939) */ + struct tdav_sdp_caps_s* sdp_caps; + + /* NAT Traversal context */ + struct tnet_nat_ctx_s* natt_ctx; + struct tnet_ice_ctx_s* ice_ctx; + + char* local_ip; + char* remote_ip; + uint16_t remote_port; + struct tsdp_message_s* remote_sdp; + struct tsdp_message_s* local_sdp; + + struct trtp_manager_s* rtp_manager; + + struct tmedia_consumer_s* consumer; + struct tmedia_producer_s* producer; + + struct{ + struct{ + tnet_dtls_setup_t setup; + tsk_bool_t connection_new; // "new | existing" + } local; + struct{ + tnet_dtls_setup_t setup; + tsk_bool_t connection_new; // "new | existing" + } remote; + } dtls; + + struct{ + uint8_t payload_type; + struct tmedia_codec_s* codec; + uint16_t seq_num; + uint32_t timestamp; + } ulpfec; + + struct{ + uint8_t payload_type; + struct tmedia_codec_s* codec; + } red; + + struct{ + char* reason; + tsk_bool_t is_fatal; + void* tid[1]; + } last_error; + + // codec's payload type mapping used when bypassing is enabled + struct{ + int8_t local; + int8_t remote; + int8_t neg; + } pt_map; + + TSK_DECLARE_SAFEOBJ; +} +tdav_session_av_t; + +#define TDAV_DECLARE_SESSION_AV tdav_session_av_t __session_av__ + +int tdav_session_av_init(tdav_session_av_t* self, tmedia_type_t media_type); +tsk_bool_t tdav_session_av_set(tdav_session_av_t* self, const struct tmedia_param_s* param); +tsk_bool_t tdav_session_av_get(tdav_session_av_t* self, struct tmedia_param_s* param); +int tdav_session_av_prepare(tdav_session_av_t* self); +int tdav_session_av_init_encoder(tdav_session_av_t* self, struct tmedia_codec_s* encoder); +int tdav_session_av_start(tdav_session_av_t* self, const struct tmedia_codec_s* best_codec); +int tdav_session_av_stop(tdav_session_av_t* self); +int tdav_session_av_pause(tdav_session_av_t* self); +const tsdp_header_M_t* tdav_session_av_get_lo(tdav_session_av_t* self, tsk_bool_t *updated); +int tdav_session_av_set_ro(tdav_session_av_t* self, const struct tsdp_header_M_s* m, tsk_bool_t *updated); +const tmedia_codec_t* tdav_session_av_get_best_neg_codec(const tdav_session_av_t* self); +const tmedia_codec_t* tdav_session_av_get_red_codec(const tdav_session_av_t* self); +const tmedia_codec_t* tdav_session_av_get_ulpfec_codec(const tdav_session_av_t* self); +int tdav_session_av_deinit(tdav_session_av_t* self); + +TDAV_END_DECLS + +#endif
\ No newline at end of file diff --git a/tinyDAV/include/tinydav/tdav_win32.h b/tinyDAV/include/tinydav/tdav_win32.h new file mode 100644 index 0000000..cd31fe6 --- /dev/null +++ b/tinyDAV/include/tinydav/tdav_win32.h @@ -0,0 +1,53 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +* +*/ +/**@file tdav_win32.h + * @brief tinyDAV WIN32 helper functions. + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#ifndef TINYMEDIA_TDAV_WIN32_H +#define TINYMEDIA_TDAV_WIN32_H + +#include "tinydav_config.h" + +#include "tsk_common.h" /* tsk_bool_t */ + +#if TDAV_UNDER_WINDOWS + +TDAV_BEGIN_DECLS + +int tdav_win32_init(); +int tdav_win32_get_osversion(unsigned long* version_major, unsigned long* version_minor); +tsk_bool_t tdav_win32_is_win8_or_later(); +tsk_bool_t tdav_win32_is_win7_or_later(); +tsk_bool_t tdav_win32_is_winvista_or_later(); +tsk_bool_t tdav_win32_is_winxp_or_later(); +const char* tdav_get_current_directory_const(); +int tdav_win32_deinit(); + +TDAV_END_DECLS + +#endif /* TDAV_UNDER_WINDOWS */ + +#endif /* TINYMEDIA_TDAV_WIN32_H */ diff --git a/tinyDAV/include/tinydav/video/directx/tdav_producer_screencast_d3d9.h b/tinyDAV/include/tinydav/video/directx/tdav_producer_screencast_d3d9.h new file mode 100644 index 0000000..5c134d0 --- /dev/null +++ b/tinyDAV/include/tinydav/video/directx/tdav_producer_screencast_d3d9.h @@ -0,0 +1,36 @@ +/* Copyright (C) 2015 Mamadou DIOP. +* Copyright (C) 2015 Doubango Telecom. +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +*/ +#ifndef TINYDAV_PRODUCER_SCREENCAST_D3D9_H +#define TINYDAV_PRODUCER_SCREENCAST_D3D9_H + +#include "tinydav_config.h" + +#if TDAV_UNDER_WINDOWS && !TDAV_UNDER_WINDOWS_RT + +#include "tinymedia/tmedia_producer.h" + +TDAV_BEGIN_DECLS + +TINYDAV_GEXTERN const tmedia_producer_plugin_def_t *tdav_producer_screencast_d3d9_plugin_def_t; + +TDAV_END_DECLS + +#endif /* TDAV_UNDER_WINDOWS && !TDAV_UNDER_WINDOWS_RT */ + +#endif /* TINYDAV_PRODUCER_SCREENCAST_D3D9_H */ diff --git a/tinyDAV/include/tinydav/video/directx/tdav_producer_screencast_ddraw.h b/tinyDAV/include/tinydav/video/directx/tdav_producer_screencast_ddraw.h new file mode 100644 index 0000000..a499202 --- /dev/null +++ b/tinyDAV/include/tinydav/video/directx/tdav_producer_screencast_ddraw.h @@ -0,0 +1,37 @@ +/* Copyright (C) 2015 Mamadou DIOP. +* Copyright (C) 2015 Doubango Telecom. +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +*/ +#ifndef TINYDAV_PRODUCER_SCREENCAST_DDRAW_H +#define TINYDAV_PRODUCER_SCREENCAST_DDRAW_H + +#include "tinydav_config.h" + +#if TDAV_UNDER_WINDOWS && !TDAV_UNDER_WINDOWS_RT + +#include "tinymedia/tmedia_producer.h" + +TDAV_BEGIN_DECLS + +tsk_bool_t tdav_producer_screencast_ddraw_plugin_is_supported(); +TINYDAV_GEXTERN const tmedia_producer_plugin_def_t *tdav_producer_screencast_ddraw_plugin_def_t; + +TDAV_END_DECLS + +#endif /* TDAV_UNDER_WINDOWS && !TDAV_UNDER_WINDOWS_RT */ + +#endif /* TINYDAV_PRODUCER_SCREENCAST_DDRAW_H */ diff --git a/tinyDAV/include/tinydav/video/gdi/tdav_consumer_video_gdi.h b/tinyDAV/include/tinydav/video/gdi/tdav_consumer_video_gdi.h new file mode 100644 index 0000000..5609e9d --- /dev/null +++ b/tinyDAV/include/tinydav/video/gdi/tdav_consumer_video_gdi.h @@ -0,0 +1,35 @@ +/* Copyright (C) 2014 Mamadou DIOP +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +*/ +#ifndef TINYDAV_CONSUMER_VIDEO_GDI_H +#define TINYDAV_CONSUMER_VIDEO_GDI_H + +#include "tinydav_config.h" + +#if TDAV_UNDER_WINDOWS && !TDAV_UNDER_WINDOWS_RT + +#include "tinymedia/tmedia_consumer.h" + +TDAV_BEGIN_DECLS + +TINYDAV_GEXTERN const tmedia_consumer_plugin_def_t *tdav_consumer_video_gdi_plugin_def_t; + +TDAV_END_DECLS + +#endif /* TDAV_UNDER_WINDOWS && !TDAV_UNDER_WINDOWS_RT */ + +#endif /* TINYDAV_CONSUMER_VIDEO_GDI_H */ diff --git a/tinyDAV/include/tinydav/video/gdi/tdav_producer_screencast_gdi.h b/tinyDAV/include/tinydav/video/gdi/tdav_producer_screencast_gdi.h new file mode 100644 index 0000000..f50901e --- /dev/null +++ b/tinyDAV/include/tinydav/video/gdi/tdav_producer_screencast_gdi.h @@ -0,0 +1,35 @@ +/* Copyright (C) 2014-2015 Mamadou DIOP. +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +*/ +#ifndef TINYDAV_PRODUCER_SCREENCAST_GDI_H +#define TINYDAV_PRODUCER_SCREENCAST_GDI_H + +#include "tinydav_config.h" + +#if TDAV_UNDER_WINDOWS && !TDAV_UNDER_WINDOWS_RT + +#include "tinymedia/tmedia_producer.h" + +TDAV_BEGIN_DECLS + +TINYDAV_GEXTERN const tmedia_producer_plugin_def_t *tdav_producer_screencast_gdi_plugin_def_t; + +TDAV_END_DECLS + +#endif /* TDAV_UNDER_WINDOWS && !TDAV_UNDER_WINDOWS_RT */ + +#endif /* TINYDAV_PRODUCER_SCREENCAST_GDI_H */
\ No newline at end of file diff --git a/tinyDAV/include/tinydav/video/jb/tdav_video_frame.h b/tinyDAV/include/tinydav/video/jb/tdav_video_frame.h new file mode 100644 index 0000000..798f848 --- /dev/null +++ b/tinyDAV/include/tinydav/video/jb/tdav_video_frame.h @@ -0,0 +1,68 @@ +/* +* Copyright (C) 2012 Doubango Telecom <http://www.doubango.org> +* +* Contact: Mamadou Diop <diopmamadou(at)doubango(DOT)org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +* +*/ + +/**@file tdav_video_frame.h + * @brief Video Frame + * + * @author Mamadou Diop <diopmamadou(at)doubango(DOT)org> + */ +#ifndef TINYDAV_VIDEO_JB_FRAME_H +#define TINYDAV_VIDEO_JB_FRAME_H + +#include "tinydav_config.h" + +#include "tinyrtp/rtp/trtp_rtp_packet.h" + +#include "tsk_safeobj.h" +#include "tsk_list.h" + +TDAV_BEGIN_DECLS + +#define TDAV_VIDEO_FRAME(self) ((tdav_video_frame_t*)(self)) + +typedef uint16_t tdav_video_frame_seq_nums[16]; +typedef tsk_list_t tdav_video_frames_L_t; + +typedef struct tdav_video_frame_s +{ + TSK_DECLARE_OBJECT; + + uint8_t payload_type; + uint32_t timestamp; + uint16_t highest_seq_num; + uint32_t ssrc; + trtp_rtp_packets_L_t* pkts; + + TSK_DECLARE_SAFEOBJ; +} +tdav_video_frame_t; + +struct tdav_video_frame_s* tdav_video_frame_create(struct trtp_rtp_packet_s* rtp_pkt); +int tdav_video_frame_put(struct tdav_video_frame_s* self, struct trtp_rtp_packet_s* rtp_pkt); +const struct trtp_rtp_packet_s* tdav_video_frame_find_by_seq_num(const struct tdav_video_frame_s* self, uint16_t seq_num); +tsk_size_t tdav_video_frame_write(struct tdav_video_frame_s* self, void** buffer_ptr, tsk_size_t* buffer_size); +tsk_bool_t tdav_video_frame_is_complete(const struct tdav_video_frame_s* self, int32_t last_seq_num_with_mark, int32_t* missing_seq_num_start, int32_t* missing_seq_num_count); +#define tdav_video_frame_is_complete_2(self, last_seq_num_with_mark) tdav_video_frame_is_complete((self), (last_seq_num_with_mark), tsk_null, tsk_null) + +TDAV_END_DECLS + +#endif /* TINYDAV_VIDEO_JB_FRAME_H */ diff --git a/tinyDAV/include/tinydav/video/jb/tdav_video_jb.h b/tinyDAV/include/tinydav/video/jb/tdav_video_jb.h new file mode 100644 index 0000000..e47e18b --- /dev/null +++ b/tinyDAV/include/tinydav/video/jb/tdav_video_jb.h @@ -0,0 +1,88 @@ +/* +* Copyright (C) 2012 Doubango Telecom <http://www.doubango.org> +* +* Contact: Mamadou Diop <diopmamadou(at)doubango(DOT)org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +* +*/ + +/**@file tdav_video_jb.h + * @brief Video Jitter Buffer + * + * @author Mamadou Diop <diopmamadou(at)doubango(DOT)org> + */ +#ifndef TINYDAV_VIDEO_JB_H +#define TINYDAV_VIDEO_JB_H + +#include "tinydav_config.h" + +#include "tinymedia/tmedia_jitterbuffer.h" + +#include "tsk_buffer.h" +#include "tsk_timer.h" +#include "tsk_list.h" +#include "tsk_safeobj.h" + +TDAV_BEGIN_DECLS + +typedef enum tdav_video_jb_cb_data_type_e +{ + tdav_video_jb_cb_data_type_rtp, + tdav_video_jb_cb_data_type_fl, // frame lost + tdav_video_jb_cb_data_type_tmfr, // too many frames removed + tdav_video_jb_cb_data_type_fdd, // average frame decoding duration + tdav_video_jb_cb_data_type_fps_changed, // fps changed, detection done using the timestamp +} +tdav_video_jb_cb_data_type_t; + +typedef struct tdav_video_jb_cb_data_xs +{ + tdav_video_jb_cb_data_type_t type; + uint32_t ssrc; + const void* usr_data; + union{ + struct{ + const struct trtp_rtp_packet_s* pkt; + }rtp; + struct{ + uint16_t seq_num; + tsk_size_t count; + }fl; + struct{ + uint32_t x_dur; // expected duration in milliseconds + uint32_t a_dur; // actual duration in milliseconds + }fdd; + struct{ + uint32_t old; + uint32_t new; + }fps; + }; +} +tdav_video_jb_cb_data_xt; + +typedef int (*tdav_video_jb_cb_f)(const tdav_video_jb_cb_data_xt* data); +#define TDAV_VIDEO_JB_CB_F(self) ((tdav_video_jb_cb_f)(self)) + +struct tdav_video_jb_s* tdav_video_jb_create(); +int tdav_video_jb_set_callback(struct tdav_video_jb_s* self, tdav_video_jb_cb_f callback, const void* usr_data); +int tdav_video_jb_start(struct tdav_video_jb_s* self); +int tdav_video_jb_put(struct tdav_video_jb_s* self, struct trtp_rtp_packet_s* rtp_pkt); +int tdav_video_jb_stop(struct tdav_video_jb_s* self); + +TDAV_END_DECLS + +#endif /* TINYDAV_VIDEO_JB_H */ diff --git a/tinyDAV/include/tinydav/video/mf/tdav_consumer_video_mf.h b/tinyDAV/include/tinydav/video/mf/tdav_consumer_video_mf.h new file mode 100644 index 0000000..277c1cc --- /dev/null +++ b/tinyDAV/include/tinydav/video/mf/tdav_consumer_video_mf.h @@ -0,0 +1,39 @@ +/*Copyright (C) 2013 Doubango Telecom <http://www.doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +*/ +/**@file tdav_consumer_video_mf.h + * @brief Microsoft Media Foundation video consumer (header). + * http://msdn.microsoft.com/en-us/library/windows/desktop/ms694197(v=vs.85).aspx + */ +#ifndef TINYDAV_CONSUMER_VIDEO_MF_H +#define TINYDAV_CONSUMER_VIDEO_MF_H + +#include "tinydav_config.h" + +#if HAVE_MF + +#include "tinydav/video/tdav_consumer_video.h" + +TDAV_BEGIN_DECLS + +TINYDAV_GEXTERN const struct tmedia_consumer_plugin_def_s *tdav_consumer_video_mf_plugin_def_t; + +TDAV_END_DECLS + +#endif /* HAVE_MF */ + +#endif /* TINYDAV_CONSUMER_VIDEO_MF_H */ diff --git a/tinyDAV/include/tinydav/video/mf/tdav_producer_video_mf.h b/tinyDAV/include/tinydav/video/mf/tdav_producer_video_mf.h new file mode 100644 index 0000000..d1ee296 --- /dev/null +++ b/tinyDAV/include/tinydav/video/mf/tdav_producer_video_mf.h @@ -0,0 +1,39 @@ +/*Copyright (C) 2013 Doubango Telecom <http://www.doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +*/ +/**@file tdav_producer_video_mf.h + * @brief Microsoft Media Foundation video producer (header). + * http://msdn.microsoft.com/en-us/library/windows/desktop/ms694197(v=vs.85).aspx + */ +#ifndef TINYDAV_PRODUCER_VIDEO_MF_H +#define TINYDAV_PRODUCER_VIDEO_MF_H + +#include "tinydav_config.h" + +#if HAVE_MF + +#include "tinymedia/tmedia_producer.h" + +TDAV_BEGIN_DECLS + +TINYDAV_GEXTERN const struct tmedia_producer_plugin_def_s *tdav_producer_video_mf_plugin_def_t; + +TDAV_END_DECLS + +#endif /* HAVE_MF */ + +#endif /* TINYDAV_PRODUCER_VIDEO_MF_H */ diff --git a/tinyDAV/include/tinydav/video/tdav_consumer_video.h b/tinyDAV/include/tinydav/video/tdav_consumer_video.h new file mode 100644 index 0000000..a2bb966 --- /dev/null +++ b/tinyDAV/include/tinydav/video/tdav_consumer_video.h @@ -0,0 +1,71 @@ +/* +* Copyright (C) 2011 Doubango Telecom <http://www.doubango.org> +* +* Contact: Mamadou Diop <diopmamadou(at)doubango(DOT)org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +* +*/ + +/**@file tdav_consumer_video.h + * @brief Base class for all Video consumers. + * + * @author Mamadou Diop <diopmamadou(at)doubango(DOT)org> + */ +#ifndef TINYDAV_CONSUMER_VIDEO_H +#define TINYDAV_CONSUMER_VIDEO_H + +#include "tinydav_config.h" + +#include "tinymedia/tmedia_consumer.h" + +#include "tsk_safeobj.h" + +TDAV_BEGIN_DECLS + +#define TDAV_CONSUMER_VIDEO(self) ((tdav_consumer_video_t*)(self)) + +typedef struct tdav_consumer_video_s +{ + TMEDIA_DECLARE_CONSUMER; + + struct tmedia_jitterbuffer_s* jitterbuffer; + + TSK_DECLARE_SAFEOBJ; +} +tdav_consumer_video_t; + +TINYDAV_API int tdav_consumer_video_init(tdav_consumer_video_t* self); +TINYDAV_API int tdav_consumer_video_cmp(const tsk_object_t* consumer1, const tsk_object_t* consumer2); +#define tdav_consumer_video_prepare(self, codec) tmedia_consumer_prepare(TDAV_CONSUMER_VIDEO(self), codec) +#define tdav_consumer_video_start(self) tmedia_consumer_start(TDAV_CONSUMER_VIDEO(self)) +#define tdav_consumer_video_consume(self, buffer, size) tmedia_consumer_consume(TDAV_CONSUMER_VIDEO(self), buffer, size) +#define tdav_consumer_video_pause(self) tmedia_consumer_pause(TDAV_CONSUMER_VIDEO(self)) +#define tdav_consumer_video_stop(self) tmedia_consumer_stop(TDAV_CONSUMER_VIDEO(self)) +#define tdav_consumer_video_has_jb(self) ((self) && (self)->jitterbuffer) +TINYDAV_API int tdav_consumer_video_set(tdav_consumer_video_t* self, const tmedia_param_t* param); +TINYDAV_API int tdav_consumer_video_put(tdav_consumer_video_t* self, const void* data, tsk_size_t data_size, const tsk_object_t* proto_hdr); +TINYDAV_API tsk_size_t tdav_consumer_video_get(tdav_consumer_video_t* self, void* out_data, tsk_size_t out_size); +TINYDAV_API int tdav_consumer_video_tick(tdav_consumer_video_t* self); +TINYDAV_API int tdav_consumer_video_reset(tdav_consumer_video_t* self); +TINYDAV_API int tdav_consumer_video_deinit(tdav_consumer_video_t* self); + +#define TDAV_DECLARE_CONSUMER_VIDEO tdav_consumer_video_t __consumer_video__ + +TDAV_END_DECLS + + +#endif /* TINYDAV_CONSUMER_VIDEO_H */ diff --git a/tinyDAV/include/tinydav/video/tdav_converter_video.h b/tinyDAV/include/tinydav/video/tdav_converter_video.h new file mode 100644 index 0000000..2ab3144 --- /dev/null +++ b/tinyDAV/include/tinydav/video/tdav_converter_video.h @@ -0,0 +1,47 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +* +*/ +/**@file tdav_converter_video.h + * @brief Video converter. + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#ifndef TINYDAV_CONVERTER_VIDEO_H +#define TINYDAV_CONVERTER_VIDEO_H + +#include "tinydav_config.h" + +#include "tinymedia/tmedia_converter_video.h" + +TDAV_BEGIN_DECLS + +#if HAVE_LIBYUV +extern const tmedia_converter_video_plugin_def_t *tdav_converter_video_libyuv_plugin_def_t; +#endif /* HAVE_LIBYUV */ +#if HAVE_FFMPEG || HAVE_SWSSCALE +extern const tmedia_converter_video_plugin_def_t *tdav_converter_video_ffmpeg_plugin_def_t; +#endif /* if HAVE_FFMPEG || HAVE_SWSSCALE */ + +TDAV_END_DECLS + +#endif /* TINYDAV_CONVERTER_VIDEO_H */ diff --git a/tinyDAV/include/tinydav/video/tdav_runnable_video.h b/tinyDAV/include/tinydav/video/tdav_runnable_video.h new file mode 100644 index 0000000..4c8aef1 --- /dev/null +++ b/tinyDAV/include/tinydav/video/tdav_runnable_video.h @@ -0,0 +1,54 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +* +*/ +/**@file tdav_runnable_video.h + * @brief Video runnable used by codecs. + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#ifndef TINYDAV_RUNNABLE_VIDEO_H +#define TINYDAV_RUNNABLE_VIDEO_H + +#include "tinydav_config.h" + +#include "tsk_runnable.h" + +TDAV_BEGIN_DECLS + +typedef struct tdav_runnable_video_s +{ + TSK_DECLARE_RUNNABLE; + + const void* userdata; +} +tdav_runnable_video_t; + +tdav_runnable_video_t* tdav_runnable_video_create(tsk_runnable_func_run run_f, const void* userdata); +int tdav_runnable_video_start(tdav_runnable_video_t* self); +int tdav_runnable_video_stop(tdav_runnable_video_t* self); + +TINYDAV_GEXTERN const tsk_object_def_t *tdav_runnable_video_def_t; + +TDAV_END_DECLS + +#endif /* TINYDAV_RUNNABLE_VIDEO_H */ diff --git a/tinyDAV/include/tinydav/video/tdav_session_video.h b/tinyDAV/include/tinydav/video/tdav_session_video.h new file mode 100644 index 0000000..a1cb7d4 --- /dev/null +++ b/tinyDAV/include/tinydav/video/tdav_session_video.h @@ -0,0 +1,130 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +* +*/ + +/**@file tdav_session_video.h + * @brief Video Session plugin. + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#ifndef TINYDAV_SESSION_VIDEO_H +#define TINYDAV_SESSION_VIDEO_H + +#include "tinydav_config.h" +#include "tinydav/tdav_session_av.h" + +TDAV_BEGIN_DECLS + +typedef enum tdav_session_video_pkt_loss_level_e +{ + tdav_session_video_pkt_loss_level_low, + tdav_session_video_pkt_loss_level_medium, + tdav_session_video_pkt_loss_level_high, +} +tdav_session_video_pkt_loss_level_t; + +typedef struct tdav_session_video_s +{ + TDAV_DECLARE_SESSION_AV; + + struct tdav_video_jb_s* jb; + tsk_bool_t jb_enabled; + tsk_bool_t zero_artifacts; + tsk_bool_t fps_changed; + tsk_bool_t started; + + struct{ + const void* context; + tmedia_session_rtcp_onevent_cb_f func; + } cb_rtcpevent; + + struct{ + void* buffer; + tsk_size_t buffer_size; + + int rotation; + tsk_bool_t scale_rotated_frames; + + void* conv_buffer; + tsk_size_t conv_buffer_size; + + tdav_session_video_pkt_loss_level_t pkt_loss_level; + int32_t pkt_loss_fact; + int32_t pkt_loss_prob_good; + int32_t pkt_loss_prob_bad; + + uint64_t last_frame_time; + + uint8_t payload_type; + struct tmedia_codec_s* codec; + tsk_mutex_handle_t* h_mutex; + } encoder; + + struct{ + void* buffer; + tsk_size_t buffer_size; + + void* conv_buffer; + tsk_size_t conv_buffer_size; + + // latest decoded RTP seqnum + uint16_t last_seqnum; + // stream is corrupted if packets are lost + tsk_bool_t stream_corrupted; + uint64_t stream_corrupted_since; + uint32_t last_corrupted_timestamp; + + uint8_t codec_payload_type; + struct tmedia_codec_s* codec; + uint64_t codec_decoded_frames_count; + } decoder; + + struct { + tsk_size_t consumerLastWidth; + tsk_size_t consumerLastHeight; + struct tmedia_converter_video_s* fromYUV420; + + tsk_size_t producerWidth; + tsk_size_t producerHeight; + tsk_size_t xProducerSize; + struct tmedia_converter_video_s* toYUV420; + } conv; + + struct{ + tsk_list_t* packets; + tsk_size_t count; + tsk_size_t max; + uint64_t last_fir_time; + uint64_t last_pli_time; + } avpf; +} +tdav_session_video_t; + +#define TDAV_SESSION_VIDEO(self) ((tdav_session_video_t*)(self)) + +TINYDAV_GEXTERN const tmedia_session_plugin_def_t *tdav_session_video_plugin_def_t; +TINYDAV_GEXTERN const tmedia_session_plugin_def_t *tdav_session_bfcpvideo_plugin_def_t; + +TDAV_END_DECLS + +#endif /* TINYDAV_SESSION_VIDEO_H */ diff --git a/tinyDAV/include/tinydav/video/v4linux/tdav_producer_video_v4l2.h b/tinyDAV/include/tinydav/video/v4linux/tdav_producer_video_v4l2.h new file mode 100644 index 0000000..496bfcb --- /dev/null +++ b/tinyDAV/include/tinydav/video/v4linux/tdav_producer_video_v4l2.h @@ -0,0 +1,37 @@ +/* Copyright (C) 2014 Mamadou DIOP. +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +*/ +#ifndef TINYDAV_PRODUCER_VIDEO_V4L2_H +#define TINYDAV_PRODUCER_VIDEO_V4L2_H + +#include "tinydav_config.h" + +#if HAVE_LINUX_VIDEODEV2_H + +#include "tinymedia/tmedia_producer.h" + +TDAV_BEGIN_DECLS + +TINYDAV_GEXTERN const tmedia_producer_plugin_def_t *tdav_producer_video_v4l2_plugin_def_t; +TINYDAV_GEXTERN const tmedia_producer_plugin_def_t *tdav_producer_screencast_v4l2_plugin_def_t; + +TDAV_END_DECLS + +#endif /* HAVE_LINUX_VIDEODEV2_H */ + +#endif /* TINYDAV_PRODUCER_VIDEO_V4L2_H */ + diff --git a/tinyDAV/include/tinydav/video/winm/tdav_consumer_winm.h b/tinyDAV/include/tinydav/video/winm/tdav_consumer_winm.h new file mode 100644 index 0000000..3bdd52c --- /dev/null +++ b/tinyDAV/include/tinydav/video/winm/tdav_consumer_winm.h @@ -0,0 +1,39 @@ +/*Copyright (C) 2013 Doubango Telecom <http://www.doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +*/ +/**@file tdav_consumer_winm.h + * @brief Microsoft Windows Media (WinM) consumer. + * + */ +#ifndef TINYDAV_CONSUMER_WINM_H +#define TINYDAV_CONSUMER_WINM_H + +#include "tinydav_config.h" + +#if HAVE_WINM + +#include "tinydav/video/tdav_consumer_video.h" + +TDAV_BEGIN_DECLS + +TINYDAV_GEXTERN const struct tmedia_consumer_plugin_def_s *tdav_consumer_winm_plugin_def_t; + +TDAV_END_DECLS + +#endif /* HAVE_WINM */ + +#endif /* TINYDAV_CONSUMER_WINM_H */ diff --git a/tinyDAV/include/tinydav/video/winm/tdav_producer_winm.h b/tinyDAV/include/tinydav/video/winm/tdav_producer_winm.h new file mode 100644 index 0000000..34d4254 --- /dev/null +++ b/tinyDAV/include/tinydav/video/winm/tdav_producer_winm.h @@ -0,0 +1,39 @@ +/*Copyright (C) 2013 Doubango Telecom <http://www.doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License +* along with DOUBANGO. +*/ +/**@file tdav_producer_winm.h + * @brief Microsoft Windows Media (WinM) producer. + * + */ +#ifndef TINYDAV_PRODUCER_WINM_H +#define TINYDAV_PRODUCER_WINM_H + +#include "tinydav_config.h" + +#if HAVE_WINM + +#include "tinymedia/tmedia_producer.h" + +TDAV_BEGIN_DECLS + +TINYDAV_GEXTERN const struct tmedia_producer_plugin_def_s *tdav_producer_winm_plugin_def_t; + +TDAV_END_DECLS + +#endif /* HAVE_WINM */ + +#endif /* TINYDAV_PRODUCER_WINM_H */ |