#include "avformat.h"
#include "rtsp.h"
#include "rtp.h"
+#include "os_support.h"
#include <stdarg.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
-#ifdef HAVE_SYS_POLL_H
-#include <sys/poll.h>
+#ifdef HAVE_POLL_H
+#include <poll.h>
#endif
#include <errno.h>
#include <sys/time.h>
int conns_served;
int64_t bytes_served;
int64_t feed_max_size; /* maximum storage size, zero means unlimited */
- int64_t feed_write_index; /* current write position in feed (it wraps round) */
+ int64_t feed_write_index; /* current write position in feed (it wraps around) */
int64_t feed_size; /* current size of feed */
struct FFStream *next_feed;
} FFStream;
typedef struct FeedData {
long long data_count;
- float avg_frame_size; /* frame size averraged over last frames with exponential mean */
+ float avg_frame_size; /* frame size averaged over last frames with exponential mean */
} FeedData;
static struct sockaddr_in my_http_addr;
memset(&s, 0, sizeof(s));
url_open_buf(&s.pb, c->buffer, c->buffer_end - c->buffer, URL_RDONLY);
- s.pb->buf_end = c->buffer_end; /* ?? */
s.pb->is_streamed = 1;
/* use feed output format name to find corresponding input format */
static int opt_audio_codec(const char *arg)
{
- AVCodec *p;
+ AVCodec *p= avcodec_find_encoder_by_name(arg);
- p = first_avcodec;
- while (p) {
- if (!strcmp(p->name, arg) && p->type == CODEC_TYPE_AUDIO)
- break;
- p = p->next;
- }
- if (p == NULL)
+ if (p == NULL || p->type != CODEC_TYPE_AUDIO)
return CODEC_ID_NONE;
return p->id;
static int opt_video_codec(const char *arg)
{
- AVCodec *p;
+ AVCodec *p= avcodec_find_encoder_by_name(arg);
- p = first_avcodec;
- while (p) {
- if (!strcmp(p->name, arg) && p->type == CODEC_TYPE_VIDEO)
- break;
- p = p->next;
- }
- if (p == NULL)
+ if (p == NULL || p->type != CODEC_TYPE_VIDEO)
return CODEC_ID_NONE;
return p->id;
if (feed) {
int i;
- feed->child_argv = (char **) av_mallocz(64 * sizeof(char *));
+ feed->child_argv = av_mallocz(64 * sizeof(char *));
for (i = 0; i < 62; i++) {
get_arg(arg, sizeof(arg), &p);
get_arg(stream->feed_filename, sizeof(stream->feed_filename), &p);
} else if (!strcasecmp(cmd, "FileMaxSize")) {
if (feed) {
- const char *p1;
+ char *p1;
double fsize;
get_arg(arg, sizeof(arg), &p);
p1 = arg;
- fsize = strtod(p1, (char **)&p1);
+ fsize = strtod(p1, &p1);
switch(toupper(*p1)) {
case 'K':
fsize *= 1024;
}
if (!errors) {
- IPAddressACL *nacl = (IPAddressACL *) av_mallocz(sizeof(*nacl));
+ IPAddressACL *nacl = av_mallocz(sizeof(*nacl));
IPAddressACL **naclp = 0;
acl.next = 0;