mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	rtp: New pa_rtsp_options function
Add a function performing a call to the OPTIONS request; also, in some special cases, tuning transport parameters is required (default: "RTP/AVP/TCP;unicast;interleaved=0-1;mode=record") ! The RAOP client for example needs to overwrite them. Reviewed-by: Anton Lundin <glance@acc.umu.se>
This commit is contained in:
		
							parent
							
								
									736fabf0ca
								
							
						
					
					
						commit
						a0199dd99d
					
				
					 3 changed files with 29 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -299,10 +299,14 @@ static void rtsp_cb(pa_rtsp_client *rtsp, pa_rtsp_state state, pa_headerlist *he
 | 
			
		|||
            break;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        case STATE_OPTIONS:
 | 
			
		||||
            pa_log_debug("RAOP: OPTIONS");
 | 
			
		||||
            break;
 | 
			
		||||
 | 
			
		||||
        case STATE_ANNOUNCE:
 | 
			
		||||
            pa_log_debug("RAOP: ANNOUNCED");
 | 
			
		||||
            pa_rtsp_remove_header(c->rtsp, "Apple-Challenge");
 | 
			
		||||
            pa_rtsp_setup(c->rtsp);
 | 
			
		||||
            pa_rtsp_setup(c->rtsp, NULL);
 | 
			
		||||
            break;
 | 
			
		||||
 | 
			
		||||
        case STATE_SETUP: {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -443,6 +443,22 @@ static int rtsp_exec(pa_rtsp_client *c, const char *cmd,
 | 
			
		|||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int pa_rtsp_options(pa_rtsp_client *c) {
 | 
			
		||||
    char *url;
 | 
			
		||||
    int rv;
 | 
			
		||||
 | 
			
		||||
    pa_assert(c);
 | 
			
		||||
 | 
			
		||||
    url = c->url;
 | 
			
		||||
    c->state = STATE_OPTIONS;
 | 
			
		||||
 | 
			
		||||
    c->url = (char *)"*";
 | 
			
		||||
    rv = rtsp_exec(c, "OPTIONS", NULL, NULL, 0, NULL);
 | 
			
		||||
 | 
			
		||||
    c->url = url;
 | 
			
		||||
    return rv;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int pa_rtsp_announce(pa_rtsp_client *c, const char *sdp) {
 | 
			
		||||
    int rv;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -457,14 +473,17 @@ int pa_rtsp_announce(pa_rtsp_client *c, const char *sdp) {
 | 
			
		|||
    return rv;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int pa_rtsp_setup(pa_rtsp_client *c) {
 | 
			
		||||
int pa_rtsp_setup(pa_rtsp_client *c, const char *transport) {
 | 
			
		||||
    pa_headerlist *headers;
 | 
			
		||||
    int rv;
 | 
			
		||||
 | 
			
		||||
    pa_assert(c);
 | 
			
		||||
 | 
			
		||||
    headers = pa_headerlist_new();
 | 
			
		||||
    if (!transport)
 | 
			
		||||
        pa_headerlist_puts(headers, "Transport", "RTP/AVP/TCP;unicast;interleaved=0-1;mode=record");
 | 
			
		||||
    else
 | 
			
		||||
        pa_headerlist_puts(headers, "Transport", transport);
 | 
			
		||||
 | 
			
		||||
    c->state = STATE_SETUP;
 | 
			
		||||
    rv = rtsp_exec(c, "SETUP", NULL, NULL, 1, headers);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -33,6 +33,7 @@
 | 
			
		|||
typedef struct pa_rtsp_client pa_rtsp_client;
 | 
			
		||||
typedef enum {
 | 
			
		||||
  STATE_CONNECT,
 | 
			
		||||
  STATE_OPTIONS,
 | 
			
		||||
  STATE_ANNOUNCE,
 | 
			
		||||
  STATE_SETUP,
 | 
			
		||||
  STATE_RECORD,
 | 
			
		||||
| 
						 | 
				
			
			@ -57,9 +58,10 @@ void pa_rtsp_set_url(pa_rtsp_client *c, const char *url);
 | 
			
		|||
void pa_rtsp_add_header(pa_rtsp_client *c, const char *key, const char *value);
 | 
			
		||||
void pa_rtsp_remove_header(pa_rtsp_client *c, const char *key);
 | 
			
		||||
 | 
			
		||||
int pa_rtsp_options(pa_rtsp_client *c);
 | 
			
		||||
int pa_rtsp_announce(pa_rtsp_client *c, const char *sdp);
 | 
			
		||||
 | 
			
		||||
int pa_rtsp_setup(pa_rtsp_client *c);
 | 
			
		||||
int pa_rtsp_setup(pa_rtsp_client *c, const char *transport);
 | 
			
		||||
int pa_rtsp_record(pa_rtsp_client *c, uint16_t *seq, uint32_t *rtptime);
 | 
			
		||||
int pa_rtsp_teardown(pa_rtsp_client *c);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue