static int rtsp_read_announce(AVFormatContext *s)
{
    RTSPState *rt             = s->priv_data;
    RTSPMessageHeader request = { 0 };
    char sdp[4096];
    int  ret;
    ret = rtsp_read_request(s, &request, "ANNOUNCE");
    if (ret)
        return ret;
    rt->seq++;
    if (strcmp(request.content_type, "application/sdp")) {
        av_log(s, AV_LOG_ERROR, "Unexpected content type %s\n",
               request.content_type);
        rtsp_send_reply(s, RTSP_STATUS_SERVICE, NULL, request.seq);
        return AVERROR_OPTION_NOT_FOUND;
    }
    if (request.content_length && request.content_length < sizeof(sdp) - 1) {
        if (ffurl_read_complete(rt->rtsp_hd, sdp, request.content_length)
            < request.content_length) {
            av_log(s, AV_LOG_ERROR,
                   "Unable to get complete SDP Description in ANNOUNCE\n");
            rtsp_send_reply(s, RTSP_STATUS_INTERNAL, NULL, request.seq);
            return AVERROR(EIO);
        }
        sdp[request.content_length] = '\0';
        av_log(s, AV_LOG_VERBOSE, "SDP: %s\n", sdp);
        ret = ff_sdp_parse(s, sdp);
        if (ret)
            return ret;
        rtsp_send_reply(s, RTSP_STATUS_OK, NULL, request.seq);
        return 0;
    }
    av_log(s, AV_LOG_ERROR,
           "Content-Length header value exceeds sdp allocated buffer (4KB)\n");
    rtsp_send_reply(s, RTSP_STATUS_INTERNAL,
                    "Content-Length exceeds buffer size", request.seq);
    return AVERROR(EIO);
}
['static int rtsp_read_announce(AVFormatContext *s)\n{\n    RTSPState *rt             = s->priv_data;\n    RTSPMessageHeader request = { 0 };\n    char sdp[4096];\n    int  ret;\n    ret = rtsp_read_request(s, &request, "ANNOUNCE");\n    if (ret)\n        return ret;\n    rt->seq++;\n    if (strcmp(request.content_type, "application/sdp")) {\n        av_log(s, AV_LOG_ERROR, "Unexpected content type %s\\n",\n               request.content_type);\n        rtsp_send_reply(s, RTSP_STATUS_SERVICE, NULL, request.seq);\n        return AVERROR_OPTION_NOT_FOUND;\n    }\n    if (request.content_length && request.content_length < sizeof(sdp) - 1) {\n        if (ffurl_read_complete(rt->rtsp_hd, sdp, request.content_length)\n            < request.content_length) {\n            av_log(s, AV_LOG_ERROR,\n                   "Unable to get complete SDP Description in ANNOUNCE\\n");\n            rtsp_send_reply(s, RTSP_STATUS_INTERNAL, NULL, request.seq);\n            return AVERROR(EIO);\n        }\n        sdp[request.content_length] = \'\\0\';\n        av_log(s, AV_LOG_VERBOSE, "SDP: %s\\n", sdp);\n        ret = ff_sdp_parse(s, sdp);\n        if (ret)\n            return ret;\n        rtsp_send_reply(s, RTSP_STATUS_OK, NULL, request.seq);\n        return 0;\n    }\n    av_log(s, AV_LOG_ERROR,\n           "Content-Length header value exceeds sdp allocated buffer (4KB)\\n");\n    rtsp_send_reply(s, RTSP_STATUS_INTERNAL,\n                    "Content-Length exceeds buffer size", request.seq);\n    return AVERROR(EIO);\n}', 'static int rtsp_send_reply(AVFormatContext *s, enum RTSPStatusCode code,\n                           const char *extracontent, uint16_t seq)\n{\n    RTSPState *rt = s->priv_data;\n    char message[4096];\n    int index = 0;\n    while (status_messages[index].code) {\n        if (status_messages[index].code == code) {\n            snprintf(message, sizeof(message), "RTSP/1.0 %d %s\\r\\n",\n                     code, status_messages[index].message);\n            break;\n        }\n        index++;\n    }\n    if (!status_messages[index].code)\n        return AVERROR(EINVAL);\n    av_strlcatf(message, sizeof(message), "CSeq: %d\\r\\n", seq);\n    av_strlcatf(message, sizeof(message), "Server: %s\\r\\n", LIBAVFORMAT_IDENT);\n    if (extracontent)\n        av_strlcat(message, extracontent, sizeof(message));\n    av_strlcat(message, "\\r\\n", sizeof(message));\n    av_dlog(s, "Sending response:\\n%s", message);\n    ffurl_write(rt->rtsp_hd, message, strlen(message));\n    return 0;\n}']