mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-18 07:47:17 +00:00
Remove audioflingersink
Remove audioflingersink, it's in gst-android now.
This commit is contained in:
parent
fb67a0d126
commit
290d598748
8 changed files with 0 additions and 2476 deletions
|
@ -111,7 +111,6 @@ CONFIGURE_TARGETS += gst-plugins-bad-configure
|
|||
-include $(GST_PLUGINS_BAD_TOP)/gst/asfmux/Android.mk
|
||||
-include $(GST_PLUGINS_BAD_TOP)/gst/videoparsers/Android.mk
|
||||
-include $(GST_PLUGINS_BAD_TOP)/ext/faad/Android.mk
|
||||
-include $(GST_PLUGINS_BAD_TOP)/sys/audioflingersink/Android.mk
|
||||
-include $(GST_PLUGINS_BAD_TOP)/gst/sdp/Android.mk
|
||||
-include $(GST_PLUGINS_BAD_TOP)/gst/hls/Android.mk
|
||||
-include $(GST_PLUGINS_BAD_TOP)/gst/jp2kdecimator/Android.mk
|
||||
|
|
|
@ -1,69 +0,0 @@
|
|||
# external/gstreamer/gstplayer/Android.mk
|
||||
#
|
||||
# Copyright 2009 STN wireless
|
||||
#
|
||||
#ifeq ($(USE_HARDWARE_MM),true)
|
||||
|
||||
LOCAL_PATH:= $(call my-dir)
|
||||
|
||||
# -------------------------------------
|
||||
# gstaudioflinger library
|
||||
#
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_ARM_MODE := arm
|
||||
|
||||
gstaudioflinger_FILES := \
|
||||
audioflinger_wrapper.cpp \
|
||||
gstaudioflingersink.c \
|
||||
GstAndroid.cpp
|
||||
|
||||
LOCAL_SRC_FILES := $(gstaudioflinger_FILES)
|
||||
LOCAL_C_INCLUDES = $(LOCAL_PATH) \
|
||||
$(LOCAL_PATH)/include \
|
||||
$(TOP)/frameworks/base
|
||||
|
||||
LOCAL_CFLAGS += -DHAVE_CONFIG_H
|
||||
LOCAL_CFLAGS += -Wall -Wdeclaration-after-statement -g -O2
|
||||
LOCAL_CFLAGS += -DANDROID_USE_GSTREAMER \
|
||||
$(shell $(PKG_CONFIG) gstreamer-plugins-bad-0.10 --cflags) \
|
||||
$(shell $(PKG_CONFIG) gstreamer-audio-0.10 --cflags)
|
||||
|
||||
ifeq ($(USE_AUDIO_PURE_CODEC),true)
|
||||
LOCAL_CFLAGS += -DAUDIO_PURE_CODEC
|
||||
endif
|
||||
|
||||
LOCAL_SHARED_LIBRARIES += libdl
|
||||
LOCAL_SHARED_LIBRARIES += \
|
||||
libgstreamer-0.10 \
|
||||
libgstbase-0.10 \
|
||||
libglib-2.0 \
|
||||
libgthread-2.0 \
|
||||
libgmodule-2.0 \
|
||||
libgobject-2.0 \
|
||||
libgstvideo-0.10 \
|
||||
libgstaudio-0.10
|
||||
|
||||
LOCAL_LDFLAGS := -L$(SYSROOT)/usr/lib -llog
|
||||
|
||||
LOCAL_SHARED_LIBRARIES += \
|
||||
libutils \
|
||||
libcutils \
|
||||
libui \
|
||||
libhardware \
|
||||
libandroid_runtime \
|
||||
libmedia
|
||||
|
||||
|
||||
LOCAL_MODULE:= libgstaudioflinger
|
||||
LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/gstreamer-0.10
|
||||
|
||||
#
|
||||
# define LOCAL_PRELINK_MODULE to false to not use pre-link map
|
||||
#
|
||||
LOCAL_PRELINK_MODULE := false
|
||||
LOCAL_MODULE_TAGS := eng debug
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
#endif # USE_HARDWARE_MM == true
|
|
@ -1,36 +0,0 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <poll.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <string.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
/* Helper functions */
|
||||
#include <gst/gst.h>
|
||||
|
||||
/* Object header */
|
||||
#include "gstaudioflingersink.h"
|
||||
|
||||
static gboolean plugin_init (GstPlugin * plugin)
|
||||
{
|
||||
gboolean ret = TRUE;
|
||||
|
||||
ret &= gst_audioflinger_sink_plugin_init (plugin);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Version number of package */
|
||||
#define VERSION "0.0.1"
|
||||
/* package name */
|
||||
#define PACKAGE "Android ST-ERICSSON"
|
||||
|
||||
|
||||
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
||||
GST_VERSION_MINOR,
|
||||
"audioflinger",
|
||||
"Android audioflinger library for gstreamer",
|
||||
plugin_init, VERSION, "LGPL", "libgstaudioflinger.so", "http://www.stericsson.com")
|
||||
|
|
@ -1,470 +0,0 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) <2009> Prajnashi S <prajnashi@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#define ENABLE_GST_PLAYER_LOG
|
||||
#include <media/AudioTrack.h>
|
||||
#include <utils/Log.h>
|
||||
#include <AudioFlinger.h>
|
||||
#include <MediaPlayerInterface.h>
|
||||
#include <MediaPlayerService.h>
|
||||
#include "audioflinger_wrapper.h"
|
||||
#include <glib/glib.h>
|
||||
//#include <GstLog.h>
|
||||
|
||||
|
||||
#define LOG_NDEBUG 0
|
||||
|
||||
#undef LOG_TAG
|
||||
#define LOG_TAG "audioflinger_wrapper"
|
||||
|
||||
|
||||
using namespace android;
|
||||
|
||||
|
||||
typedef struct _AudioFlingerDevice
|
||||
{
|
||||
AudioTrack* audio_track;
|
||||
bool init;
|
||||
sp<MediaPlayerBase::AudioSink> audio_sink;
|
||||
bool audio_sink_specified;
|
||||
} AudioFlingerDevice;
|
||||
|
||||
|
||||
/* commonly used macro */
|
||||
#define AUDIO_FLINGER_DEVICE(handle) ((AudioFlingerDevice*)handle)
|
||||
#define AUDIO_FLINGER_DEVICE_TRACK(handle) \
|
||||
(AUDIO_FLINGER_DEVICE(handle)->audio_track)
|
||||
#define AUDIO_FLINGER_DEVICE_SINK(handle) \
|
||||
(AUDIO_FLINGER_DEVICE(handle)->audio_sink)
|
||||
|
||||
|
||||
AudioFlingerDeviceHandle audioflinger_device_create()
|
||||
{
|
||||
AudioFlingerDevice* audiodev = NULL;
|
||||
AudioTrack *audiotr = NULL;
|
||||
|
||||
// create a new instance of AudioFlinger
|
||||
audiodev = new AudioFlingerDevice;
|
||||
if (audiodev == NULL) {
|
||||
LOGE("Error to create AudioFlingerDevice\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// create AudioTrack
|
||||
audiotr = new AudioTrack ();
|
||||
if (audiotr == NULL) {
|
||||
LOGE("Error to create AudioTrack\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
audiodev->init = false;
|
||||
audiodev->audio_track = (AudioTrack *) audiotr;
|
||||
audiodev->audio_sink = 0;
|
||||
audiodev->audio_sink_specified = false;
|
||||
LOGD("Create AudioTrack successfully %p\n",audiodev);
|
||||
|
||||
return (AudioFlingerDeviceHandle)audiodev;
|
||||
}
|
||||
|
||||
AudioFlingerDeviceHandle audioflinger_device_open(void* audio_sink)
|
||||
{
|
||||
AudioFlingerDevice* audiodev = NULL;
|
||||
|
||||
// audio_sink shall be an MediaPlayerBase::AudioSink instance
|
||||
if(audio_sink == NULL)
|
||||
return NULL;
|
||||
|
||||
// create a new instance of AudioFlinger
|
||||
audiodev = new AudioFlingerDevice;
|
||||
if (audiodev == NULL) {
|
||||
LOGE("Error to create AudioFlingerDevice\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// set AudioSink
|
||||
|
||||
audiodev->audio_sink = (MediaPlayerBase::AudioSink*)audio_sink;
|
||||
audiodev->audio_track = NULL;
|
||||
audiodev->init = false;
|
||||
audiodev->audio_sink_specified = true;
|
||||
LOGD("Open AudioSink successfully : %p\n",audiodev);
|
||||
|
||||
return (AudioFlingerDeviceHandle)audiodev;
|
||||
}
|
||||
|
||||
int audioflinger_device_set (AudioFlingerDeviceHandle handle,
|
||||
int streamType, int channelCount, uint32_t sampleRate, int bufferCount)
|
||||
{
|
||||
status_t status = NO_ERROR;
|
||||
#ifndef STECONF_ANDROID_VERSION_DONUT
|
||||
uint32_t channels = 0;
|
||||
#endif
|
||||
|
||||
int format = AudioSystem::PCM_16_BIT;
|
||||
|
||||
if (handle == NULL)
|
||||
return -1;
|
||||
|
||||
if(AUDIO_FLINGER_DEVICE_TRACK(handle)) {
|
||||
// bufferCount is not the number of internal buffer, but the internal
|
||||
// buffer size
|
||||
#ifdef STECONF_ANDROID_VERSION_DONUT
|
||||
status = AUDIO_FLINGER_DEVICE_TRACK(handle)->set(streamType, sampleRate,
|
||||
format, channelCount);
|
||||
LOGD("SET : handle : %p : Set AudioTrack, status: %d, streamType: %d, sampleRate: %d, "
|
||||
"channelCount: %d, bufferCount: %d\n",handle, status, streamType, sampleRate,
|
||||
channelCount, bufferCount);
|
||||
#else
|
||||
switch (channelCount)
|
||||
{
|
||||
case 1:
|
||||
channels = AudioSystem::CHANNEL_OUT_FRONT_LEFT;
|
||||
break;
|
||||
case 2:
|
||||
channels = AudioSystem::CHANNEL_OUT_STEREO;
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
channels = 0;
|
||||
break;
|
||||
}
|
||||
status = AUDIO_FLINGER_DEVICE_TRACK(handle)->set(streamType, sampleRate,
|
||||
format, channels/*, bufferCount*/);
|
||||
LOGD("SET handle : %p : Set AudioTrack, status: %d, streamType: %d, sampleRate: %d, "
|
||||
"channelCount: %d(%d), bufferCount: %d\n",handle, status, streamType, sampleRate,
|
||||
channelCount, channels, bufferCount);
|
||||
#endif
|
||||
AUDIO_FLINGER_DEVICE_TRACK(handle)->setPositionUpdatePeriod(bufferCount);
|
||||
|
||||
}
|
||||
else if(AUDIO_FLINGER_DEVICE_SINK(handle).get()) {
|
||||
#ifdef STECONF_ANDROID_VERSION_DONUT
|
||||
status = AUDIO_FLINGER_DEVICE_SINK(handle)->open(sampleRate, channelCount,
|
||||
format/*, bufferCount*/); //SDA
|
||||
|
||||
LOGD("OPEN : handle : %p : Set AudioSink, status: %d, streamType: %d, sampleRate: %d,"
|
||||
"channelCount: %d, bufferCount: %d\n", handle, status, streamType, sampleRate,
|
||||
channelCount, bufferCount);
|
||||
#else
|
||||
channels = channelCount;
|
||||
status = AUDIO_FLINGER_DEVICE_SINK(handle)->open(sampleRate, channels,
|
||||
format/*, bufferCount*/);
|
||||
LOGD("OPEN handle : %p : Set AudioSink, status: %d, streamType: %d, sampleRate: %d,"
|
||||
"channelCount: %d(%d), bufferCount: %d\n", handle, status, streamType, sampleRate,
|
||||
channelCount, channels, bufferCount);
|
||||
#endif
|
||||
AUDIO_FLINGER_DEVICE_TRACK(handle) = (AudioTrack *)(AUDIO_FLINGER_DEVICE_SINK(handle)->getTrack());
|
||||
if(AUDIO_FLINGER_DEVICE_TRACK(handle)) {
|
||||
AUDIO_FLINGER_DEVICE_TRACK(handle)->setPositionUpdatePeriod(bufferCount);
|
||||
}
|
||||
}
|
||||
|
||||
if (status != NO_ERROR)
|
||||
return -1;
|
||||
|
||||
AUDIO_FLINGER_DEVICE(handle)->init = true;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void audioflinger_device_release (AudioFlingerDeviceHandle handle)
|
||||
{
|
||||
if (handle == NULL)
|
||||
return;
|
||||
|
||||
LOGD("Enter\n");
|
||||
if(! AUDIO_FLINGER_DEVICE(handle)->audio_sink_specified ) {
|
||||
if (AUDIO_FLINGER_DEVICE_TRACK(handle) ) {
|
||||
LOGD("handle : %p Release AudioTrack\n", handle);
|
||||
delete AUDIO_FLINGER_DEVICE_TRACK(handle);
|
||||
}
|
||||
}
|
||||
if (AUDIO_FLINGER_DEVICE_SINK(handle).get()) {
|
||||
LOGD("handle : %p Release AudioSink\n", handle);
|
||||
AUDIO_FLINGER_DEVICE_SINK(handle).clear();
|
||||
AUDIO_FLINGER_DEVICE(handle)->audio_sink_specified = false;
|
||||
}
|
||||
|
||||
delete AUDIO_FLINGER_DEVICE(handle);
|
||||
}
|
||||
|
||||
|
||||
void audioflinger_device_start (AudioFlingerDeviceHandle handle)
|
||||
{
|
||||
if (handle == NULL || AUDIO_FLINGER_DEVICE(handle)->init == false)
|
||||
return;
|
||||
|
||||
LOGD("handle : %p Start Device\n", handle);
|
||||
|
||||
if(AUDIO_FLINGER_DEVICE(handle)->audio_sink_specified) {
|
||||
AUDIO_FLINGER_DEVICE_SINK(handle)->start();
|
||||
}
|
||||
else {
|
||||
AUDIO_FLINGER_DEVICE_TRACK(handle)->start();
|
||||
}
|
||||
}
|
||||
|
||||
void audioflinger_device_stop (AudioFlingerDeviceHandle handle)
|
||||
{
|
||||
if (handle == NULL || AUDIO_FLINGER_DEVICE(handle)->init == false)
|
||||
return;
|
||||
|
||||
LOGD("handle : %p Stop Device\n", handle);
|
||||
|
||||
if(AUDIO_FLINGER_DEVICE(handle)->audio_sink_specified) {
|
||||
AUDIO_FLINGER_DEVICE_SINK(handle)->stop();
|
||||
}
|
||||
else {
|
||||
AUDIO_FLINGER_DEVICE_TRACK(handle)->stop();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void audioflinger_device_flush (AudioFlingerDeviceHandle handle)
|
||||
{
|
||||
if (handle == NULL || AUDIO_FLINGER_DEVICE(handle)->init == false)
|
||||
return;
|
||||
|
||||
LOGD("handle : %p Flush device\n", handle);
|
||||
|
||||
if(AUDIO_FLINGER_DEVICE(handle)->audio_sink_specified) {
|
||||
AUDIO_FLINGER_DEVICE_SINK(handle)->flush();
|
||||
}
|
||||
else {
|
||||
AUDIO_FLINGER_DEVICE_TRACK(handle)->flush();
|
||||
}
|
||||
}
|
||||
|
||||
void audioflinger_device_pause (AudioFlingerDeviceHandle handle)
|
||||
{
|
||||
if (handle == NULL || AUDIO_FLINGER_DEVICE(handle)->init == false)
|
||||
return;
|
||||
|
||||
LOGD("handle : %p Pause Device\n", handle);
|
||||
|
||||
|
||||
if(AUDIO_FLINGER_DEVICE(handle)->audio_sink_specified) {
|
||||
AUDIO_FLINGER_DEVICE_SINK(handle)->pause();
|
||||
}
|
||||
else {
|
||||
AUDIO_FLINGER_DEVICE_TRACK(handle)->pause();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void audioflinger_device_mute (AudioFlingerDeviceHandle handle, int mute)
|
||||
{
|
||||
if (handle == NULL || AUDIO_FLINGER_DEVICE(handle)->init == false)
|
||||
return;
|
||||
|
||||
LOGD("handle : %p Mute Device\n", handle);
|
||||
|
||||
if(AUDIO_FLINGER_DEVICE(handle)->audio_sink_specified) {
|
||||
// do nothing here, because the volume/mute is set in media service layer
|
||||
}
|
||||
else if (AUDIO_FLINGER_DEVICE_TRACK(handle)) {
|
||||
AUDIO_FLINGER_DEVICE_TRACK(handle)->mute((bool)mute);
|
||||
}
|
||||
}
|
||||
|
||||
int audioflinger_device_muted (AudioFlingerDeviceHandle handle)
|
||||
{
|
||||
if (handle == NULL || AUDIO_FLINGER_DEVICE(handle)->init == false)
|
||||
return -1;
|
||||
|
||||
if(AUDIO_FLINGER_DEVICE(handle)->audio_sink_specified) {
|
||||
// do nothing here, because the volume/mute is set in media service layer
|
||||
return -1;
|
||||
}
|
||||
else if (AUDIO_FLINGER_DEVICE_TRACK(handle)) {
|
||||
return (int) AUDIO_FLINGER_DEVICE_TRACK(handle)->muted ();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
void audioflinger_device_set_volume (AudioFlingerDeviceHandle handle, float left,
|
||||
float right)
|
||||
{
|
||||
if (handle == NULL || AUDIO_FLINGER_DEVICE(handle)->init == false)
|
||||
return;
|
||||
|
||||
LOGD("handle : %p Set volume Device %f,%f\n", handle,left,right);
|
||||
|
||||
if(AUDIO_FLINGER_DEVICE(handle)->audio_sink_specified) {
|
||||
// do nothing here, because the volume/mute is set in media service layer
|
||||
return ;
|
||||
}
|
||||
else if (AUDIO_FLINGER_DEVICE_TRACK(handle)) {
|
||||
AUDIO_FLINGER_DEVICE_TRACK(handle)->setVolume (left, right);
|
||||
}
|
||||
}
|
||||
|
||||
ssize_t audioflinger_device_write (AudioFlingerDeviceHandle handle, const void *buffer,
|
||||
size_t size)
|
||||
{
|
||||
if (handle == NULL || AUDIO_FLINGER_DEVICE(handle)->init == false)
|
||||
return -1;
|
||||
|
||||
if(AUDIO_FLINGER_DEVICE(handle)->audio_sink_specified) {
|
||||
return AUDIO_FLINGER_DEVICE_SINK(handle)->write(buffer, size);
|
||||
}
|
||||
else if (AUDIO_FLINGER_DEVICE_TRACK(handle)) {
|
||||
return AUDIO_FLINGER_DEVICE_TRACK(handle)->write(buffer, size);
|
||||
}
|
||||
#ifndef STECONF_ANDROID_VERSION_DONUT
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
int audioflinger_device_frameCount (AudioFlingerDeviceHandle handle)
|
||||
{
|
||||
if (handle == NULL || AUDIO_FLINGER_DEVICE(handle)->init == false)
|
||||
return -1;
|
||||
|
||||
if(AUDIO_FLINGER_DEVICE(handle)->audio_sink_specified) {
|
||||
return (int)AUDIO_FLINGER_DEVICE_SINK(handle)->frameCount();
|
||||
}
|
||||
else if (AUDIO_FLINGER_DEVICE_TRACK(handle)) {
|
||||
return (int)AUDIO_FLINGER_DEVICE_TRACK(handle)->frameCount();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int audioflinger_device_frameSize (AudioFlingerDeviceHandle handle)
|
||||
{
|
||||
if (handle == NULL || AUDIO_FLINGER_DEVICE(handle)->init == false)
|
||||
return -1;
|
||||
|
||||
if(AUDIO_FLINGER_DEVICE(handle)->audio_sink_specified) {
|
||||
return (int)AUDIO_FLINGER_DEVICE_SINK(handle)->frameSize();
|
||||
}
|
||||
else if (AUDIO_FLINGER_DEVICE_TRACK(handle)) {
|
||||
return (int)AUDIO_FLINGER_DEVICE_TRACK(handle)->frameSize();
|
||||
}
|
||||
#ifndef STECONF_ANDROID_VERSION_DONUT
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
int64_t audioflinger_device_latency (AudioFlingerDeviceHandle handle)
|
||||
{
|
||||
if (handle == NULL || AUDIO_FLINGER_DEVICE(handle)->init == false)
|
||||
return -1;
|
||||
|
||||
if(AUDIO_FLINGER_DEVICE(handle)->audio_sink_specified) {
|
||||
return (int64_t)AUDIO_FLINGER_DEVICE_SINK(handle)->latency();
|
||||
}
|
||||
else if (AUDIO_FLINGER_DEVICE_TRACK(handle)) {
|
||||
return (int64_t)AUDIO_FLINGER_DEVICE_TRACK(handle)->latency();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int audioflinger_device_format (AudioFlingerDeviceHandle handle)
|
||||
{
|
||||
if (handle == NULL || AUDIO_FLINGER_DEVICE(handle)->init == false)
|
||||
return -1;
|
||||
|
||||
if(AUDIO_FLINGER_DEVICE(handle)->audio_sink_specified) {
|
||||
// do nothing here, MediaPlayerBase::AudioSink doesn't provide format()
|
||||
// interface
|
||||
return -1;
|
||||
}
|
||||
else if (AUDIO_FLINGER_DEVICE_TRACK(handle)) {
|
||||
return (int)AUDIO_FLINGER_DEVICE_TRACK(handle)->format();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int audioflinger_device_channelCount (AudioFlingerDeviceHandle handle)
|
||||
{
|
||||
if (handle == NULL || AUDIO_FLINGER_DEVICE(handle)->init == false)
|
||||
return -1;
|
||||
if(AUDIO_FLINGER_DEVICE(handle)->audio_sink_specified) {
|
||||
return (int)AUDIO_FLINGER_DEVICE_SINK(handle)->channelCount();
|
||||
}
|
||||
else if (AUDIO_FLINGER_DEVICE_TRACK(handle)) {
|
||||
return (int)AUDIO_FLINGER_DEVICE_TRACK(handle)->channelCount();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
uint32_t audioflinger_device_sampleRate (AudioFlingerDeviceHandle handle)
|
||||
{
|
||||
if (handle == NULL || AUDIO_FLINGER_DEVICE(handle)->init == false)
|
||||
return 0;
|
||||
if(AUDIO_FLINGER_DEVICE(handle)->audio_sink_specified) {
|
||||
// do nothing here, MediaPlayerBase::AudioSink doesn't provide sampleRate()
|
||||
// interface
|
||||
return -1;
|
||||
}
|
||||
else if (AUDIO_FLINGER_DEVICE_TRACK(handle)) {
|
||||
return (int)AUDIO_FLINGER_DEVICE_TRACK(handle)->getSampleRate();
|
||||
}
|
||||
return(-1);
|
||||
}
|
||||
|
||||
int audioflinger_device_obtain_buffer (AudioFlingerDeviceHandle handle,
|
||||
void **buffer_handle, int8_t **data, size_t *samples, uint64_t offset)
|
||||
{
|
||||
AudioTrack *track = AUDIO_FLINGER_DEVICE_TRACK (handle);
|
||||
status_t res;
|
||||
AudioTrack::Buffer *audioBuffer;
|
||||
|
||||
if(track == 0) return(-1);
|
||||
audioBuffer = new AudioTrack::Buffer();
|
||||
audioBuffer->frameCount = *samples;
|
||||
res = track->obtainBufferAtOffset (audioBuffer, offset, -1);
|
||||
if (res < 0) {
|
||||
delete audioBuffer;
|
||||
|
||||
return (int) res;
|
||||
}
|
||||
|
||||
*samples = audioBuffer->frameCount;
|
||||
*buffer_handle = static_cast<void *> (audioBuffer);
|
||||
*data = audioBuffer->i8;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
void audioflinger_device_release_buffer (AudioFlingerDeviceHandle handle,
|
||||
void *buffer_handle)
|
||||
{
|
||||
AudioTrack *track = AUDIO_FLINGER_DEVICE_TRACK (handle);
|
||||
AudioTrack::Buffer *audioBuffer = static_cast<AudioTrack::Buffer *>(buffer_handle);
|
||||
|
||||
if(track == 0) return;
|
||||
|
||||
track->releaseBuffer (audioBuffer);
|
||||
delete audioBuffer;
|
||||
}
|
||||
|
||||
uint32_t audioflinger_device_get_position (AudioFlingerDeviceHandle handle)
|
||||
{
|
||||
status_t status;
|
||||
uint32_t ret = -1;
|
||||
AudioTrack *track = AUDIO_FLINGER_DEVICE_TRACK (handle);
|
||||
|
||||
if(track == 0) return(-1);
|
||||
|
||||
status = track->getPosition (&ret);
|
||||
|
||||
return ret;
|
||||
}
|
|
@ -1,85 +0,0 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) <2009> Prajnashi S <prajnashi@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file defines APIs to convert C++ AudioFlinder/AudioTrack
|
||||
* interface to C interface
|
||||
*/
|
||||
#ifndef __AUDIOFLINGER_WRAPPER_H__
|
||||
#define __AUDIOFLINGER_WRAPPER_H__
|
||||
|
||||
#define LATE 0x80000002
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
typedef void* AudioFlingerDeviceHandle;
|
||||
|
||||
AudioFlingerDeviceHandle audioflinger_device_create();
|
||||
|
||||
AudioFlingerDeviceHandle audioflinger_device_open(void* audio_sink);
|
||||
|
||||
int audioflinger_device_set (AudioFlingerDeviceHandle handle,
|
||||
int streamType, int channelCount, uint32_t sampleRate, int bufferCount);
|
||||
|
||||
void audioflinger_device_release(AudioFlingerDeviceHandle handle);
|
||||
|
||||
void audioflinger_device_start(AudioFlingerDeviceHandle handle);
|
||||
|
||||
void audioflinger_device_stop(AudioFlingerDeviceHandle handle);
|
||||
|
||||
ssize_t audioflinger_device_write(AudioFlingerDeviceHandle handle,
|
||||
const void* buffer, size_t size);
|
||||
|
||||
void audioflinger_device_flush(AudioFlingerDeviceHandle handle);
|
||||
|
||||
void audioflinger_device_pause(AudioFlingerDeviceHandle handle);
|
||||
|
||||
void audioflinger_device_mute(AudioFlingerDeviceHandle handle, int mute);
|
||||
|
||||
int audioflinger_device_muted(AudioFlingerDeviceHandle handle);
|
||||
|
||||
void audioflinger_device_set_volume(AudioFlingerDeviceHandle handle,
|
||||
float left, float right);
|
||||
|
||||
int audioflinger_device_frameCount(AudioFlingerDeviceHandle handle);
|
||||
|
||||
int audioflinger_device_frameSize(AudioFlingerDeviceHandle handle);
|
||||
|
||||
int64_t audioflinger_device_latency(AudioFlingerDeviceHandle handle);
|
||||
|
||||
int audioflinger_device_format(AudioFlingerDeviceHandle handle);
|
||||
|
||||
int audioflinger_device_channelCount(AudioFlingerDeviceHandle handle);
|
||||
|
||||
uint32_t audioflinger_device_sampleRate(AudioFlingerDeviceHandle handle);
|
||||
|
||||
int audioflinger_device_obtain_buffer (AudioFlingerDeviceHandle handle,
|
||||
void **buffer_handle, int8_t **data, size_t *samples, uint64_t offset);
|
||||
void audioflinger_device_release_buffer (AudioFlingerDeviceHandle handle,
|
||||
void *buffer_handle);
|
||||
|
||||
uint32_t audioflinger_device_get_position (AudioFlingerDeviceHandle handle);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __AUDIOFLINGER_WRAPPER_H__ */
|
|
@ -1,90 +0,0 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) 2010 Alessandro Decina <alessandro.decina@collabora.co.uk>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef GST_AUDIO_FLINGER_RING_BUFFER_H
|
||||
#define GST_AUDIO_FLINGER_RING_BUFFER_H
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "gstaudiosink.h"
|
||||
|
||||
GST_DEBUG_CATEGORY_STATIC (gst_audio_sink_debug);
|
||||
#define GST_CAT_DEFAULT gst_audio_sink_debug
|
||||
|
||||
#define GST_TYPE_AUDIORING_BUFFER \
|
||||
(gst_audioringbuffer_get_type())
|
||||
#define GST_AUDIORING_BUFFER(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIORING_BUFFER,GstAudioRingBuffer))
|
||||
#define GST_AUDIORING_BUFFER_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIORING_BUFFER,GstAudioRingBufferClass))
|
||||
#define GST_AUDIORING_BUFFER_GET_CLASS(obj) \
|
||||
(G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_AUDIORING_BUFFER, GstAudioRingBufferClass))
|
||||
#define GST_AUDIORING_BUFFER_CAST(obj) \
|
||||
((GstAudioRingBuffer *)obj)
|
||||
#define GST_IS_AUDIORING_BUFFER(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIORING_BUFFER))
|
||||
#define GST_IS_AUDIORING_BUFFER_CLASS(klass)\
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIORING_BUFFER))
|
||||
|
||||
typedef struct _GstAudioRingBuffer GstAudioRingBuffer;
|
||||
typedef struct _GstAudioRingBufferClass GstAudioRingBufferClass;
|
||||
|
||||
#define GST_AUDIORING_BUFFER_GET_COND(buf) (((GstAudioRingBuffer *)buf)->cond)
|
||||
#define GST_AUDIORING_BUFFER_WAIT(buf) (g_cond_wait (GST_AUDIORING_BUFFER_GET_COND (buf), GST_OBJECT_GET_LOCK (buf)))
|
||||
#define GST_AUDIORING_BUFFER_SIGNAL(buf) (g_cond_signal (GST_AUDIORING_BUFFER_GET_COND (buf)))
|
||||
#define GST_AUDIORING_BUFFER_BROADCAST(buf)(g_cond_broadcast (GST_AUDIORING_BUFFER_GET_COND (buf)))
|
||||
|
||||
struct _GstAudioRingBuffer
|
||||
{
|
||||
GstRingBuffer object;
|
||||
|
||||
gboolean running;
|
||||
gint queuedseg;
|
||||
|
||||
GCond *cond;
|
||||
};
|
||||
|
||||
struct _GstAudioRingBufferClass
|
||||
{
|
||||
GstRingBufferClass parent_class;
|
||||
};
|
||||
|
||||
static void gst_audioringbuffer_class_init (GstAudioRingBufferClass * klass);
|
||||
static void gst_audioringbuffer_init (GstAudioRingBuffer * ringbuffer,
|
||||
GstAudioRingBufferClass * klass);
|
||||
static void gst_audioringbuffer_dispose (GObject * object);
|
||||
static void gst_audioringbuffer_finalize (GObject * object);
|
||||
|
||||
static GstRingBufferClass *ring_parent_class = NULL;
|
||||
|
||||
static gboolean gst_audioringbuffer_open_device (GstRingBuffer * buf);
|
||||
static gboolean gst_audioringbuffer_close_device (GstRingBuffer * buf);
|
||||
static gboolean gst_audioringbuffer_acquire (GstRingBuffer * buf,
|
||||
GstRingBufferSpec * spec);
|
||||
static gboolean gst_audioringbuffer_release (GstRingBuffer * buf);
|
||||
static gboolean gst_audioringbuffer_start (GstRingBuffer * buf);
|
||||
static gboolean gst_audioringbuffer_pause (GstRingBuffer * buf);
|
||||
static gboolean gst_audioringbuffer_stop (GstRingBuffer * buf);
|
||||
static guint gst_audioringbuffer_delay (GstRingBuffer * buf);
|
||||
static gboolean gst_audioringbuffer_activate (GstRingBuffer * buf,
|
||||
gboolean active);
|
||||
|
||||
GType gst_audioringbuffer_get_type (void);
|
||||
|
||||
#endif /* GST_AUDIO_FLINGER_RING_BUFFER_H */
|
File diff suppressed because it is too large
Load diff
|
@ -1,70 +0,0 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) <2009> Prajnashi S <prajnashi@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#ifndef __GST_AUDIOFLINGERSINK_H__
|
||||
#define __GST_AUDIOFLINGERSINK_H__
|
||||
|
||||
|
||||
#include <gst/gst.h>
|
||||
#include "gstaudiosink.h"
|
||||
#include "audioflinger_wrapper.h"
|
||||
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_AUDIOFLINGERSINK (gst_audioflinger_sink_get_type())
|
||||
#define GST_AUDIOFLINGERSINK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIOFLINGERSINK,GstAudioFlingerSink))
|
||||
#define GST_AUDIOFLINGERSINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIOFLINGERSINK,GstAudioFlingerSinkClass))
|
||||
#define GST_IS_AUDIOFLINGERSINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIOFLINGERSINK))
|
||||
#define GST_IS_AUDIOFLINGERSINK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIOFLINGERSINK))
|
||||
|
||||
typedef struct _GstAudioFlingerSink GstAudioFlingerSink;
|
||||
typedef struct _GstAudioFlingerSinkClass GstAudioFlingerSinkClass;
|
||||
|
||||
struct _GstAudioFlingerSink {
|
||||
GstAudioSink sink;
|
||||
|
||||
AudioFlingerDeviceHandle audioflinger_device;
|
||||
gboolean m_init;
|
||||
gint bytes_per_sample;
|
||||
gdouble m_volume;
|
||||
gboolean m_mute;
|
||||
gpointer m_audiosink;
|
||||
GstCaps *probed_caps;
|
||||
gboolean eos;
|
||||
GstClock *audio_clock;
|
||||
GstClock *system_clock;
|
||||
GstClock *system_audio_clock;
|
||||
GstClock *exported_clock;
|
||||
gboolean export_system_audio_clock;
|
||||
gboolean may_provide_clock;
|
||||
gboolean slaving_disabled;
|
||||
guint64 last_resync_sample;
|
||||
};
|
||||
|
||||
struct _GstAudioFlingerSinkClass {
|
||||
GstAudioSinkClass parent_class;
|
||||
};
|
||||
|
||||
GType gst_audioflinger_sink_get_type(void);
|
||||
|
||||
gboolean gst_audioflinger_sink_plugin_init (GstPlugin * plugin);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GST_AUDIOFLINGERSINK_H__ */
|
Loading…
Reference in a new issue