Merge tag 'v0.1.5' into debian
[libam7xxx.git] / debian / patches / 0001-Revert-am7xxx-play-switch-to-avcodec_encode_video2.patch
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
8
9 This reverts commit b344c71f3e03f912d8b6ee7d96cdd67b31cdf8cc.
10
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
13 packages.
14
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.
17 ---
18  examples/am7xxx-play.c | 29 +++++++++--------------------
19  1 file changed, 9 insertions(+), 20 deletions(-)
20
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,
26         int out_buf_size;
27         uint8_t *out_buf;
28         int out_picture_size;
29 -       uint8_t *out_picture;
30         struct SwsContext *sw_scale_ctx;
31         AVPacket in_packet;
32 -       AVPacket out_packet;
33         int got_picture;
34 -       int got_packet;
35         int ret;
36  
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);
40  
41                         if (output_ctx.raw_output) {
42 -                               out_picture = out_buf;
43                                 out_picture_size = out_buf_size;
44                         } else {
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;
49 -                               got_packet = 0;
50 -                               ret = avcodec_encode_video2(output_ctx.codec_ctx,
51 -                                                           &out_packet,
52 -                                                           picture_scaled,
53 -                                                           &got_packet);
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,
57 +                                                                       out_buf,
58 +                                                                       out_buf_size,
59 +                                                                       picture_scaled);
60 +                               if (out_picture_size < 0) {
61                                         fprintf(stderr, "cannot encode video\n");
62 +                                       ret = out_picture_size;
63                                         run = 0;
64                                         goto end_while;
65                                 }
66 -
67 -                               out_picture = out_packet.data;
68 -                               out_picture_size = out_packet.size;
69                         }
70  
71  #ifdef DEBUG
72 @@ -423,7 +414,7 @@ static int am7xxx_play(const char *input_format_string,
73                         else
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);
78                         fclose(file);
79  #endif
80  
81 @@ -431,7 +422,7 @@ static int am7xxx_play(const char *input_format_string,
82                                                 image_format,
83                                                 (output_ctx.codec_ctx)->width,
84                                                 (output_ctx.codec_ctx)->height,
85 -                                               out_picture,
86 +                                               out_buf,
87                                                 out_picture_size);
88                         if (ret < 0) {
89                                 perror("am7xxx_send_image");
90 @@ -440,8 +431,6 @@ static int am7xxx_play(const char *input_format_string,
91                         }
92                 }
93  end_while:
94 -               if (!output_ctx.raw_output && got_packet)
95 -                       av_free_packet(&out_packet);
96                 av_free_packet(&in_packet);
97         }
98  
99 -- 
100 1.8.3.2
101