summaryrefslogtreecommitdiffstats
path: root/client_examples/vnc2mpg.c
diff options
context:
space:
mode:
authordscho <dscho>2005-09-27 15:07:08 +0000
committerdscho <dscho>2005-09-27 15:07:08 +0000
commit6bdd2e466a0e6be5245f3c042c2ff230e809fe78 (patch)
treef9ddc014ee63c93f74af9589905558275b9cc8eb /client_examples/vnc2mpg.c
parentda7b3e714f8f9b501cb13075f6433416410bd6aa (diff)
downloadlibtdevnc-6bdd2e466a0e6be5245f3c042c2ff230e809fe78.tar.gz
libtdevnc-6bdd2e466a0e6be5245f3c042c2ff230e809fe78.zip
support new ffmpeg version
Diffstat (limited to 'client_examples/vnc2mpg.c')
-rw-r--r--client_examples/vnc2mpg.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/client_examples/vnc2mpg.c b/client_examples/vnc2mpg.c
index bfce619..57fe1a8 100644
--- a/client_examples/vnc2mpg.c
+++ b/client_examples/vnc2mpg.c
@@ -54,13 +54,17 @@ AVStream *add_video_stream(AVFormatContext *oc, int codec_id, int w, int h)
fprintf(stderr, "Could not alloc stream\n");
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);
@@ -164,8 +172,12 @@ void write_video_frame(AVFormatContext *oc, AVStream *st)
int out_size, ret;
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) {