| 1790 | #if CONFIG_ZLIB |
| 1791 | #define DECOMPRESS_BUF_SIZE (256 * 1024) |
| 1792 | static int http_buf_read_compressed(URLContext *h, uint8_t *buf, int size) |
| 1793 | { |
| 1794 | HTTPContext *s = h->priv_data; |
| 1795 | int ret; |
| 1796 | |
| 1797 | if (!s->inflate_buffer) { |
| 1798 | s->inflate_buffer = av_malloc(DECOMPRESS_BUF_SIZE); |
| 1799 | if (!s->inflate_buffer) |
| 1800 | return AVERROR(ENOMEM); |
| 1801 | } |
| 1802 | |
| 1803 | if (s->inflate_stream.avail_in == 0) { |
| 1804 | int read = http_buf_read(h, s->inflate_buffer, DECOMPRESS_BUF_SIZE); |
| 1805 | if (read <= 0) |
| 1806 | return read; |
| 1807 | s->inflate_stream.next_in = s->inflate_buffer; |
| 1808 | s->inflate_stream.avail_in = read; |
| 1809 | } |
| 1810 | |
| 1811 | s->inflate_stream.avail_out = size; |
| 1812 | s->inflate_stream.next_out = buf; |
| 1813 | |
| 1814 | ret = inflate(&s->inflate_stream, Z_SYNC_FLUSH); |
| 1815 | if (ret != Z_OK && ret != Z_STREAM_END) |
| 1816 | av_log(h, AV_LOG_WARNING, "inflate return value: %d, %s\n", |
| 1817 | ret, s->inflate_stream.msg); |
| 1818 | |
| 1819 | return size - s->inflate_stream.avail_out; |
| 1820 | } |
| 1821 | #endif /* CONFIG_ZLIB */ |
| 1822 | |
| 1823 | static int64_t http_seek_internal(URLContext *h, int64_t off, int whence, int force_reconnect); |
no test coverage detected