Revision dfd017bf

View differences:

libavformat/rtsp.c
932 932
    return 0;
933 933
}
934 934

  
935
static void rtsp_send_cmd_async(AVFormatContext *s, const char *cmd)
935
static void rtsp_send_cmd_with_content_async(AVFormatContext *s,
936
                                             const char *cmd,
937
                                             const unsigned char *send_content,
938
                                             int send_content_length)
936 939
{
937 940
    RTSPState *rt = s->priv_data;
938 941
    char buf[4096], buf1[1024];
......
949 952
        av_strlcatf(buf, sizeof(buf),
950 953
                    "Authorization: Basic %s\r\n",
951 954
                    rt->auth_b64);
955
    if (send_content_length > 0 && send_content)
956
        av_strlcatf(buf, sizeof(buf), "Content-Length: %d\r\n", send_content_length);
952 957
    av_strlcat(buf, "\r\n", sizeof(buf));
953 958

  
954 959
    dprintf(s, "Sending:\n%s--\n", buf);
955 960

  
956 961
    url_write(rt->rtsp_hd, buf, strlen(buf));
962
    if (send_content_length > 0 && send_content)
963
        url_write(rt->rtsp_hd, send_content, send_content_length);
957 964
    rt->last_cmd_time = av_gettime();
958 965
}
959 966

  
967
static void rtsp_send_cmd_async(AVFormatContext *s, const char *cmd)
968
{
969
    rtsp_send_cmd_with_content_async(s, cmd, NULL, 0);
970
}
971

  
960 972
static void rtsp_send_cmd(AVFormatContext *s,
961 973
                          const char *cmd, RTSPMessageHeader *reply,
962 974
                          unsigned char **content_ptr)
......
966 978
    rtsp_read_reply(s, reply, content_ptr, 0);
967 979
}
968 980

  
981
static void rtsp_send_cmd_with_content(AVFormatContext *s,
982
                                       const char *cmd,
983
                                       RTSPMessageHeader *reply,
984
                                       unsigned char **content_ptr,
985
                                       const unsigned char *send_content,
986
                                       int send_content_length)
987
{
988
    rtsp_send_cmd_with_content_async(s, cmd, send_content, send_content_length);
989

  
990
    rtsp_read_reply(s, reply, content_ptr, 0);
991
}
992

  
969 993
/**
970 994
 * @returns 0 on success, <0 on error, 1 if protocol is unavailable.
971 995
 */

Also available in: Unified diff