Lines Matching refs:rt
61 RTSPState *rt = s->priv_data;
63 if (!(rt->rtsp_flags & RTSP_FLAG_LISTEN))
64 ff_rtsp_send_cmd_async(s, "TEARDOWN", rt->control_uri, NULL);
69 rt->real_setup = NULL;
70 av_freep(&rt->real_setup_cache);
77 RTSPState *rt = s->priv_data;
83 ret = ffurl_read_complete(rt->rtsp_hd, rbuf + idx, 1);
102 RTSPState *rt = s->priv_data;
121 ffurl_write(rt->rtsp_hd_out, message, strlen(message));
129 RTSPState *rt = s->priv_data;
130 unsigned char *session_id = rt->session_id;
148 RTSPState *rt = s->priv_data;
157 ff_rtsp_parse_line(s, request, rbuf, rt, method);
160 if (request->seq != rt->seq + 1) {
165 if (rt->session_id[0] && strcmp(method, "OPTIONS")) {
176 RTSPState *rt = s->priv_data;
184 rt->seq++;
197 if (ffurl_read_complete(rt->rtsp_hd, sdp, request.content_length)
223 RTSPState *rt = s->priv_data;
231 rt->seq++;
241 RTSPState *rt = s->priv_data;
254 rt->seq++;
274 for (streamid = 0; streamid < rt->nb_rtsp_streams; streamid++) {
275 if (!strcmp(rt->rtsp_streams[streamid]->control_url,
279 if (streamid == rt->nb_rtsp_streams) {
283 rtsp_st = rt->rtsp_streams[streamid];
284 localport = rt->rtp_port_min;
288 if (CONFIG_RTPDEC && rt->transport == RTSP_TRANSPORT_RDT)
290 else if (CONFIG_RTPDEC && rt->transport == RTSP_TRANSPORT_RTP)
298 rt->lower_transport = RTSP_LOWER_TRANSPORT_TCP;
312 av_dict_set_int(&opts, "buffer_size", rt->buffer_size, 0);
321 } while (ret || localport > rt->rtp_port_max);
322 if (localport > rt->rtp_port_max) {
346 while (strlen(rt->session_id) < 8)
347 av_strlcatf(rt->session_id, 512, "%u", av_get_random_seed());
350 rt->session_id);
354 rt->state = RTSP_STATE_PAUSED;
360 RTSPState *rt = s->priv_data;
371 rt->seq++;
373 rt->session_id);
376 rt->state = RTSP_STATE_STREAMING;
385 RTSPState *rt = s->priv_data;
416 if (rt->state == RTSP_STATE_IDLE) {
422 } else if (rt->state == RTSP_STATE_PAUSED) {
429 } else if (rt->state == RTSP_STATE_STREAMING) {
437 av_log(s, AV_LOG_ERROR, "Unexpected State [%d]\n", rt->state);
452 if (strcmp(rt->control_uri, uri)) {
461 rt->control_uri);
471 av_strlcpy(rt->control_uri, uri, sizeof(rt->control_uri));
485 RTSPState *rt = s->priv_data;
508 rt->seq++;
510 rt->state = RTSP_STATE_PAUSED;
518 rt->state = RTSP_STATE_IDLE;
526 RTSPState *rt = s->priv_data;
531 av_log(s, AV_LOG_DEBUG, "hello state=%d\n", rt->state);
532 rt->nb_byes = 0;
534 if (rt->lower_transport == RTSP_LOWER_TRANSPORT_UDP) {
535 for (i = 0; i < rt->nb_rtsp_streams; i++) {
536 RTSPStream *rtsp_st = rt->rtsp_streams[i];
542 !(rt->server_type == RTSP_SERVER_WMS && i > 1))
546 if (!(rt->server_type == RTSP_SERVER_REAL && rt->need_subscription)) {
547 if (rt->transport == RTSP_TRANSPORT_RTP) {
548 for (i = 0; i < rt->nb_rtsp_streams; i++) {
549 RTSPStream *rtsp_st = rt->rtsp_streams[i];
562 if (rt->state == RTSP_STATE_PAUSED) {
567 rt->seek_timestamp / AV_TIME_BASE,
568 rt->seek_timestamp / (AV_TIME_BASE / 1000) % 1000);
570 ff_rtsp_send_cmd(s, "PLAY", rt->control_uri, cmd, reply, NULL);
574 if (rt->transport == RTSP_TRANSPORT_RTP &&
576 for (i = 0; i < rt->nb_rtsp_streams; i++) {
577 RTSPStream *rtsp_st = rt->rtsp_streams[i];
590 rt->state = RTSP_STATE_STREAMING;
597 RTSPState *rt = s->priv_data;
600 if (rt->state != RTSP_STATE_STREAMING)
602 else if (!(rt->server_type == RTSP_SERVER_REAL && rt->need_subscription)) {
603 ff_rtsp_send_cmd(s, "PAUSE", rt->control_uri, NULL, reply, NULL);
608 rt->state = RTSP_STATE_PAUSED;
614 RTSPState *rt = s->priv_data;
622 if (rt->server_type == RTSP_SERVER_REAL) {
631 ff_rtsp_send_cmd(s, "DESCRIBE", rt->control_uri, cmd, reply, &content);
651 RTSPState *rt = s->priv_data;
672 ff_url_join(rt->control_uri, sizeof(rt->control_uri), proto, NULL, host,
685 "?listen&listen_timeout=%d", rt->initial_timeout * 1000);
687 if (ret = ffurl_open_whitelist(&rt->rtsp_hd, tcpname, AVIO_FLAG_READ_WRITE,
693 rt->state = RTSP_STATE_IDLE;
694 rt->rtsp_hd_out = rt->rtsp_hd;
709 rt->state = RTSP_STATE_PAUSED;
744 RTSPState *rt = s->priv_data;
747 if (rt->initial_timeout > 0)
748 rt->rtsp_flags |= RTSP_FLAG_LISTEN;
750 if (rt->rtsp_flags & RTSP_FLAG_LISTEN) {
759 rt->real_setup_cache = !s->nb_streams ? NULL :
760 av_calloc(s->nb_streams, 2 * sizeof(*rt->real_setup_cache));
761 if (!rt->real_setup_cache && s->nb_streams) {
765 rt->real_setup = rt->real_setup_cache + s->nb_streams;
767 if (rt->initial_pause) {
786 RTSPState *rt = s->priv_data;
801 if (rt->state != RTSP_STATE_STREAMING)
804 ret = ffurl_read_complete(rt->rtsp_hd, buf, 3);
813 ret = ffurl_read_complete(rt->rtsp_hd, buf, len);
816 if (rt->transport == RTSP_TRANSPORT_RDT &&
821 for (i = 0; i < rt->nb_rtsp_streams; i++) {
822 rtsp_st = rt->rtsp_streams[i];
835 RTSPState *rt = s->priv_data;
843 rt->real_challenge);
848 RTSPState *rt = s->priv_data;
854 if (rt->server_type == RTSP_SERVER_REAL) {
858 rt->real_setup[i] = s->streams[i]->discard;
860 if (!rt->need_subscription) {
861 if (memcmp (rt->real_setup, rt->real_setup_cache,
865 rt->last_subscription);
866 ff_rtsp_send_cmd(s, "SET_PARAMETER", rt->control_uri,
870 rt->need_subscription = 1;
874 if (rt->need_subscription) {
877 memcpy(rt->real_setup_cache, rt->real_setup,
879 rt->last_subscription[0] = 0;
883 for (i = 0; i < rt->nb_rtsp_streams; i++) {
889 av_strlcat(rt->last_subscription, ",",
890 sizeof(rt->last_subscription));
892 rt->last_subscription,
893 sizeof(rt->last_subscription), i, rule_nr);
900 av_strlcatf(cmd, sizeof(cmd), "%s\r\n", rt->last_subscription);
901 ff_rtsp_send_cmd(s, "SET_PARAMETER", rt->control_uri,
905 rt->need_subscription = 0;
907 if (rt->state == RTSP_STATE_STREAMING)
914 if (ret == AVERROR(ETIMEDOUT) && !rt->packets) {
915 if (rt->lower_transport == RTSP_LOWER_TRANSPORT_UDP &&
916 rt->lower_transport_mask & (1 << RTSP_LOWER_TRANSPORT_TCP)) {
923 if (rt->server_type == RTSP_SERVER_REAL)
924 ff_rtsp_send_cmd(s, "TEARDOWN", rt->control_uri, NULL,
926 rt->session_id[0] = '\0';
928 rt->state = RTSP_STATE_IDLE;
929 rt->need_subscription = 1;
938 rt->packets++;
940 if (!(rt->rtsp_flags & RTSP_FLAG_LISTEN)) {
942 if ((av_gettime_relative() - rt->last_cmd_time) / 1000000 >= rt->timeout / 2 ||
943 rt->auth_state.stale) {
944 if (rt->server_type == RTSP_SERVER_WMS ||
945 (rt->server_type != RTSP_SERVER_REAL &&
946 rt->get_parameter_supported)) {
947 ff_rtsp_send_cmd_async(s, "GET_PARAMETER", rt->control_uri, NULL);
949 ff_rtsp_send_cmd_async(s, "OPTIONS", rt->control_uri, NULL);
954 rt->auth_state.stale = 0;
964 RTSPState *rt = s->priv_data;
967 rt->seek_timestamp = av_rescale_q(timestamp,
970 switch(rt->state) {
977 rt->state = RTSP_STATE_SEEKING;
982 rt->state = RTSP_STATE_IDLE;