Pass on rtpmap to raop_buffer in order to add AAC support later
authorJuho Vähä-Herttua <juhovh@iki.fi>
Sun, 31 Mar 2013 10:42:31 +0000 (13:42 +0300)
committerJuho Vähä-Herttua <juhovh@iki.fi>
Sun, 31 Mar 2013 11:11:28 +0000 (14:11 +0300)
src/lib/raop.c
src/lib/raop_buffer.c
src/lib/raop_buffer.h
src/lib/raop_rtp.c
src/lib/raop_rtp.h

index abf66300e6081a7db3b3a1840027c937475510d4..10c2f12b687772a9d1ebc86fa9442723e144c4d2 100644 (file)
@@ -203,15 +203,17 @@ conn_request(void *ptr, http_request_t *request, http_response_t **response)
                data = http_request_get_data(request, &datalen);
                if (data) {
                        sdp_t *sdp;
-                       const char *remotestr, *fmtpstr, *aeskeystr, *aesivstr;
+                       const char *remotestr, *rtpmapstr, *fmtpstr, *aeskeystr, *aesivstr;
 
                        sdp = sdp_init(data, datalen);
                        remotestr = sdp_get_connection(sdp);
+                       rtpmapstr = sdp_get_rtpmap(sdp);
                        fmtpstr = sdp_get_fmtp(sdp);
                        aeskeystr = sdp_get_rsaaeskey(sdp);
                        aesivstr = sdp_get_aesiv(sdp);
 
                        logger_log(conn->raop->logger, LOGGER_DEBUG, "connection: %s", remotestr);
+                       logger_log(conn->raop->logger, LOGGER_DEBUG, "rtpmap: %s", rtpmapstr);
                        logger_log(conn->raop->logger, LOGGER_DEBUG, "fmtp: %s", fmtpstr);
                        logger_log(conn->raop->logger, LOGGER_DEBUG, "rsaaeskey: %s", aeskeystr);
                        logger_log(conn->raop->logger, LOGGER_DEBUG, "aesiv: %s", aesivstr);
@@ -226,7 +228,7 @@ conn_request(void *ptr, http_request_t *request, http_response_t **response)
                                raop_rtp_destroy(conn->raop_rtp);
                                conn->raop_rtp = NULL;
                        }
-                       conn->raop_rtp = raop_rtp_init(raop->logger, &raop->callbacks, remotestr, fmtpstr, aeskey, aesiv);
+                       conn->raop_rtp = raop_rtp_init(raop->logger, &raop->callbacks, remotestr, rtpmapstr, fmtpstr, aeskey, aesiv);
                        sdp_destroy(sdp);
                }
        } else if (!strcmp(method, "SETUP")) {
index 37bfa79dab86ac3352c7e8faf7fa1491c40ab46e..15f588c5be0b3e9e3e2a78db381485d07ef7a52e 100644 (file)
@@ -146,7 +146,8 @@ set_decoder_info(alac_file *alac, ALACSpecificConfig *config)
 }
 
 raop_buffer_t *
-raop_buffer_init(const char *fmtp,
+raop_buffer_init(const char *rtpmap,
+                 const char *fmtp,
                  const unsigned char *aeskey,
                  const unsigned char *aesiv)
 {
@@ -155,6 +156,7 @@ raop_buffer_init(const char *fmtp,
        ALACSpecificConfig *alacConfig;
        int i;
 
+        assert(rtpmap);
        assert(fmtp);
        assert(aeskey);
        assert(aesiv);
index cfc6ab918786f08b8f45b25f129083066d4f630d..bed0ef47bc36f92d1555aa5b3cd51ee40b42c0a3 100644 (file)
@@ -34,7 +34,8 @@ typedef struct {
 
 typedef int (*raop_resend_cb_t)(void *opaque, unsigned short seqno, unsigned short count);
 
-raop_buffer_t *raop_buffer_init(const char *fmtp,
+raop_buffer_t *raop_buffer_init(const char *rtpmap,
+                                const char *fmtp,
                                 const unsigned char *aeskey,
                                 const unsigned char *aesiv);
 
index f89538e5667dcc753066cc85f46bafb5e6923700..e80da78d0d1ee3bc86c2712c377e5e66420a23d7 100644 (file)
@@ -121,13 +121,15 @@ raop_rtp_parse_remote(raop_rtp_t *raop_rtp, const char *remote)
 
 raop_rtp_t *
 raop_rtp_init(logger_t *logger, raop_callbacks_t *callbacks, const char *remote,
-              const char *fmtp, const unsigned char *aeskey, const unsigned char *aesiv)
+              const char *rtpmap, const char *fmtp,
+              const unsigned char *aeskey, const unsigned char *aesiv)
 {
        raop_rtp_t *raop_rtp;
 
        assert(logger);
        assert(callbacks);
        assert(remote);
+       assert(rtpmap);
        assert(fmtp);
 
        raop_rtp = calloc(1, sizeof(raop_rtp_t));
@@ -136,7 +138,7 @@ raop_rtp_init(logger_t *logger, raop_callbacks_t *callbacks, const char *remote,
        }
        raop_rtp->logger = logger;
        memcpy(&raop_rtp->callbacks, callbacks, sizeof(raop_callbacks_t));
-       raop_rtp->buffer = raop_buffer_init(fmtp, aeskey, aesiv);
+       raop_rtp->buffer = raop_buffer_init(rtpmap, fmtp, aeskey, aesiv);
        if (!raop_rtp->buffer) {
                free(raop_rtp);
                return NULL;
index 19734fcedc12c04dd74815794a39c045560bc5e6..51cd8916dd28122e2500ace2ebd451d0160d2be9 100644 (file)
@@ -26,7 +26,8 @@
 typedef struct raop_rtp_s raop_rtp_t;
 
 raop_rtp_t *raop_rtp_init(logger_t *logger, raop_callbacks_t *callbacks, const char *remote,
-                          const char *fmtp, const unsigned char *aeskey, const unsigned char *aesiv);
+                          const char *rtpmap, const char *fmtp,
+                          const unsigned char *aeskey, const unsigned char *aesiv);
 void raop_rtp_start(raop_rtp_t *raop_rtp, int use_udp, unsigned short control_rport, unsigned short timing_rport,
                     unsigned short *control_lport, unsigned short *timing_lport, unsigned short *data_lport);
 void raop_rtp_set_volume(raop_rtp_t *raop_rtp, float volume);