1 From 25fee52c64caa7230a3c2b03467114e0c84fee67 Mon Sep 17 00:00:00 2001
2 From: Antonio Ospite <ospite@studenti.unina.it>
3 Date: Sun, 28 Jul 2013 19:35:41 +0200
4 Subject: [PATCH] Revert "am7xxx-play: switch to avcodec_encode_video2()"
5 X-Face: z*RaLf`X<@C75u6Ig9}{oW$H;1_\2t5)({*|jhM<pyWR#k60!#=#>/Vb;]yA5<GWI5`6u&+
6 ;6b'@y|8w"wB;4/e!7wYYrcqdJFY,~%Gk_4]cq$Ei/7<j&N3ah(m`ku?pX.&+~:_/wC~dwn^)MizBG
7 !pE^+iDQQ1yC6^,)YDKkxDd!T>\I~93>J<_`<4)A{':UrE
9 This reverts commit b344c71f3e03f912d8b6ee7d96cdd67b31cdf8cc.
11 avcodec_encode_video2() has been introduced in lavc 54.01.0 but Debian Wheezy
12 ships with lavc 53, so for now we should revert this change for the Debian
15 When this patch will be dropped maybe the package should depend on
16 libavcodec54 as the old API may be disabled in the Debian packages.
18 examples/am7xxx-play.c | 29 +++++++++--------------------
19 1 file changed, 9 insertions(+), 20 deletions(-)
21 diff --git a/examples/am7xxx-play.c b/examples/am7xxx-play.c
22 index 3230e67..37d1191 100644
23 --- a/examples/am7xxx-play.c
24 +++ b/examples/am7xxx-play.c
25 @@ -285,12 +285,9 @@ static int am7xxx_play(const char *input_format_string,
29 - uint8_t *out_picture;
30 struct SwsContext *sw_scale_ctx;
32 - AVPacket out_packet;
37 ret = video_input_init(&input_ctx, input_format_string, input_path, input_options);
38 @@ -393,26 +390,20 @@ static int am7xxx_play(const char *input_format_string,
39 picture_scaled->linesize);
41 if (output_ctx.raw_output) {
42 - out_picture = out_buf;
43 out_picture_size = out_buf_size;
45 picture_scaled->quality = (output_ctx.codec_ctx)->global_quality;
46 - av_init_packet(&out_packet);
47 - out_packet.data = NULL;
48 - out_packet.size = 0;
50 - ret = avcodec_encode_video2(output_ctx.codec_ctx,
54 - if (ret < 0 || !got_packet) {
55 + /* TODO: switch to avcodec_encode_video2() eventually */
56 + out_picture_size = avcodec_encode_video(output_ctx.codec_ctx,
60 + if (out_picture_size < 0) {
61 fprintf(stderr, "cannot encode video\n");
62 + ret = out_picture_size;
67 - out_picture = out_packet.data;
68 - out_picture_size = out_packet.size;
72 @@ -423,7 +414,7 @@ static int am7xxx_play(const char *input_format_string,
74 snprintf(filename, NAME_MAX, "out.raw");
75 file = fopen(filename, "wb");
76 - fwrite(out_picture, 1, out_picture_size, file);
77 + fwrite(out_buf, 1, out_picture_size, file);
81 @@ -431,7 +422,7 @@ static int am7xxx_play(const char *input_format_string,
83 (output_ctx.codec_ctx)->width,
84 (output_ctx.codec_ctx)->height,
89 perror("am7xxx_send_image");
90 @@ -440,8 +431,6 @@ static int am7xxx_play(const char *input_format_string,
94 - if (!output_ctx.raw_output && got_packet)
95 - av_free_packet(&out_packet);
96 av_free_packet(&in_packet);