Browse code

Merge commit 'f3298f12997eb4b7ad203766f768f92e3dd72a2a'

* commit 'f3298f12997eb4b7ad203766f768f92e3dd72a2a':
Return proper error code after av_log_ask_for_sample()
configure: cosmetics: Separate hwaccel dependencies from decoders/encoders
oggdec: check memory allocation

Conflicts:
configure
libavcodec/pictordec.c
libavformat/anm.c
libavformat/oggdec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>

Michael Niedermayer authored on 2012/12/24 23:09:58
Showing 18 changed files
... ...
@@ -1627,9 +1627,10 @@ mdct_select="fft"
1627 1627
 rdft_select="fft"
1628 1628
 mpegaudio_select="mpegaudiodsp"
1629 1629
 mpegaudiodsp_select="dct"
1630
+mpegvideo_select="videodsp"
1630 1631
 mpegvideoenc_select="mpegvideo"
1631 1632
 
1632
-# decoders / encoders / hardware accelerators
1633
+# decoders / encoders
1633 1634
 aac_decoder_select="mdct sinewin"
1634 1635
 aac_encoder_select="mdct sinewin"
1635 1636
 aac_latm_decoder_select="aac_decoder aac_latm_parser"
... ...
@@ -1675,18 +1676,9 @@ h261_decoder_select="error_resilience mpegvideo"
1675 1675
 h261_encoder_select="aandcttables mpegvideoenc"
1676 1676
 h263_decoder_select="error_resilience h263_parser mpegvideo"
1677 1677
 h263_encoder_select="aandcttables error_resilience mpegvideoenc"
1678
-h263_vaapi_hwaccel_select="vaapi h263_decoder"
1679 1678
 h263i_decoder_select="h263_decoder"
1680 1679
 h263p_encoder_select="h263_encoder"
1681
-h264_crystalhd_decoder_select="crystalhd h264_mp4toannexb_bsf h264_parser"
1682 1680
 h264_decoder_select="error_resilience golomb h264chroma h264dsp h264pred h264qpel mpegvideo"
1683
-h264_dxva2_hwaccel_deps="dxva2api_h"
1684
-h264_dxva2_hwaccel_select="dxva2 h264_decoder"
1685
-h264_vaapi_hwaccel_select="vaapi h264_decoder"
1686
-h264_vda_decoder_select="vda h264_parser h264_decoder"
1687
-h264_vda_hwaccel_deps="VideoDecodeAcceleration_VDADecoder_h pthreads"
1688
-h264_vda_hwaccel_select="vda h264_decoder"
1689
-h264_vdpau_decoder_select="vdpau h264_decoder"
1690 1681
 huffyuv_encoder_select="huffman"
1691 1682
 iac_decoder_select="fft mdct sinewin"
1692 1683
 imc_decoder_select="fft mdct sinewin"
... ...
@@ -1709,27 +1701,14 @@ mp3on4_decoder_select="mpegaudio"
1709 1709
 mp3on4float_decoder_select="mpegaudio"
1710 1710
 mpc7_decoder_select="mpegaudiodsp"
1711 1711
 mpc8_decoder_select="mpegaudiodsp"
1712
-mpeg_vdpau_decoder_select="vdpau mpegvideo_decoder"
1713 1712
 mpeg_xvmc_decoder_deps="X11_extensions_XvMClib_h"
1714 1713
 mpeg_xvmc_decoder_select="mpegvideo_decoder"
1715
-mpeg1_vdpau_decoder_select="vdpau mpeg1video_decoder"
1716
-mpeg1_vdpau_hwaccel_select="vdpau mpeg1video_decoder"
1717 1714
 mpeg1video_decoder_select="error_resilience mpegvideo"
1718 1715
 mpeg1video_encoder_select="aandcttables error_resilience mpegvideoenc"
1719
-mpeg2_crystalhd_decoder_select="crystalhd"
1720
-mpeg2_dxva2_hwaccel_deps="dxva2api_h"
1721
-mpeg2_dxva2_hwaccel_select="dxva2 mpeg2video_decoder"
1722
-mpeg2_vdpau_hwaccel_select="vdpau mpeg2video_decoder"
1723
-mpeg2_vaapi_hwaccel_select="vaapi mpeg2video_decoder"
1724 1716
 mpeg2video_decoder_select="error_resilience mpegvideo"
1725 1717
 mpeg2video_encoder_select="aandcttables error_resilience mpegvideoenc"
1726
-mpeg4_crystalhd_decoder_select="crystalhd"
1727 1718
 mpeg4_decoder_select="h263_decoder mpeg4video_parser"
1728 1719
 mpeg4_encoder_select="h263_encoder"
1729
-mpeg4_vaapi_hwaccel_select="vaapi mpeg4_decoder"
1730
-mpeg4_vdpau_decoder_select="vdpau mpeg4_decoder"
1731
-mpegvideo_select="videodsp"
1732
-msmpeg4_crystalhd_decoder_select="crystalhd"
1733 1720
 msmpeg4v1_decoder_select="h263_decoder"
1734 1721
 msmpeg4v1_encoder_select="h263_encoder"
1735 1722
 msmpeg4v2_decoder_select="h263_decoder"
... ...
@@ -1770,12 +1749,7 @@ truehd_decoder_select="mlp_parser"
1770 1770
 tscc_decoder_select="zlib"
1771 1771
 twinvq_decoder_select="mdct lsp sinewin"
1772 1772
 utvideo_encoder_select="huffman"
1773
-vc1_crystalhd_decoder_select="crystalhd"
1774 1773
 vc1_decoder_select="h263_decoder h264chroma h264qpel"
1775
-vc1_dxva2_hwaccel_deps="dxva2api_h"
1776
-vc1_dxva2_hwaccel_select="dxva2 vc1_decoder"
1777
-vc1_vaapi_hwaccel_select="vaapi vc1_decoder"
1778
-vc1_vdpau_decoder_select="vdpau vc1_decoder"
1779 1774
 vc1image_decoder_select="vc1_decoder"
1780 1775
 vorbis_decoder_select="mdct"
1781 1776
 vorbis_encoder_select="mdct"
... ...
@@ -1796,10 +1770,6 @@ wmv1_encoder_select="h263_encoder"
1796 1796
 wmv2_decoder_select="h263_decoder"
1797 1797
 wmv2_encoder_select="h263_encoder"
1798 1798
 wmv3_decoder_select="vc1_decoder"
1799
-wmv3_crystalhd_decoder_select="crystalhd"
1800
-wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
1801
-wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
1802
-wmv3_vdpau_decoder_select="vc1_vdpau_decoder"
1803 1799
 wmv3image_decoder_select="wmv3_decoder"
1804 1800
 zerocodec_decoder_select="zlib"
1805 1801
 zlib_decoder_select="zlib"
... ...
@@ -1807,11 +1777,43 @@ zlib_encoder_select="zlib"
1807 1807
 zmbv_decoder_select="zlib"
1808 1808
 zmbv_encoder_select="zlib"
1809 1809
 
1810
+# hardware accelerators
1810 1811
 crystalhd_deps="libcrystalhd_libcrystalhd_if_h"
1811 1812
 vaapi_deps="va_va_h"
1812 1813
 vda_deps="VideoDecodeAcceleration_VDADecoder_h pthreads"
1813 1814
 vdpau_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
1814 1815
 
1816
+h263_vaapi_hwaccel_select="vaapi h263_decoder"
1817
+h264_crystalhd_decoder_select="crystalhd h264_mp4toannexb_bsf h264_parser"
1818
+h264_dxva2_hwaccel_deps="dxva2api_h"
1819
+h264_dxva2_hwaccel_select="dxva2 h264_decoder"
1820
+h264_vaapi_hwaccel_select="vaapi h264_decoder"
1821
+h264_vda_decoder_select="vda h264_parser h264_decoder"
1822
+h264_vda_hwaccel_deps="VideoDecodeAcceleration_VDADecoder_h pthreads"
1823
+h264_vda_hwaccel_select="vda h264_decoder"
1824
+h264_vdpau_decoder_select="vdpau h264_decoder"
1825
+mpeg_vdpau_decoder_select="vdpau mpegvideo_decoder"
1826
+mpeg1_vdpau_decoder_select="vdpau mpeg1video_decoder"
1827
+mpeg1_vdpau_hwaccel_select="vdpau mpeg1video_decoder"
1828
+mpeg2_crystalhd_decoder_select="crystalhd"
1829
+mpeg2_dxva2_hwaccel_deps="dxva2api_h"
1830
+mpeg2_dxva2_hwaccel_select="dxva2 mpeg2video_decoder"
1831
+mpeg2_vdpau_hwaccel_select="vdpau mpeg2video_decoder"
1832
+mpeg2_vaapi_hwaccel_select="vaapi mpeg2video_decoder"
1833
+mpeg4_crystalhd_decoder_select="crystalhd"
1834
+mpeg4_vaapi_hwaccel_select="vaapi mpeg4_decoder"
1835
+mpeg4_vdpau_decoder_select="vdpau mpeg4_decoder"
1836
+msmpeg4_crystalhd_decoder_select="crystalhd"
1837
+vc1_crystalhd_decoder_select="crystalhd"
1838
+vc1_dxva2_hwaccel_deps="dxva2api_h"
1839
+vc1_dxva2_hwaccel_select="dxva2 vc1_decoder"
1840
+vc1_vaapi_hwaccel_select="vaapi vc1_decoder"
1841
+vc1_vdpau_decoder_select="vdpau vc1_decoder"
1842
+wmv3_crystalhd_decoder_select="crystalhd"
1843
+wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
1844
+wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
1845
+wmv3_vdpau_decoder_select="vc1_vdpau_decoder"
1846
+
1815 1847
 # parsers
1816 1848
 h264_parser_select="error_resilience golomb h264dsp h264pred mpegvideo"
1817 1849
 mpeg4video_parser_select="error_resilience mpegvideo"
... ...
@@ -159,7 +159,7 @@ static int decode_frame(AVCodecContext *avctx,
159 159
                     break; // stop
160 160
                 if (type == 2) {
161 161
                     av_log_ask_for_sample(avctx, "unknown opcode");
162
-                    return AVERROR_INVALIDDATA;
162
+                    return AVERROR_PATCHWELCOME;
163 163
                 }
164 164
                 continue;
165 165
             }
... ...
@@ -334,7 +334,7 @@ static int cinepak_decode (CinepakContext *s)
334 334
     if (s->sega_film_skip_bytes == -1) {
335 335
         if (!encoded_buf_size) {
336 336
             av_log_ask_for_sample(s->avctx, "encoded_buf_size is 0");
337
-            return AVERROR_INVALIDDATA;
337
+            return AVERROR_PATCHWELCOME;
338 338
         }
339 339
         if (encoded_buf_size != s->size && (s->size % encoded_buf_size) != 0) {
340 340
             /* If the encoded frame size differs from the frame size as indicated
... ...
@@ -2942,7 +2942,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
2942 2942
                         av_log_ask_for_sample(s->avctx, NULL);
2943 2943
                         s->picture_structure = last_pic_structure;
2944 2944
                         s->droppable         = last_pic_droppable;
2945
-                        return AVERROR_INVALIDDATA;
2945
+                        return AVERROR_PATCHWELCOME;
2946 2946
                     }
2947 2947
 
2948 2948
                     /* Take ownership of this buffer. Note that if another thread owned
... ...
@@ -131,7 +131,7 @@ static int decode_frame(AVCodecContext *avctx,
131 131
     bpp            = bits_per_plane * s->nb_planes;
132 132
     if (bits_per_plane > 8 || bpp < 1 || bpp > 32) {
133 133
         av_log_ask_for_sample(avctx, "unsupported bit depth\n");
134
-        return AVERROR_INVALIDDATA;
134
+        return AVERROR_PATCHWELCOME;
135 135
     }
136 136
 
137 137
     if (bytestream2_peek_byte(&s->g) == 0xFF || bpp == 1 || bpp == 4 || bpp == 8) {
... ...
@@ -57,7 +57,7 @@ static int ptx_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
57 57
 
58 58
     if (bytes_per_pixel != 2) {
59 59
         av_log_ask_for_sample(avctx, "Image format is not RGB15.\n");
60
-        return -1;
60
+        return AVERROR_PATCHWELCOME;
61 61
     }
62 62
 
63 63
     avctx->pix_fmt = AV_PIX_FMT_BGR555LE;
... ...
@@ -356,7 +356,7 @@ static int truemotion1_decode_header(TrueMotion1Context *s)
356 356
     if (s->flags & FLAG_SPRITE) {
357 357
         av_log_ask_for_sample(s->avctx, "SPRITE frame found.\n");
358 358
         /* FIXME header.width, height, xoffset and yoffset aren't initialized */
359
-        return -1;
359
+        return AVERROR_PATCHWELCOME;
360 360
     } else {
361 361
         s->w = header.xsize;
362 362
         s->h = header.ysize;
... ...
@@ -65,7 +65,7 @@ static av_cold int truespeech_decode_init(AVCodecContext * avctx)
65 65
 
66 66
     if (avctx->channels != 1) {
67 67
         av_log_ask_for_sample(avctx, "Unsupported channel count: %d\n", avctx->channels);
68
-        return AVERROR(EINVAL);
68
+        return AVERROR_PATCHWELCOME;
69 69
     }
70 70
 
71 71
     avctx->channel_layout = AV_CH_LAYOUT_MONO;
... ...
@@ -203,7 +203,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
203 203
 
204 204
     } else {
205 205
         av_log_ask_for_sample(avctx, "Unsupported extradata size\n");
206
-        return AVERROR_INVALIDDATA;
206
+        return AVERROR_PATCHWELCOME;
207 207
     }
208 208
 
209 209
     /* generic init */
... ...
@@ -299,7 +299,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
299 299
 
300 300
     } else {
301 301
         av_log_ask_for_sample(avctx, "Unknown extradata size\n");
302
-        return AVERROR_INVALIDDATA;
302
+        return AVERROR_PATCHWELCOME;
303 303
     }
304 304
 
305 305
     /** generic init */
... ...
@@ -690,7 +690,7 @@ static int decode_channel_transform(WMAProDecodeCtx* s)
690 690
         if (get_bits1(&s->gb)) {
691 691
             av_log_ask_for_sample(s->avctx,
692 692
                                   "unsupported channel transform bit\n");
693
-            return AVERROR_INVALIDDATA;
693
+            return AVERROR_PATCHWELCOME;
694 694
         }
695 695
 
696 696
         for (s->num_chgroups = 0; remaining_channels &&
... ...
@@ -1160,7 +1160,7 @@ static int decode_subframe(WMAProDecodeCtx *s)
1160 1160
     /** no idea for what the following bit is used */
1161 1161
     if (get_bits1(&s->gb)) {
1162 1162
         av_log_ask_for_sample(s->avctx, "reserved bit set\n");
1163
-        return AVERROR_INVALIDDATA;
1163
+        return AVERROR_PATCHWELCOME;
1164 1164
     }
1165 1165
 
1166 1166
 
... ...
@@ -86,7 +86,7 @@ static int read_header(AVFormatContext *s)
86 86
     avio_skip(pb, 4); /* magic number */
87 87
     if (avio_rl16(pb) != MAX_PAGES) {
88 88
         av_log_ask_for_sample(s, "max_pages != " AV_STRINGIFY(MAX_PAGES) "\n");
89
-        return AVERROR_INVALIDDATA;
89
+        return AVERROR_PATCHWELCOME;
90 90
     }
91 91
 
92 92
     anm->nb_pages   = avio_rl16(pb);
... ...
@@ -163,7 +163,7 @@ static int read_header(AVFormatContext *s)
163 163
 
164 164
 invalid:
165 165
     av_log_ask_for_sample(s, NULL);
166
-    return AVERROR_INVALIDDATA;
166
+    return AVERROR_PATCHWELCOME;
167 167
 }
168 168
 
169 169
 static int read_packet(AVFormatContext *s,
... ...
@@ -93,7 +93,7 @@ static int au_read_header(AVFormatContext *s)
93 93
 
94 94
     if (!(bps = av_get_bits_per_sample(codec))) {
95 95
         av_log_ask_for_sample(s, "could not determine bits per sample\n");
96
-        return AVERROR_INVALIDDATA;
96
+        return AVERROR_PATCHWELCOME;
97 97
     }
98 98
 
99 99
     if (channels == 0 || channels > 64) {
... ...
@@ -56,7 +56,7 @@ static int read_header(AVFormatContext *s)
56 56
     st->nb_frames = avio_rb32(pb);
57 57
     if (avio_rb16(pb) != 0) {
58 58
         av_log_ask_for_sample(s, "unsupported packing method\n");
59
-        return AVERROR_INVALIDDATA;
59
+        return AVERROR_PATCHWELCOME;
60 60
     }
61 61
 
62 62
     avio_skip(pb, 2);
... ...
@@ -115,7 +115,7 @@ static int mtv_read_header(AVFormatContext *s)
115 115
 
116 116
     if (audio_subsegments == 0) {
117 117
         av_log_ask_for_sample(s, "MTV files without audio are not supported\n");
118
-        return AVERROR_INVALIDDATA;
118
+        return AVERROR_PATCHWELCOME;
119 119
     }
120 120
 
121 121
     mtv->full_segment_size =
... ...
@@ -220,8 +220,8 @@ static int ogg_new_stream(AVFormatContext *s, uint32_t serial)
220 220
     if (av_size_mult(ogg->nstreams + 1, sizeof(*ogg->streams), &size) < 0 ||
221 221
         !(os = av_realloc(ogg->streams, size)))
222 222
         return AVERROR(ENOMEM);
223
-    ogg->streams      = os;
224
-    os                = ogg->streams + idx;
223
+    ogg->streams = os;
224
+    os           = ogg->streams + idx;
225 225
     memset(os, 0, sizeof(*os));
226 226
     os->serial        = serial;
227 227
     os->bufsize       = DECODER_BUFFER_SIZE;
... ...
@@ -374,6 +374,8 @@ static int ogg_read_page(AVFormatContext *s, int *sid)
374 374
 
375 375
     if (os->bufsize - os->bufpos < size) {
376 376
         uint8_t *nb = av_malloc((os->bufsize *= 2) + FF_INPUT_BUFFER_PADDING_SIZE);
377
+        if (!nb)
378
+            return AVERROR(ENOMEM);
377 379
         memcpy(nb, os->buf, os->bufpos);
378 380
         av_free(os->buf);
379 381
         os->buf = nb;
... ...
@@ -50,7 +50,7 @@ static int rso_read_header(AVFormatContext *s)
50 50
     bps = av_get_bits_per_sample(codec);
51 51
     if (!bps) {
52 52
         av_log_ask_for_sample(s, "could not determine bits per sample\n");
53
-        return AVERROR_INVALIDDATA;
53
+        return AVERROR_PATCHWELCOME;
54 54
     }
55 55
 
56 56
     /* now we are ready: build format streams */
... ...
@@ -78,7 +78,7 @@ static int smjpeg_read_header(AVFormatContext *s)
78 78
         case SMJPEG_SND:
79 79
             if (ast) {
80 80
                 av_log_ask_for_sample(s, "multiple audio streams not supported\n");
81
-                return AVERROR_INVALIDDATA;
81
+                return AVERROR_PATCHWELCOME;
82 82
             }
83 83
             hlength = avio_rb32(pb);
84 84
             if (hlength < 8)
... ...
@@ -414,7 +414,7 @@ static int spdif_header_truehd(AVFormatContext *s, AVPacket *pkt)
414 414
          * distribute the TrueHD frames in the MAT frame */
415 415
         av_log(s, AV_LOG_ERROR, "TrueHD frame too big, %d bytes\n", pkt->size);
416 416
         av_log_ask_for_sample(s, NULL);
417
-        return AVERROR_INVALIDDATA;
417
+        return AVERROR_PATCHWELCOME;
418 418
     }
419 419
 
420 420
     memcpy(&ctx->hd_buf[ctx->hd_buf_count * TRUEHD_FRAME_OFFSET - BURST_HEADER_SIZE + mat_code_length],