mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
a72dc6992e
Original commit message from CVS: Patch by: Jérémie Bernard <gremimail at gmail dot com> * configure.ac: * ext/apexsink/LGPL-3.0.txt: * ext/apexsink/Makefile.am: * ext/apexsink/gstapexplugin.c: (plugin_init): * ext/apexsink/gstapexraop.c: (g_strdel), (gst_apexraop_send), (gst_apexraop_recv), (gst_apexraop_new), (gst_apexraop_free), (gst_apexraop_set_host), (gst_apexraop_get_host), (gst_apexraop_set_port), (gst_apexraop_get_port), (gst_apexraop_set_useragent), (gst_apexraop_get_useragent), (gst_apexraop_connect), (gst_apexraop_get_jacktype), (gst_apexraop_get_jackstatus), (gst_apexraop_close), (gst_apexraop_set_volume), (gst_apexraop_write_bits), (gst_apexraop_write), (gst_apexraop_flush): * ext/apexsink/gstapexraop.h: * ext/apexsink/gstapexsink.c: (gst_apexsink_jackstatus_get_type), (gst_apexsink_jacktype_get_type), (gst_apexsink_interfaces_init), (gst_apexsink_implements_interface_init), (gst_apexsink_mixer_interface_init), (gst_apexsink_interface_supported), (gst_apexsink_mixer_list_tracks), (gst_apexsink_mixer_set_volume), (gst_apexsink_mixer_get_volume), (gst_apexsink_base_init), (gst_apexsink_class_init), (gst_apexsink_init), (gst_apexsink_set_property), (gst_apexsink_get_property), (gst_apexsink_finalise), (gst_apexsink_open), (gst_apexsink_prepare), (gst_apexsink_write), (gst_apexsink_unprepare), (gst_apexsink_delay), (gst_apexsink_reset), (gst_apexsink_close): * ext/apexsink/gstapexsink.h: Add apexsink for audio output to Apple AirPort Express Wireless devices. Fixes bug #542510.
124 lines
4.2 KiB
C
124 lines
4.2 KiB
C
/* GStreamer - Remote Audio Access Protocol (RAOP) as used in Apple iTunes to stream music to the Airport Express (ApEx) -
|
|
*
|
|
* RAOP is based on the Real Time Streaming Protocol (RTSP) but with an extra challenge-response RSA based authentication step.
|
|
* This interface accepts RAW PCM data and set it as AES encrypted ALAC while performing emission.
|
|
*
|
|
* Copyright (C) 2008 Jérémie Bernard [GRemi] <gremimail@gmail.com>
|
|
*
|
|
* gstapexraop.h
|
|
*
|
|
* 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_APEXRAOP_H__
|
|
#define __GST_APEXRAOP_H__
|
|
|
|
#include <gst/gst.h>
|
|
#include <gst/rtsp/gstrtspdefs.h>
|
|
|
|
#include <openssl/rand.h>
|
|
#include <openssl/rsa.h>
|
|
#include <openssl/aes.h>
|
|
#include <openssl/evp.h>
|
|
|
|
#include <string.h>
|
|
#include <stdlib.h>
|
|
#include <unistd.h>
|
|
|
|
#include <netinet/in.h>
|
|
#include <netdb.h>
|
|
|
|
#include <arpa/inet.h>
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
/* raop fixed parameters */
|
|
#define GST_APEX_RAOP_BITRATE 44100
|
|
#define GST_APEX_RAOP_SAMPLES_PER_FRAME 4096
|
|
#define GST_APEX_RAOP_BYTES_PER_CHANNEL 2
|
|
#define GST_APEX_RAOP_CHANNELS 2
|
|
#define GST_APEX_RAOP_BYTES_PER_SAMPLE (GST_APEX_RAOP_CHANNELS * GST_APEX_RAOP_BYTES_PER_CHANNEL)
|
|
|
|
/* gst associated caps fields specification */
|
|
#define GST_APEX_RAOP_INPUT_TYPE "audio/x-raw-int"
|
|
#define GST_APEX_RAOP_INPUT_WIDTH "16"
|
|
#define GST_APEX_RAOP_INPUT_DEPTH GST_APEX_RAOP_INPUT_WIDTH
|
|
#define GST_APEX_RAOP_INPUT_ENDIAN "LITTLE_ENDIAN"
|
|
#define GST_APEX_RAOP_INPUT_CHANNELS "2"
|
|
#define GST_APEX_RAOP_INPUT_BIT_RATE "44100"
|
|
#define GST_APEX_RAOP_INPUT_SIGNED "TRUE"
|
|
|
|
typedef enum
|
|
{
|
|
GST_APEX_JACK_TYPE_UNDEFINED = 0,
|
|
GST_APEX_JACK_TYPE_ANALOG,
|
|
GST_APEX_JACK_TYPE_DIGITAL,
|
|
}
|
|
GstApExJackType;
|
|
|
|
typedef enum
|
|
{
|
|
GST_APEX_JACK_STATUS_UNDEFINED = 0,
|
|
GST_APEX_JACK_STATUS_DISCONNECTED,
|
|
GST_APEX_JACK_STATUS_CONNECTED,
|
|
}
|
|
GstApExJackStatus;
|
|
|
|
/* raop context handle */
|
|
typedef struct
|
|
{
|
|
} GstApExRAOP;
|
|
|
|
/* host might be null and port might be 0 while instanciating */
|
|
GstApExRAOP *gst_apexraop_new (const gchar * host, const guint16 port);
|
|
void gst_apexraop_free (GstApExRAOP * conn);
|
|
|
|
/* must not be connected yet while setting the host target */
|
|
void gst_apexraop_set_host (GstApExRAOP * conn, const gchar * host);
|
|
gchar *gst_apexraop_get_host (GstApExRAOP * conn);
|
|
|
|
/* must not be connected yet while setting the port target */
|
|
void gst_apexraop_set_port (GstApExRAOP * conn, const guint16 port);
|
|
guint16 gst_apexraop_get_port (GstApExRAOP * conn);
|
|
|
|
/* optional affectation, default iTunes user agent internaly used */
|
|
void gst_apexraop_set_useragent (GstApExRAOP * conn, const gchar * useragent);
|
|
gchar *gst_apexraop_get_useragent (GstApExRAOP * conn);
|
|
|
|
/* once allocation and configuration performed, manages the raop ANNOUNCE, SETUP and RECORD sequences,
|
|
* open both ctrl and data channels */
|
|
GstRTSPStatusCode gst_apexraop_connect (GstApExRAOP * conn);
|
|
|
|
/* close the currently used session, manages raop TEARDOWN sequence and closes the used sockets */
|
|
void gst_apexraop_close (GstApExRAOP * conn);
|
|
|
|
/* once connected, set the apex target volume, manages SET_PARAMETER sequence */
|
|
GstRTSPStatusCode gst_apexraop_set_volume (GstApExRAOP * conn,
|
|
const guint volume);
|
|
|
|
/* write raw samples typed as defined by the fixed raop parameters, flush the apex buffer */
|
|
guint gst_apexraop_write (GstApExRAOP * conn, gpointer rawdata, guint length);
|
|
GstRTSPStatusCode gst_apexraop_flush (GstApExRAOP * conn);
|
|
|
|
/* retrieve the connected apex jack type and status */
|
|
GstApExJackType gst_apexraop_get_jacktype (GstApExRAOP * conn);
|
|
GstApExJackStatus gst_apexraop_get_jackstatus (GstApExRAOP * conn);
|
|
|
|
G_END_DECLS
|
|
|
|
#endif
|
|
|