1
0
Fork 0
mirror of https://github.com/albfan/miraclecast.git synced 2025-02-13 22:01:56 +00:00

miracle-wfdctl: send video only stream if no audio device specified

This commit is contained in:
Derek Dai 2017-03-09 17:48:53 +08:00
parent cdc4e32ff8
commit b70a58066c
No known key found for this signature in database
GPG key ID: E109CC97553EF009

View file

@ -570,7 +570,7 @@ static int wfd_out_session_create_pipeline(struct wfd_session *s)
GError *error = NULL; GError *error = NULL;
const char **tmp; const char **tmp;
int r; int r;
const char *pipeline_desc[96] = { const char *pipeline_desc[128] = {
"ximagesrc", "ximagesrc",
"name=vsrc", "name=vsrc",
"use-damage=false", "use-damage=false",
@ -610,19 +610,6 @@ static int wfd_out_session_create_pipeline(struct wfd_session *s)
"async=false", "async=false",
"host=", wfd_out_session_get_sink(s)->peer->remote_address, "host=", wfd_out_session_get_sink(s)->peer->remote_address,
"port=", uint16_to_str(s->stream.rtp_port, rrtp_port,sizeof(rrtp_port)), "port=", uint16_to_str(s->stream.rtp_port, rrtp_port,sizeof(rrtp_port)),
"pulsesrc",
"do-timestamp=true",
"client-name=miraclecast",
"device=", quote_str(os->audio_dev, audio_dev, sizeof(audio_dev)),
"!", "audioconvert",
"!", "audio/x-raw,",
"rate=48000,",
"channels=2",
"!", "avenc_aac",
"!", "queue",
"max-size-buffers=0",
"max-size-bytes=0",
"!", "muxer.",
"udpsrc", "udpsrc",
"address=", wfd_out_session_get_sink(s)->peer->local_address, "address=", wfd_out_session_get_sink(s)->peer->local_address,
"port=", uint16_to_str(LOCAL_RTCP_PORT, lrtcp_port,sizeof(lrtcp_port)), "port=", uint16_to_str(LOCAL_RTCP_PORT, lrtcp_port,sizeof(lrtcp_port)),
@ -645,6 +632,30 @@ static int wfd_out_session_create_pipeline(struct wfd_session *s)
*tmp ++ = NULL; *tmp ++ = NULL;
} }
if(*os->audio_dev) {
for(tmp = pipeline_desc; *tmp; ++tmp);
*tmp ++ = "pulsesrc";
*tmp ++ = "do-timestamp=true";
*tmp ++ = "client-name=miraclecast";
*tmp ++ = "device=";
*tmp ++ = quote_str(os->audio_dev, audio_dev, sizeof(audio_dev));
*tmp ++ = "!";
*tmp ++ = "audioconvert";
*tmp ++ = "!";
*tmp ++ = "audio/x-raw,";
*tmp ++ = "rate=48000,";
*tmp ++ = "channels=2";
*tmp ++ = "!";
*tmp ++ = "avenc_aac";
*tmp ++ = "!";
*tmp ++ = "queue";
*tmp ++ = "max-size-buffers=0";
*tmp ++ = "max-size-bytes=0";
*tmp ++ = "!";
*tmp ++ = "muxer.";
*tmp ++ = NULL;
}
/* bad pratice, but since we are in the same process, /* bad pratice, but since we are in the same process,
I think this is the only way to do it */ I think this is the only way to do it */
if(WFD_DISPLAY_TYPE_X == os->display_type) { if(WFD_DISPLAY_TYPE_X == os->display_type) {