Commit 6bdd2e46 authored by dscho's avatar dscho

support new ffmpeg version

parent da7b3e71
......@@ -8,7 +8,7 @@ if HAVE_MP3LAME
MP3LAME_LIB=-lmp3lame
endif
vnc2mpg_CFLAGS=-I$(FFMPEG_HOME)/libavformat -I$(FFMPEG_HOME)/libavcodec
vnc2mpg_CFLAGS=-I$(FFMPEG_HOME)/libavformat -I$(FFMPEG_HOME)/libavcodec -I$(FFMPEG_HOME)/libavutil
vnc2mpg_LDADD=$(LDADD) $(FFMPEG_HOME)/libavformat/libavformat.a $(FFMPEG_HOME)/libavcodec/libavcodec.a $(MP3LAME_LIB) -lm
FFMPEG_CLIENT=vnc2mpg
......
......@@ -55,12 +55,16 @@ AVStream *add_video_stream(AVFormatContext *oc, int codec_id, int w, int h)
exit(1);
}
#if LIBAVFORMAT_BUILD<4629
c = &st->codec;
#else
c = st->codec;
#endif
c->codec_id = codec_id;
c->codec_type = CODEC_TYPE_VIDEO;
/* put sample parameters */
c->bit_rate = 400000;
c->bit_rate = 800000;
/* resolution must be a multiple of two */
c->width = w;
c->height = h;
......@@ -116,7 +120,11 @@ void open_video(AVFormatContext *oc, AVStream *st)
AVCodec *codec;
AVCodecContext *c;
#if LIBAVFORMAT_BUILD<4629
c = &st->codec;
#else
c = st->codec;
#endif
/* find the video encoder */
codec = avcodec_find_encoder(c->codec_id);
......@@ -165,7 +173,11 @@ void write_video_frame(AVFormatContext *oc, AVStream *st)
AVCodecContext *c;
AVFrame *picture_ptr;
#if LIBAVFORMAT_BUILD<4629
c = &st->codec;
#else
c = st->codec;
#endif
if (c->pix_fmt != PIX_FMT_RGB565) {
/* as we only generate a RGB565 picture, we must convert it
......@@ -219,7 +231,7 @@ void write_video_frame(AVFormatContext *oc, AVStream *st)
void close_video(AVFormatContext *oc, AVStream *st)
{
avcodec_close(&st->codec);
avcodec_close(st->codec);
av_free(picture->data[0]);
av_free(picture);
if (tmp_picture) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment