static void rtsp_cmd_describe(HTTPContext *c, const char *url)

{

    FFStream *stream;

    char path1[1024];

    const char *path;

    uint8_t *content;

    int content_length, len;

    struct sockaddr_in my_addr;

    

    /* find which url is asked */

    url_split(NULL, 0, NULL, 0, NULL, path1, sizeof(path1), url);

    path = path1;

    if (*path == '/')

        path++;



    for(stream = first_stream; stream != NULL; stream = stream->next) {

        if (!stream->is_feed && stream->fmt == &rtp_mux &&

            !strcmp(path, stream->filename)) {

            goto found;

        }

    }

    /* no stream found */

    rtsp_reply_error(c, RTSP_STATUS_SERVICE); /* XXX: right error ? */

    return;



 found:

    /* prepare the media description in sdp format */



    /* get the host IP */

    len = sizeof(my_addr);

    getsockname(c->fd, (struct sockaddr *)&my_addr, &len);

    content_length = prepare_sdp_description(stream, &content, my_addr.sin_addr);

    if (content_length < 0) {

        rtsp_reply_error(c, RTSP_STATUS_INTERNAL);

        return;

    }

    rtsp_reply_header(c, RTSP_STATUS_OK);

    url_fprintf(c->pb, "Content-Type: application/sdp\r\n");

    url_fprintf(c->pb, "Content-Length: %d\r\n", content_length);

    url_fprintf(c->pb, "\r\n");

    put_buffer(c->pb, content, content_length);

}

static void rtsp_cmd_describe(HTTPContext *c, const char *url)

{

    FFStream *stream;

    char path1[1024];

    const char *path;

    uint8_t *content;

    int content_length, len;

    struct sockaddr_in my_addr;

    

    

    url_split(NULL, 0, NULL, 0, NULL, path1, sizeof(path1), url);

    path = path1;

    if (*path == '/')

        path++;



    for(stream = first_stream; stream != NULL; stream = stream->next) {

        if (!stream->is_feed && stream->fmt == &rtp_mux &&

            !strcmp(path, stream->filename)) {

            goto found;

        }

    }

    

    rtsp_reply_error(c, RTSP_STATUS_SERVICE); 

    return;



 found:

    



    

    len = sizeof(my_addr);

    getsockname(c->fd, (struct sockaddr *)&my_addr, &len);

    content_length = prepare_sdp_description(stream, &content, my_addr.sin_addr);

    if (content_length < 0) {

        rtsp_reply_error(c, RTSP_STATUS_INTERNAL);

        return;

    }

    rtsp_reply_header(c, RTSP_STATUS_OK);

    url_fprintf(c->pb, "Content-Type: application/sdp\r\n");

    url_fprintf(c->pb, "Content-Length: %d\r\n", content_length);

    url_fprintf(c->pb, "\r\n");

    put_buffer(c->pb, content, content_length);

}

static void FUNC_0(HTTPContext *VAR_0, const char *VAR_1)

{

    FFStream *stream;

    char VAR_2[1024];

    const char *VAR_3;

    uint8_t *content;

    int VAR_4, VAR_5;

    struct sockaddr_in VAR_6;

    

    

    url_split(NULL, 0, NULL, 0, NULL, VAR_2, sizeof(VAR_2), VAR_1);

    VAR_3 = VAR_2;

    if (*VAR_3 == '/')

        VAR_3++;



    for(stream = first_stream; stream != NULL; stream = stream->next) {

        if (!stream->is_feed && stream->fmt == &rtp_mux &&

            !strcmp(VAR_3, stream->filename)) {

            goto found;

        }

    }

    

    rtsp_reply_error(VAR_0, RTSP_STATUS_SERVICE); 

    return;



 found:

    



    

    VAR_5 = sizeof(VAR_6);

    getsockname(VAR_0->fd, (struct sockaddr *)&VAR_6, &VAR_5);

    VAR_4 = prepare_sdp_description(stream, &content, VAR_6.sin_addr);

    if (VAR_4 < 0) {

        rtsp_reply_error(VAR_0, RTSP_STATUS_INTERNAL);

        return;

    }

    rtsp_reply_header(VAR_0, RTSP_STATUS_OK);

    url_fprintf(VAR_0->pb, "Content-Type: application/sdp\r\n");

    url_fprintf(VAR_0->pb, "Content-Length: %d\r\n", VAR_4);

    url_fprintf(VAR_0->pb, "\r\n");

    put_buffer(VAR_0->pb, content, VAR_4);

}

static void FUNC_0(HTTPContext *VAR_0, const char *VAR_1)
{ FFStream *stream; char VAR_2[1024]; const char *VAR_3; uint8_t *content; int VAR_4, VAR_5; struct sockaddr_in VAR_6; url_split(NULL, 0, NULL, 0, NULL, VAR_2, sizeof(VAR_2), VAR_1); VAR_3 = VAR_2; if (*VAR_3 == '/')
VAR_3++; for(stream = first_stream; stream != NULL; stream = stream->next) { if (!stream->is_feed && stream->fmt == &rtp_mux &&
!strcmp(VAR_3, stream->filename)) { goto found; } } rtsp_reply_error(VAR_0, RTSP_STATUS_SERVICE); return; found:
VAR_5 = sizeof(VAR_6); getsockname(VAR_0->fd, (struct sockaddr *)&VAR_6, &VAR_5); VAR_4 = prepare_sdp_description(stream, &content, VAR_6.sin_addr); if (VAR_4 < 0) { rtsp_reply_error(VAR_0, RTSP_STATUS_INTERNAL); return; } rtsp_reply_header(VAR_0, RTSP_STATUS_OK); url_fprintf(VAR_0->pb, "Content-Type: application/sdp\r\n"); url_fprintf(VAR_0->pb, "Content-Length: %d\r\n", VAR_4); url_fprintf(VAR_0->pb, "\r\n"); put_buffer(VAR_0->pb, content, VAR_4); }