aboutsummaryrefslogtreecommitdiff
path: root/lib/ffmpeg/ffserver.c
diff options
context:
space:
mode:
authorAnssi Hannula <anssi@xbmc.org>2011-02-02 01:29:29 +0200
committerAnssi Hannula <anssi@xbmc.org>2011-02-03 00:16:55 +0200
commit1a6a927ec5a0c305f58fa44bc0d023e007820b64 (patch)
tree480da2a288b605711c96a7315937c33ccf6c8257 /lib/ffmpeg/ffserver.c
parent4d8e27ceb8c6218f4dd62b381ec786650f594ac9 (diff)
updated: internal ffmpeg to c3beafa0f1
Update internal FFmpeg to c3beafa0f1 from git://git.ffmpeg.org/ffmpeg.git. This update adds a new library, libavcore, which contains common multimedia utilities. Build scripts are updated to handle it (both internal and external). FFmpeg is no longer built with libfaad as it now supports LATM AAC audio natively. The unused build_xbmc.sh script is removed. The patchset in ffmpeg/patches has been updated, removals and additions are documented below. The following patches have been removed as no longer necessary: - Ticket #5481 - added support for LATM encapsulated AAC audio streams within FFmpeg (thanks Paul Kendall). - re-add libfaad wrapper to ffmpeg for now - added: ffmpeg spdif demuxer (fixes ac3-in-wav) - ffmpeg issue2137 patch for MKV (fixes #9014) - ffmpeg issue2137 patch for AVI (fixes #9014) - fixed: bitstream mode improperly set. Ticket #10981. - Add av_popcount() to libavutil/common.h and bump minor version - added: export DTS profile information in ffmpeg - Add av_get_profile_name() to get profile names. - Show profile in avcodec_string(). - libfaac: add recognized profiles array - dca: add profile names - h264: add profile names for the existing defines - dca: consider a stream with XXCh/X96 in ExSS as DTS-HD HRA - added: metadata support to oggenc with vorbis streams (submitted upstream Issue #555) The following patch has been removed as its purpose is unclear and upstream code has diverged (passthrough works even without it): - Setup wanted pkt size in spdif muxers header parser The following patch: - When PMT is found, we have found mpegts header information, and av_find_stream_info doesn't need to read more to find streams has been re-replaced with - Speed up mpegts av_find_stream_info. The latter was apparently accidentally reverted in the previous FFmpeg update. The following patch has been added to fix a build regression with the configure flags we use on darwin: - swscale: fix build with --enable-runtime-cpudetect --disable-mmx/mmx2/amd3dnow
Diffstat (limited to 'lib/ffmpeg/ffserver.c')
-rw-r--r--lib/ffmpeg/ffserver.c75
1 files changed, 35 insertions, 40 deletions
diff --git a/lib/ffmpeg/ffserver.c b/lib/ffmpeg/ffserver.c
index 8f073fe365..9a3240808b 100644
--- a/lib/ffmpeg/ffserver.c
+++ b/lib/ffmpeg/ffserver.c
@@ -36,6 +36,7 @@
#include "libavutil/avstring.h"
#include "libavutil/lfg.h"
#include "libavutil/random_seed.h"
+#include "libavcore/parseutils.h"
#include "libavcodec/opt.h"
#include <stdarg.h>
#include <unistd.h>
@@ -91,6 +92,10 @@ static const char *http_state[] = {
"RTSP_SEND_PACKET",
};
+#if !FF_API_MAX_STREAMS
+#define MAX_STREAMS 20
+#endif
+
#define IOBUFFER_INIT_SIZE 8192
/* timeouts are in ms */
@@ -379,7 +384,10 @@ static void http_vlog(const char *fmt, va_list vargs)
}
}
-static void __attribute__ ((format (printf, 1, 2))) http_log(const char *fmt, ...)
+#ifdef __GNUC__
+__attribute__ ((format (printf, 1, 2)))
+#endif
+static void http_log(const char *fmt, ...)
{
va_list vargs;
va_start(vargs, fmt);
@@ -1187,19 +1195,6 @@ static int modify_current_stream(HTTPContext *c, char *rates)
return action_required;
}
-
-static void do_switch_stream(HTTPContext *c, int i)
-{
- if (c->switch_feed_streams[i] >= 0) {
-#ifdef PHILIP
- c->feed_streams[i] = c->switch_feed_streams[i];
-#endif
-
- /* Now update the stream */
- }
- c->switch_feed_streams[i] = -1;
-}
-
/* XXX: factorize in utils.c ? */
/* XXX: take care with different space meaning */
static void skip_spaces(const char **pp)
@@ -1573,7 +1568,7 @@ static int http_parse_request(HTTPContext *c)
if (modify_current_stream(c, ratebuf)) {
for (i = 0; i < FF_ARRAY_ELEMS(c->feed_streams); i++) {
if (c->switch_feed_streams[i] >= 0)
- do_switch_stream(c, i);
+ c->switch_feed_streams[i] = -1;
}
}
}
@@ -2344,7 +2339,7 @@ static int http_prepare_data(HTTPContext *c)
for(i=0;i<c->stream->nb_streams;i++) {
if (c->switch_feed_streams[i] == pkt.stream_index)
if (pkt.flags & AV_PKT_FLAG_KEY)
- do_switch_stream(c, i);
+ c->switch_feed_streams[i] = -1;
if (c->switch_feed_streams[i] >= 0)
c->switch_pending = 1;
}
@@ -2890,7 +2885,7 @@ static int rtsp_parse_request(HTTPContext *c)
len = sizeof(line) - 1;
memcpy(line, p, len);
line[len] = '\0';
- ff_rtsp_parse_line(header, line, NULL);
+ ff_rtsp_parse_line(header, line, NULL, NULL);
p = p1 + 1;
}
@@ -2929,7 +2924,7 @@ static int prepare_sdp_description(FFStream *stream, uint8_t **pbuffer,
struct in_addr my_ip)
{
AVFormatContext *avc;
- AVStream avs[MAX_STREAMS];
+ AVStream *avs = NULL;
int i;
avc = avformat_alloc_context();
@@ -2947,14 +2942,29 @@ static int prepare_sdp_description(FFStream *stream, uint8_t **pbuffer,
snprintf(avc->filename, 1024, "rtp://0.0.0.0");
}
+#if !FF_API_MAX_STREAMS
+ if (avc->nb_streams >= INT_MAX/sizeof(*avc->streams) ||
+ !(avc->streams = av_malloc(avc->nb_streams * sizeof(*avc->streams))))
+ goto sdp_done;
+#endif
+ if (avc->nb_streams >= INT_MAX/sizeof(*avs) ||
+ !(avs = av_malloc(avc->nb_streams * sizeof(*avs))))
+ goto sdp_done;
+
for(i = 0; i < stream->nb_streams; i++) {
avc->streams[i] = &avs[i];
avc->streams[i]->codec = stream->streams[i]->codec;
}
*pbuffer = av_mallocz(2048);
avf_sdp_create(&avc, 1, *pbuffer, 2048);
+
+ sdp_done:
+#if !FF_API_MAX_STREAMS
+ av_free(avc->streams);
+#endif
av_metadata_free(&avc->metadata);
av_free(avc);
+ av_free(avs);
return strlen(*pbuffer);
}
@@ -3477,6 +3487,7 @@ static AVStream *add_av_stream1(FFStream *stream, AVCodecContext *codec, int cop
fst->priv_data = av_mallocz(sizeof(FeedData));
fst->index = stream->nb_streams;
av_set_pts_info(fst, 33, 1, 90000);
+ fst->sample_aspect_ratio = (AVRational){0,1};
stream->streams[stream->nb_streams++] = fst;
return fst;
}
@@ -3952,27 +3963,11 @@ static int ffserver_opt_preset(const char *arg,
{
FILE *f=NULL;
char filename[1000], tmp[1000], tmp2[1000], line[1000];
- int i, ret = 0;
- const char *base[3]= { getenv("FFMPEG_DATADIR"),
- getenv("HOME"),
- FFMPEG_DATADIR,
- };
-
- for(i=0; i<3 && !f; i++){
- if(!base[i])
- continue;
- snprintf(filename, sizeof(filename), "%s%s/%s.ffpreset", base[i], i != 1 ? "" : "/.ffmpeg", arg);
- f= fopen(filename, "r");
- if(!f){
- AVCodec *codec = avcodec_find_encoder(avctx->codec_id);
- if (codec) {
- snprintf(filename, sizeof(filename), "%s%s/%s-%s.ffpreset", base[i], i != 1 ? "" : "/.ffmpeg", codec->name, arg);
- f= fopen(filename, "r");
- }
- }
- }
+ int ret = 0;
+ AVCodec *codec = avcodec_find_encoder(avctx->codec_id);
- if(!f){
+ if (!(f = get_preset_file(filename, sizeof(filename), arg, 0,
+ codec ? codec->name : NULL))) {
fprintf(stderr, "File for preset '%s' not found\n", arg);
return 1;
}
@@ -4410,7 +4405,7 @@ static int parse_ffconfig(const char *filename)
} else if (!strcasecmp(cmd, "VideoSize")) {
get_arg(arg, sizeof(arg), &p);
if (stream) {
- av_parse_video_frame_size(&video_enc.width, &video_enc.height, arg);
+ av_parse_video_size(&video_enc.width, &video_enc.height, arg);
if ((video_enc.width % 16) != 0 ||
(video_enc.height % 16) != 0) {
ERROR("Image size must be a multiple of 16\n");
@@ -4420,7 +4415,7 @@ static int parse_ffconfig(const char *filename)
get_arg(arg, sizeof(arg), &p);
if (stream) {
AVRational frame_rate;
- if (av_parse_video_frame_rate(&frame_rate, arg) < 0) {
+ if (av_parse_video_rate(&frame_rate, arg) < 0) {
ERROR("Incorrect frame rate: %s\n", arg);
} else {
video_enc.time_base.num = frame_rate.den;