am7xxx: use the same indenting style for all preprocessor directives
[libam7xxx.git] / contrib / libam7xxx-compile-on-Ubuntu-14.04-LTS.diff
1 diff --git a/examples/am7xxx-play.c b/examples/am7xxx-play.c
2 index 46a91c9..fed455f 100644
3 --- a/examples/am7xxx-play.c
4 +++ b/examples/am7xxx-play.c
5 @@ -31,7 +31,6 @@
6  
7  #include <libavdevice/avdevice.h>
8  #include <libavformat/avformat.h>
9 -#include <libavutil/imgutils.h>
10  #include <libswscale/swscale.h>
11  
12  #include <am7xxx.h>
13 @@ -308,7 +307,7 @@ static int am7xxx_play(const char *input_format_string,
14         }
15  
16         /* allocate an input frame */
17 -       picture_raw = av_frame_alloc();
18 +       picture_raw = avcodec_alloc_frame();
19         if (picture_raw == NULL) {
20                 fprintf(stderr, "cannot allocate the raw picture frame!\n");
21                 ret = -ENOMEM;
22 @@ -316,7 +315,7 @@ static int am7xxx_play(const char *input_format_string,
23         }
24  
25         /* allocate output frame */
26 -       picture_scaled = av_frame_alloc();
27 +       picture_scaled = avcodec_alloc_frame();
28         if (picture_scaled == NULL) {
29                 fprintf(stderr, "cannot allocate the scaled picture!\n");
30                 ret = -ENOMEM;
31 @@ -327,10 +326,9 @@ static int am7xxx_play(const char *input_format_string,
32         picture_scaled->height = (output_ctx.codec_ctx)->height;
33  
34         /* calculate the bytes needed for the output image and create buffer for the output image */
35 -       out_buf_size = av_image_get_buffer_size((output_ctx.codec_ctx)->pix_fmt,
36 -                                               (output_ctx.codec_ctx)->width,
37 -                                               (output_ctx.codec_ctx)->height,
38 -                                               1);
39 +       out_buf_size = avpicture_get_size((output_ctx.codec_ctx)->pix_fmt,
40 +                                         (output_ctx.codec_ctx)->width,
41 +                                         (output_ctx.codec_ctx)->height);
42         out_buf = av_malloc(out_buf_size * sizeof(uint8_t));
43         if (out_buf == NULL) {
44                 fprintf(stderr, "cannot allocate output data buffer!\n");
45 @@ -339,13 +337,11 @@ static int am7xxx_play(const char *input_format_string,
46         }
47  
48         /* assign appropriate parts of buffer to image planes in picture_scaled */
49 -       av_image_fill_arrays(picture_scaled->data,
50 -                            picture_scaled->linesize,
51 -                            out_buf,
52 -                            (output_ctx.codec_ctx)->pix_fmt,
53 -                            (output_ctx.codec_ctx)->width,
54 -                            (output_ctx.codec_ctx)->height,
55 -                            1);
56 +       avpicture_fill((AVPicture *)picture_scaled,
57 +                      out_buf,
58 +                      (output_ctx.codec_ctx)->pix_fmt,
59 +                      (output_ctx.codec_ctx)->width,
60 +                      (output_ctx.codec_ctx)->height);
61  
62         sw_scale_ctx = sws_getCachedContext(NULL,
63                                             (input_ctx.codec_ctx)->width,
64 @@ -458,17 +454,17 @@ static int am7xxx_play(const char *input_format_string,
65                 }
66  end_while:
67                 if (!output_ctx.raw_output && got_packet)
68 -                       av_packet_unref(&out_packet);
69 -               av_packet_unref(&in_packet);
70 +                       av_free_packet(&out_packet);
71 +               av_free_packet(&in_packet);
72         }
73  
74         sws_freeContext(sw_scale_ctx);
75  cleanup_out_buf:
76         av_free(out_buf);
77  cleanup_picture_scaled:
78 -       av_frame_free(&picture_scaled);
79 +       avcodec_free_frame(&picture_scaled);
80  cleanup_picture_raw:
81 -       av_frame_free(&picture_raw);
82 +       avcodec_free_frame(&picture_raw);
83  
84  cleanup_output:
85         /* av_free is needed as well,
86 diff --git a/src/am7xxx.c b/src/am7xxx.c
87 index 84d7e9c..f26fc18 100644
88 --- a/src/am7xxx.c
89 +++ b/src/am7xxx.c
90 @@ -1106,7 +1106,7 @@ AM7XXX_PUBLIC int am7xxx_init(am7xxx_context **ctx)
91                 goto out_free_context;
92         }
93  
94 -       libusb_set_debug((*ctx)->usb_context, LIBUSB_LOG_LEVEL_INFO);
95 +       libusb_set_debug((*ctx)->usb_context, 3);
96  
97         ret = scan_devices(*ctx, SCAN_OP_BUILD_DEVLIST , 0, NULL);
98         if (ret < 0) {