X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=ffserver.c;h=48d880831fb32bf391851d7793541a0fe7b9a1df;hb=defb87eef4ddcfcabfbc3884ff8490dcb4e206c5;hp=c2d2180e8cff65fbf3052ede1cdbc01264df9be6;hpb=c16e00618122a7f1217f5174a6c4013eb57421b0;p=ffmpeg diff --git a/ffserver.c b/ffserver.c index c2d2180e8cf..48d880831fb 100644 --- a/ffserver.c +++ b/ffserver.c @@ -38,6 +38,7 @@ #include "libavformat/rtpdec.h" #include "libavformat/rtpproto.h" #include "libavformat/rtsp.h" +#include "libavformat/rtspcodes.h" #include "libavformat/avio_internal.h" #include "libavformat/internal.h" #include "libavformat/url.h" @@ -222,7 +223,7 @@ typedef struct FFStream { IPAddressACL *acl; char dynamic_acl[1024]; int nb_streams; - int prebuffer; /* Number of millseconds early to start */ + int prebuffer; /* Number of milliseconds early to start */ int64_t max_time; /* Number of milliseconds to run */ int send_on_key; AVStream *streams[MAX_STREAMS]; @@ -1324,7 +1325,7 @@ static void parse_acl_row(FFStream *stream, FFStream* feed, IPAddressACL *ext_ac get_arg(arg, sizeof(arg), &p); if (resolve_host(&acl.first, arg) != 0) { - fprintf(stderr, "%s:%d: ACL refers to invalid host or ip address '%s'\n", + fprintf(stderr, "%s:%d: ACL refers to invalid host or IP address '%s'\n", filename, line_num, arg); errors++; } else @@ -1334,7 +1335,7 @@ static void parse_acl_row(FFStream *stream, FFStream* feed, IPAddressACL *ext_ac if (arg[0]) { if (resolve_host(&acl.last, arg) != 0) { - fprintf(stderr, "%s:%d: ACL refers to invalid host or ip address '%s'\n", + fprintf(stderr, "%s:%d: ACL refers to invalid host or IP address '%s'\n", filename, line_num, arg); errors++; } @@ -1725,7 +1726,7 @@ static int http_parse_request(HTTPContext *c) *p = '\0'; snprintf(q, c->buffer_size, "HTTP/1.0 200 RTSP Redirect follows\r\n" - /* XXX: incorrect mime type ? */ + /* XXX: incorrect MIME type ? */ "Content-type: application/x-rtsp\r\n" "\r\n" "rtsp://%s:%d/%s\r\n", hostname, ntohs(my_rtsp_addr.sin_port), filename); @@ -1786,7 +1787,7 @@ static int http_parse_request(HTTPContext *c) /* if post, it means a feed is being sent */ if (!stream->is_feed) { /* However it might be a status report from WMP! Let us log the - * data as it might come in handy one day. */ + * data as it might come handy one day. */ const char *logline = 0; int client_id = 0; @@ -2308,7 +2309,7 @@ static int http_prepare_data(HTTPContext *c) c->fmt_ctx.pb->seekable = 0; /* - * HACK to avoid mpeg ps muxer to spit many underflow errors + * HACK to avoid MPEG-PS muxer to spit many underflow errors * Default value from FFmpeg * Try to set it using configuration option */ @@ -2836,44 +2837,9 @@ static void rtsp_reply_header(HTTPContext *c, enum RTSPStatusCode error_number) struct tm *tm; char buf2[32]; - switch(error_number) { - case RTSP_STATUS_OK: - str = "OK"; - break; - case RTSP_STATUS_METHOD: - str = "Method Not Allowed"; - break; - case RTSP_STATUS_BANDWIDTH: - str = "Not Enough Bandwidth"; - break; - case RTSP_STATUS_SESSION: - str = "Session Not Found"; - break; - case RTSP_STATUS_STATE: - str = "Method Not Valid in This State"; - break; - case RTSP_STATUS_AGGREGATE: - str = "Aggregate operation not allowed"; - break; - case RTSP_STATUS_ONLY_AGGREGATE: - str = "Only aggregate operation allowed"; - break; - case RTSP_STATUS_TRANSPORT: - str = "Unsupported transport"; - break; - case RTSP_STATUS_INTERNAL: - str = "Internal Server Error"; - break; - case RTSP_STATUS_SERVICE: - str = "Service Unavailable"; - break; - case RTSP_STATUS_VERSION: - str = "RTSP Version not supported"; - break; - default: + str = RTSP_STATUS_CODE2STRING(error_number); + if (!str) str = "Unknown Error"; - break; - } avio_printf(c->pb, "RTSP/1.0 %d %s\r\n", error_number, str); avio_printf(c->pb, "CSeq: %d\r\n", c->seq); @@ -3047,7 +3013,7 @@ static void rtsp_cmd_describe(HTTPContext *c, const char *url) socklen_t len; struct sockaddr_in my_addr; - /* find which url is asked */ + /* find which URL is asked */ av_url_split(NULL, 0, NULL, 0, NULL, 0, NULL, path1, sizeof(path1), url); path = path1; if (*path == '/') @@ -3065,7 +3031,7 @@ static void rtsp_cmd_describe(HTTPContext *c, const char *url) return; found: - /* prepare the media description in sdp format */ + /* prepare the media description in SDP format */ /* get the host IP */ len = sizeof(my_addr); @@ -3124,7 +3090,7 @@ static void rtsp_cmd_setup(HTTPContext *c, const char *url, struct sockaddr_in dest_addr; RTSPActionServerSetup setup; - /* find which url is asked */ + /* find which URL is asked */ av_url_split(NULL, 0, NULL, 0, NULL, 0, NULL, path1, sizeof(path1), url); path = path1; if (*path == '/') @@ -3166,7 +3132,7 @@ static void rtsp_cmd_setup(HTTPContext *c, const char *url, random0, random1); } - /* find rtp session, and create it if none found */ + /* find RTP session, and create it if none found */ rtp_c = find_rtp_session(h->session_id); if (!rtp_c) { /* always prefer UDP */ @@ -3255,7 +3221,7 @@ static void rtsp_cmd_setup(HTTPContext *c, const char *url, } -/* find an rtp connection by using the session ID. Check consistency +/* find an RTP connection by using the session ID. Check consistency with filename */ static HTTPContext *find_rtp_session_with_url(const char *url, const char *session_id) @@ -3270,7 +3236,7 @@ static HTTPContext *find_rtp_session_with_url(const char *url, if (!rtp_c) return NULL; - /* find which url is asked */ + /* find which URL is asked */ av_url_split(NULL, 0, NULL, 0, NULL, 0, NULL, path1, sizeof(path1), url); path = path1; if (*path == '/') @@ -3599,7 +3565,7 @@ static void remove_stream(FFStream *stream) } } -/* specific mpeg4 handling : we extract the raw parameters */ +/* specific MPEG4 handling : we extract the raw parameters */ static void extract_mpeg4_header(AVFormatContext *infile) { int mpeg4_count, i, size; @@ -3824,7 +3790,7 @@ static void build_feed_streams(void) http_log("Container doesn't support the required parameters\n"); exit(1); } - /* XXX: need better api */ + /* XXX: need better API */ av_freep(&s->priv_data); avio_close(s->pb); s->streams = NULL; @@ -4321,7 +4287,7 @@ static int parse_ffconfig(const char *filename) stream->fmt = NULL; } else { stream->stream_type = STREAM_TYPE_LIVE; - /* jpeg cannot be used here, so use single frame jpeg */ + /* JPEG cannot be used here, so use single frame MJPEG */ if (!strcmp(arg, "jpeg")) strcpy(arg, "mjpeg"); stream->fmt = ffserver_guess_format(arg, NULL, NULL);