aboutsummaryrefslogtreecommitdiffstats
path: root/ffserver.c
diff options
context:
space:
mode:
authorRonald S. Bultje <rsbultje@gmail.com>2010-03-31 21:02:34 +0000
committerRonald S. Bultje <rsbultje@gmail.com>2010-03-31 21:02:34 +0000
commitd9521cb1197c8b5bd1611ec0edfdf58b7a56e30e (patch)
treea959e40a32e98d6254fee991629bc82cd1d21ae8 /ffserver.c
parentd103218046883cb9e7f6e83af53b0982fee370ba (diff)
downloadffmpeg-d9521cb1197c8b5bd1611ec0edfdf58b7a56e30e.tar.gz
Fix FFM-based streaming from ffmpeg to ffserver. The basic problem is that
we'd memset() the codec context to zero, thereby setting audio input to U8 and video to YUV420P. For most video encoders, that actually works, but for most audio codecs, it doesn't. This patch changes defaults to those set by avcodec_context_get_defaults() and have ffmpeg figure out the optimal encoding format itself if not set explicitely (as it does for the non-ffserver-cases also). Originally committed as revision 22751 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'ffserver.c')
-rw-r--r--ffserver.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/ffserver.c b/ffserver.c
index fad1548c6e..f68ca11fbb 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -4039,7 +4039,6 @@ static int parse_ffconfig(const char *filename)
filename, line_num);
} else {
FFStream *s;
- const AVClass *class;
stream = av_mallocz(sizeof(FFStream));
get_arg(stream->filename, sizeof(stream->filename), &p);
q = strrchr(stream->filename, '>');
@@ -4055,15 +4054,8 @@ static int parse_ffconfig(const char *filename)
}
stream->fmt = ffserver_guess_format(NULL, stream->filename, NULL);
- /* fetch avclass so AVOption works
- * FIXME try to use avcodec_get_context_defaults2
- * without changing defaults too much */
- avcodec_get_context_defaults(&video_enc);
- class = video_enc.av_class;
- memset(&audio_enc, 0, sizeof(AVCodecContext));
- memset(&video_enc, 0, sizeof(AVCodecContext));
- audio_enc.av_class = class;
- video_enc.av_class = class;
+ avcodec_get_context_defaults2(&video_enc, AVMEDIA_TYPE_VIDEO);
+ avcodec_get_context_defaults2(&audio_enc, AVMEDIA_TYPE_AUDIO);
audio_id = CODEC_ID_NONE;
video_id = CODEC_ID_NONE;
if (stream->fmt) {