bluetooth/gst: Determine PA input/output caps in generic code

Make the code ever so slightly more generic by not using appsrc and
appsink in codec-specific logic when assigning caps specific to the raw
(PCM) format provided by or returned to PA.

Note that caps have to be set (= event) after starting, can't send
events in flushing state.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/484>
This commit is contained in:
Marijn Suijten 2021-01-21 09:43:16 +01:00
parent db73004a3a
commit da1600eb61
3 changed files with 53 additions and 30 deletions

View file

@ -342,16 +342,6 @@ bool gst_init_aptx(struct gst_info *info, pa_sample_spec *ss, bool for_encoding)
goto fail;
}
caps = gst_caps_new_simple("audio/x-raw",
"format", G_TYPE_STRING, "S24LE",
"rate", G_TYPE_INT, (int) ss->rate,
"channels", G_TYPE_INT, (int) ss->channels,
"channel-mask", G_TYPE_INT, 0,
"layout", G_TYPE_STRING, "interleaved",
NULL);
g_object_set(info->enc_src, "caps", caps, NULL);
gst_caps_unref(caps);
caps = gst_caps_new_simple(aptx_codec_media_type,
"rate", G_TYPE_INT, (int) ss->rate,
"channels", G_TYPE_INT, (int) ss->channels,
@ -386,15 +376,6 @@ bool gst_init_aptx(struct gst_info *info, pa_sample_spec *ss, bool for_encoding)
g_object_set(info->dec_src, "caps", caps, NULL);
gst_caps_unref(caps);
caps = gst_caps_new_simple("audio/x-raw",
"format", G_TYPE_STRING, "S24LE",
"rate", G_TYPE_INT, (int) ss->rate,
"channels", G_TYPE_INT, (int) ss->channels,
"layout", G_TYPE_STRING, "interleaved",
NULL);
g_object_set(info->dec_sink, "caps", caps, NULL);
gst_caps_unref(caps);
info->dec_bin = gst_bin_new("aptx_dec_bin");
pa_assert(info->dec_bin);