Lines Matching full:stream
154 struct bt_a2dp_stream *stream = NULL; in a2dp_process_config_ind() local
200 /* For reconfig, ep->stream must already be valid, callback can be NULL as default accept. in a2dp_process_config_ind()
201 * For !reconfig, config_req must be set to get stream from upper layer in a2dp_process_config_ind()
204 stream = ep->stream; in a2dp_process_config_ind()
205 if (stream == NULL) { in a2dp_process_config_ind()
224 err = a2dp_cb->config_req(a2dp, ep, &cfg, &stream, &rsp_err_code); in a2dp_process_config_ind()
225 if (!err && stream) { in a2dp_process_config_ind()
226 stream->a2dp = a2dp; in a2dp_process_config_ind()
227 stream->local_ep = ep; in a2dp_process_config_ind()
228 stream->remote_ep_id = int_seid; in a2dp_process_config_ind()
229 stream->remote_ep = NULL; in a2dp_process_config_ind()
230 stream->codec_config = *cfg.codec_config; in a2dp_process_config_ind()
231 ep->stream = stream; in a2dp_process_config_ind()
236 err = a2dp_cb->reconfig_req(stream, &cfg, &rsp_err_code); in a2dp_process_config_ind()
244 ops = stream->ops; in a2dp_process_config_ind()
246 ops->configured(stream); in a2dp_process_config_ind()
272 struct bt_a2dp_stream *stream; in bt_a2dp_media_data_callback() local
276 if (ep->stream == NULL || buf->len < sizeof(*media_hdr)) { in bt_a2dp_media_data_callback()
279 stream = ep->stream; in bt_a2dp_media_data_callback()
283 stream->ops->recv(stream, buf, sys_get_be16((uint8_t *)&media_hdr->sequence_number), in bt_a2dp_media_data_callback()
288 typedef int (*bt_a2dp_ctrl_req_cb)(struct bt_a2dp_stream *stream, uint8_t *rsp_err_code);
289 typedef void (*bt_a2dp_ctrl_done_cb)(struct bt_a2dp_stream *stream);
296 struct bt_a2dp_stream *stream; in a2dp_ctrl_ind() local
300 if (ep->stream == NULL) { in a2dp_ctrl_ind()
304 stream = ep->stream; in a2dp_ctrl_ind()
310 err = req_cb(stream, &rsp_err_code); in a2dp_ctrl_ind()
318 ep->stream = NULL; in a2dp_ctrl_ind()
322 done_cb(stream); in a2dp_ctrl_ind()
337 done_cb = (ep->stream != NULL && ep->stream->ops != NULL) ? ep->stream->ops->established in a2dp_open_ind()
350 done_cb = (ep->stream != NULL && ep->stream->ops != NULL) ? ep->stream->ops->started : NULL; in a2dp_start_ind()
363 (ep->stream != NULL && ep->stream->ops != NULL) ? ep->stream->ops->suspended : NULL; in a2dp_suspend_ind()
376 (ep->stream != NULL && ep->stream->ops != NULL) ? ep->stream->ops->released : NULL; in a2dp_close_ind()
388 done_cb = (ep->stream != NULL && ep->stream->ops != NULL) ? ep->stream->ops->aborted : NULL; in a2dp_abort_ind()
396 struct bt_a2dp_stream *stream; in bt_a2dp_set_config_cb() local
400 if (ep->stream == NULL) { in bt_a2dp_set_config_cb()
403 if ((ep->stream == NULL) || (SET_CONF_REQ(req) != &a2dp->set_config_param)) { in bt_a2dp_set_config_cb()
406 stream = ep->stream; in bt_a2dp_set_config_cb()
411 a2dp_cb->config_rsp(stream, req->status); in bt_a2dp_set_config_cb()
414 ops = stream->ops; in bt_a2dp_set_config_cb()
416 ops->configured(stream); in bt_a2dp_set_config_cb()
467 ep->stream = NULL; in bt_a2dp_get_capabilities_cb()
597 void bt_a2dp_stream_cb_register(struct bt_a2dp_stream *stream, struct bt_a2dp_stream_ops *ops) in bt_a2dp_stream_cb_register() argument
599 __ASSERT_NO_MSG(stream); in bt_a2dp_stream_cb_register()
600 stream->ops = ops; in bt_a2dp_stream_cb_register()
619 int bt_a2dp_stream_config(struct bt_a2dp *a2dp, struct bt_a2dp_stream *stream, in bt_a2dp_stream_config() argument
623 if ((a2dp == NULL) || (stream == NULL) || (local_ep == NULL) || (remote_ep == NULL) || in bt_a2dp_stream_config()
633 stream->local_ep = local_ep; in bt_a2dp_stream_config()
634 stream->remote_ep = remote_ep; in bt_a2dp_stream_config()
635 stream->remote_ep_id = remote_ep->sep.sep_info.id; in bt_a2dp_stream_config()
636 stream->a2dp = a2dp; in bt_a2dp_stream_config()
637 local_ep->stream = stream; in bt_a2dp_stream_config()
638 remote_ep->stream = stream; in bt_a2dp_stream_config()
645 typedef void (*bt_a2dp_rsp_cb)(struct bt_a2dp_stream *stream, uint8_t rsp_err_code);
646 typedef void (*bt_a2dp_done_cb)(struct bt_a2dp_stream *stream);
653 struct bt_a2dp_stream *stream; in bt_a2dp_ctrl_cb() local
656 if ((ep->stream == NULL) || (CTRL_REQ(req) != &a2dp->ctrl_param)) { in bt_a2dp_ctrl_cb()
659 stream = ep->stream; in bt_a2dp_ctrl_cb()
661 ep->stream = NULL; in bt_a2dp_ctrl_cb()
667 rsp_cb(stream, req->status); in bt_a2dp_ctrl_cb()
671 done_cb(stream); in bt_a2dp_ctrl_cb()
680 bt_a2dp_done_cb done_cb = (ep->stream != NULL && ep->stream->ops != NULL) in bt_a2dp_open_cb()
681 ? ep->stream->ops->established in bt_a2dp_open_cb()
692 (ep->stream != NULL && ep->stream->ops != NULL) ? ep->stream->ops->started : NULL; in bt_a2dp_start_cb()
702 (ep->stream != NULL && ep->stream->ops != NULL) ? ep->stream->ops->suspended : NULL; in bt_a2dp_suspend_cb()
712 (ep->stream != NULL && ep->stream->ops != NULL) ? ep->stream->ops->released : NULL; in bt_a2dp_close_cb()
722 (ep->stream != NULL && ep->stream->ops != NULL) ? ep->stream->ops->aborted : NULL; in bt_a2dp_abort_cb()
727 static int bt_a2dp_stream_ctrl_pre(struct bt_a2dp_stream *stream, bt_avdtp_func_t cb) in bt_a2dp_stream_ctrl_pre() argument
731 if ((stream == NULL) || (stream->local_ep == NULL) || (stream->a2dp == NULL)) { in bt_a2dp_stream_ctrl_pre()
735 a2dp = stream->a2dp; in bt_a2dp_stream_ctrl_pre()
737 a2dp->ctrl_param.acp_stream_ep_id = stream->remote_ep != NULL in bt_a2dp_stream_ctrl_pre()
738 ? stream->remote_ep->sep.sep_info.id in bt_a2dp_stream_ctrl_pre()
739 : stream->remote_ep_id; in bt_a2dp_stream_ctrl_pre()
740 a2dp->ctrl_param.sep = &stream->local_ep->sep; in bt_a2dp_stream_ctrl_pre()
744 int bt_a2dp_stream_establish(struct bt_a2dp_stream *stream) in bt_a2dp_stream_establish() argument
747 struct bt_a2dp *a2dp = stream->a2dp; in bt_a2dp_stream_establish()
749 err = bt_a2dp_stream_ctrl_pre(stream, bt_a2dp_open_cb); in bt_a2dp_stream_establish()
756 int bt_a2dp_stream_release(struct bt_a2dp_stream *stream) in bt_a2dp_stream_release() argument
759 struct bt_a2dp *a2dp = stream->a2dp; in bt_a2dp_stream_release()
761 err = bt_a2dp_stream_ctrl_pre(stream, bt_a2dp_close_cb); in bt_a2dp_stream_release()
768 int bt_a2dp_stream_start(struct bt_a2dp_stream *stream) in bt_a2dp_stream_start() argument
771 struct bt_a2dp *a2dp = stream->a2dp; in bt_a2dp_stream_start()
773 err = bt_a2dp_stream_ctrl_pre(stream, bt_a2dp_start_cb); in bt_a2dp_stream_start()
780 int bt_a2dp_stream_suspend(struct bt_a2dp_stream *stream) in bt_a2dp_stream_suspend() argument
783 struct bt_a2dp *a2dp = stream->a2dp; in bt_a2dp_stream_suspend()
785 err = bt_a2dp_stream_ctrl_pre(stream, bt_a2dp_suspend_cb); in bt_a2dp_stream_suspend()
792 int bt_a2dp_stream_abort(struct bt_a2dp_stream *stream) in bt_a2dp_stream_abort() argument
795 struct bt_a2dp *a2dp = stream->a2dp; in bt_a2dp_stream_abort()
797 err = bt_a2dp_stream_ctrl_pre(stream, bt_a2dp_abort_cb); in bt_a2dp_stream_abort()
804 int bt_a2dp_stream_reconfig(struct bt_a2dp_stream *stream, struct bt_a2dp_codec_cfg *config) in bt_a2dp_stream_reconfig() argument
808 if ((stream == NULL) || (config == NULL)) { in bt_a2dp_stream_reconfig()
812 remote_id = stream->remote_ep != NULL ? stream->remote_ep->sep.sep_info.id in bt_a2dp_stream_reconfig()
813 : stream->remote_ep_id; in bt_a2dp_stream_reconfig()
814 bt_a2dp_stream_config_set_param(stream->a2dp, config, bt_a2dp_set_config_cb, remote_id, in bt_a2dp_stream_reconfig()
815 stream->local_ep->sep.sep_info.id, in bt_a2dp_stream_reconfig()
816 stream->local_ep->codec_type, &stream->local_ep->sep); in bt_a2dp_stream_reconfig()
817 return bt_avdtp_reconfigure(&stream->a2dp->session, &stream->a2dp->set_config_param); in bt_a2dp_stream_reconfig()
820 uint32_t bt_a2dp_get_mtu(struct bt_a2dp_stream *stream) in bt_a2dp_get_mtu() argument
822 if ((stream == NULL) || (stream->local_ep == NULL)) { in bt_a2dp_get_mtu()
826 return bt_avdtp_get_media_mtu(&stream->local_ep->sep); in bt_a2dp_get_mtu()
830 int bt_a2dp_stream_send(struct bt_a2dp_stream *stream, struct net_buf *buf, uint16_t seq_num, in bt_a2dp_stream_send() argument
835 if (stream == NULL || stream->local_ep == NULL) { in bt_a2dp_stream_send()
841 if (stream->local_ep->codec_type == BT_A2DP_SBC) { in bt_a2dp_stream_send()
852 return bt_avdtp_send_media_data(&stream->local_ep->sep, buf); in bt_a2dp_stream_send()
862 if (ep->stream != NULL) { in a2dp_stream_l2cap_disconnected()
864 struct bt_a2dp_stream *stream = ep->stream; in a2dp_stream_l2cap_disconnected() local
866 ops = stream->ops; in a2dp_stream_l2cap_disconnected()
867 /* Many places set ep->stream as NULL like abort and close. in a2dp_stream_l2cap_disconnected()
871 ep->stream = NULL; in a2dp_stream_l2cap_disconnected()
873 ops->released(stream); in a2dp_stream_l2cap_disconnected()