[vlc-devel] [PATCH] Add Apple AirTunes stream output plugin
Michael Hanselmann
public at hansmi.ch
Tue Dec 16 01:16:13 CET 2008
Hi Rémi
2008/12/15 Rémi Denis-Courmont <rem at videolan.org>:
> Le samedi 13 décembre 2008 01:12:28 Michael Hanselmann, vous avez écrit :
>> > Is AirTunes a trademark or anything?
>>
>> Yes, unfortunately it is[2]. I didn't even think of this before. Would
>> "raop" (for Remote Audio Output Protocol[3]) be a better name for the
>> plugin?
>
> Yeah,
Done:
--- a/configure.ac
+++ b/configure.ac
@@ -5301,15 +5301,15 @@ AS_IF([test "${enable_remoteosd}" != "no"], [
dnl
-dnl AirTunes plugin
+dnl RAOP plugin
dnl
-AC_MSG_CHECKING([whether to enable AirTunes plugin])
+AC_MSG_CHECKING([whether to enable RAOP plugin])
AS_IF([test "${have_libgcrypt}" = "yes"], [
AC_MSG_RESULT(yes)
- VLC_ADD_PLUGIN([stream_out_airtunes])
- VLC_ADD_LIBS([stream_out_airtunes], [${LIBGCRYPT_LIBS}])
- VLC_ADD_CFLAGS([stream_out_airtunes], [${LIBGCRYPT_CFLAGS}])
+ VLC_ADD_PLUGIN([stream_out_raop])
+ VLC_ADD_LIBS([stream_out_raop], [${LIBGCRYPT_LIBS}])
+ VLC_ADD_CFLAGS([stream_out_raop], [${LIBGCRYPT_CFLAGS}])
], [
AC_MSG_RESULT(no)
- AC_MSG_WARN([libgcrypt support required for AirTunes plugin])
+ AC_MSG_WARN([libgcrypt support required for RAOP plugin])
])
diff --git a/modules/stream_out/Modules.am b/modules/stream_out/Modules.am
index 9f7bbc6..de9da35 100644
--- a/modules/stream_out/Modules.am
+++ b/modules/stream_out/Modules.am
@@ -13,5 +13,5 @@ SOURCES_stream_out_mosaic_bridge = mosaic_bridge.c
SOURCES_stream_out_autodel = autodel.c
SOURCES_stream_out_record = record.c
-SOURCES_stream_out_airtunes = airtunes.c
+SOURCES_stream_out_raop = raop.c
libvlc_LTLIBRARIES += \
diff --git a/modules/stream_out/raop.c b/modules/stream_out/raop.c
index 6cb5999..f64c929 100644
--- a/modules/stream_out/raop.c
+++ b/modules/stream_out/raop.c
@@ -1,4 +1,4 @@
/*****************************************************************************
- * airtunes.c: Apple AirTunes/Airport Express streaming support
+ * raop.c: Remote Audio Output Protocol streaming support
*****************************************************************************
* Copyright (C) 2008 the VideoLAN team
@@ -43,9 +43,9 @@
#include <vlc_es.h>
-#define AIRTUNES_PORT 5000
-#define AIRTUNES_USER_AGENT "VLC " VERSION
+#define RAOP_PORT 5000
+#define RAOP_USER_AGENT "VLC " VERSION
-static const char ps_airtunes_rsa_pubkey[] =
+static const char ps_raop_rsa_pubkey[] =
"\xe7\xd7\x44\xf2\xa2\xe2\x78\x8b\x6c\x1f\x55\xa0\x8e\xb7\x05\x44"
"\xa8\xfa\x79\x45\xaa\x8b\xe6\xc6\x2c\xe5\xf5\x1c\xbd\xd4\xdc\x68"
@@ -65,5 +65,5 @@ static const char ps_airtunes_rsa_pubkey[] =
"\x5e\x0f\xc8\x75\x34\x3e\xc7\x82\x11\x76\x25\xcd\xbf\x98\x44\x7b";
-static const char ps_airtunes_rsa_exp[] = "\x01\x00\x01";
+static const char ps_raop_rsa_exp[] = "\x01\x00\x01";
static const char psz_delim_space[] = " ";
@@ -136,5 +136,5 @@ struct sout_stream_id_t
* Module descriptor
*****************************************************************************/
-#define SOUT_CFG_PREFIX "sout-airtunes-"
+#define SOUT_CFG_PREFIX "sout-raop-"
#define HOST_TEXT N_("Host")
@@ -146,8 +146,8 @@ struct sout_stream_id_t
vlc_module_begin();
- set_shortname( N_("AirTunes") )
- set_description( N_("AirTunes audio output") );
+ set_shortname( N_("RAOP") )
+ set_description( N_("Remote Audio Output Protocol streaming plugin") );
set_capability( "sout stream", 0 );
- add_shortcut( "airtunes" );
+ add_shortcut( "raop" );
set_category( CAT_SOUT );
set_subcategory( SUBCAT_SOUT_STREAM );
@@ -439,6 +439,6 @@ static int EncryptAesKeyBase64( vlc_object_t
*p_this, char **result )
/* Read public key */
i_gcrypt_err = gcry_mpi_scan( &mpi_pubkey, GCRYMPI_FMT_USG,
- ps_airtunes_rsa_pubkey,
- sizeof( ps_airtunes_rsa_pubkey ) - 1, NULL );
+ ps_raop_rsa_pubkey,
+ sizeof( ps_raop_rsa_pubkey ) - 1, NULL );
if ( CheckForGcryptError( p_stream, i_gcrypt_err ) )
{
@@ -448,7 +448,6 @@ static int EncryptAesKeyBase64( vlc_object_t
*p_this, char **result )
/* Read exponent */
- i_gcrypt_err = gcry_mpi_scan( &mpi_exp, GCRYMPI_FMT_USG,
- ps_airtunes_rsa_exp,
- sizeof( ps_airtunes_rsa_exp ) - 1, NULL );
+ i_gcrypt_err = gcry_mpi_scan( &mpi_exp, GCRYMPI_FMT_USG, ps_raop_rsa_exp,
+ sizeof( ps_raop_rsa_exp ) - 1, NULL );
if ( CheckForGcryptError( p_stream, i_gcrypt_err ) )
{
@@ -541,5 +540,5 @@ error:
}
-/* Splits the value of a header sent by AirTunes device.
+/* Splits the value of a received header.
*
* Example: "Transport: RTP/AVP/TCP;unicast;mode=record;server_port=6000"
@@ -714,5 +713,5 @@ static int SendRequest( vlc_object_t *p_this,
const char *psz_method,
i_rc = net_Printf( p_this, p_sys->i_control_fd, NULL,
"%s %s RTSP/1.0\r\n"
- "User-Agent: " AIRTUNES_USER_AGENT "\r\n"
+ "User-Agent: " RAOP_USER_AGENT "\r\n"
"Client-Instance: %s\r\n"
"CSeq: %d\r\n",
@@ -1066,5 +1065,5 @@ static int UpdateVolume( vlc_object_t *p_this )
vlc_dictionary_init( &req_headers, 0 );
- /* Our volume is 0..255, AirTunes is -144..0 (-144 off, -30..0 on) */
+ /* Our volume is 0..255, RAOP is -144..0 (-144 off, -30..0 on) */
/* Limit range */
@@ -1268,9 +1267,9 @@ static int Open( vlc_object_t *p_this )
/* Open control connection */
p_sys->i_control_fd = net_ConnectTCP( p_stream, p_sys->psz_host,
- AIRTUNES_PORT );
+ RAOP_PORT );
if ( p_sys->i_control_fd < 0 )
{
msg_Err( p_this, "Cannot establish control connection to %s:%d (%m)",
- p_sys->psz_host, AIRTUNES_PORT );
+ p_sys->psz_host, RAOP_PORT );
i_err = VLC_EGENERIC;
goto error;
> and please squash your fixes while you're at it (git rebase -i ...)
I'm already doing that locally, the differences shown were just the
changes made. I'll resend the complete, large patch when we're done
with all the small changes.
>> The "remoteosd" plugin also has its own configure option and has the
>> same dependencies. What do you prefer?
>
> I prefer fewer options, and nobody else has commented this far.
Before the plugin rename:
--- a/configure.ac
+++ b/configure.ac
@@ -5303,15 +5303,14 @@ dnl
dnl AirTunes plugin
dnl
-AC_ARG_ENABLE(airtunes,
- [ --enable-airtunes AirTunes stream plugin (default enabled)])
-if test "${enable_airtunes}" != "no"; then
- AS_IF([test "${have_libgcrypt}" = "yes"], [
- VLC_ADD_PLUGIN([stream_out_airtunes])
- VLC_ADD_LIBS([stream_out_airtunes], [${LIBGCRYPT_LIBS}])
- VLC_ADD_CFLAGS([stream_out_airtunes], [${LIBGCRYPT_CFLAGS}])
- ], [
- AC_MSG_WARN([libgcrypt support required for AirTunes plugin])
- ])
-fi
+AC_MSG_CHECKING([whether to enable AirTunes plugin])
+AS_IF([test "${have_libgcrypt}" = "yes"], [
+ AC_MSG_RESULT(yes)
+ VLC_ADD_PLUGIN([stream_out_airtunes])
+ VLC_ADD_LIBS([stream_out_airtunes], [${LIBGCRYPT_LIBS}])
+ VLC_ADD_CFLAGS([stream_out_airtunes], [${LIBGCRYPT_CFLAGS}])
+], [
+ AC_MSG_RESULT(no)
+ AC_MSG_WARN([libgcrypt support required for AirTunes plugin])
+])
>> >> + /* Fill buffer */
>> >> + memcpy( p_sys->p_sendbuf, header, sizeof( header ) );
>> >> + memcpy( p_sys->p_sendbuf + sizeof( header ),
>> >> + p_buffer->p_buffer, p_buffer->i_buffer );
>> >
>> > What about using block_Realloc() instead?
>>
>> Do mean to use a block_t instead of a manually malloc'ed buffer? Or to
>> do the encryption directly in the buffer passed to Send()?
>
> Yes, if it makes sense (which is to say, if it saves reallocation and/or
> copying).
I looked at blocks again and decided that the current solution is at
least as efficient. By reusing the same buffer, which grows only when
needed, I don't have to realloc and memmove every block passed to the
plugin. I could call net_Write twice, once for the header and once for
the data, but this can increase the amount of packets on the wire.
Regards,
Michael
--
http://hansmi.ch/
More information about the vlc-devel
mailing list