* qatar/master:
fate: fix partial run when no samples path is specified
ARM: NEON fixed-point forward MDCT
ARM: NEON fixed-point FFT
lavf: bump minor version and add an APIChanges entry for avio changes
avio: simplify url_open_dyn_buf_internal by using avio_alloc_context()
avio: make url_fdopen internal.
avio: make url_open_dyn_packet_buf internal.
avio: avio_ prefix for url_close_dyn_buf
avio: avio_ prefix for url_open_dyn_buf
avio: introduce an AVIOContext.seekable field
ac3enc: use generic fixed-point mdct
lavfi: add fade filter
Change yadif to not use out of picture lines.
lavc: deprecate AVCodecContext.antialias_algo
lavc: mark mb_qmin/mb_qmax for removal on next major bump.
Conflicts:
doc/filters.texi
libavcodec/ac3enc_fixed.h
libavcodec/ac3enc_float.h
libavfilter/Makefile
libavfilter/allfilters.c
libavfilter/vf_fade.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
... | ... |
@@ -3314,7 +3314,7 @@ SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD} |
3314 | 3314 |
SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD} |
3315 | 3315 |
SLIB_INSTALL_EXTRA_CMD=${SLIB_INSTALL_EXTRA_CMD} |
3316 | 3316 |
SLIB_UNINSTALL_EXTRA_CMD=${SLIB_UNINSTALL_EXTRA_CMD} |
3317 |
-SAMPLES=${samples:-\$(FATE_SAMPLES)} |
|
3317 |
+SAMPLES:=${samples:-\$(FATE_SAMPLES)} |
|
3318 | 3318 |
EOF |
3319 | 3319 |
|
3320 | 3320 |
get_version(){ |
... | ... |
@@ -12,6 +12,46 @@ libavutil: 2009-03-08 |
12 | 12 |
|
13 | 13 |
API changes, most recent first: |
14 | 14 |
|
15 |
+2011-04-03 - lavf 52.105.0 - avio.h |
|
16 |
+ Large-scale renaming/deprecating of AVIOContext-related functions: |
|
17 |
+ 724f6a0 deprecate url_fdopen |
|
18 |
+ 403ee83 deprecate url_open_dyn_packet_buf |
|
19 |
+ 6dc7d80 rename url_close_dyn_buf -> avio_close_dyn_buf |
|
20 |
+ b92c545 rename url_open_dyn_buf -> avio_open_dyn_buf |
|
21 |
+ 8978fed introduce an AVIOContext.seekable field as a replacement for |
|
22 |
+ AVIOContext.is_streamed and url_is_streamed() |
|
23 |
+ b64030f deprecate get_checksum() |
|
24 |
+ 4c4427a deprecate init_checksum() |
|
25 |
+ 4ec153b deprecate udp_set_remote_url/get_local_port |
|
26 |
+ 933e90a deprecate av_url_read_fseek/fpause |
|
27 |
+ 8d9769a deprecate url_fileno |
|
28 |
+ b7f2fdd rename put_flush_packet -> avio_flush |
|
29 |
+ 35f1023 deprecate url_close_buf |
|
30 |
+ 83fddae deprecate url_open_buf |
|
31 |
+ d9d86e0 rename url_fprintf -> avio_printf |
|
32 |
+ 59f65d9 deprecate url_setbufsize |
|
33 |
+ 3e68b3b deprecate url_ferror |
|
34 |
+ 66e5b1d deprecate url_feof |
|
35 |
+ e8bb2e2 deprecate url_fget_max_packet_size |
|
36 |
+ 76aa876 rename url_fsize -> avio_size |
|
37 |
+ e519753 deprecate url_fgetc |
|
38 |
+ 655e45e deprecate url_fgets |
|
39 |
+ a2704c9 rename url_ftell -> avio_tell |
|
40 |
+ e16ead0 deprecate get_strz() in favor of avio_get_str |
|
41 |
+ 0300db8,2af07d3 rename url_fskip -> avio_skip |
|
42 |
+ 6b4aa5d rename url_fseek -> avio_seek |
|
43 |
+ 61840b4 deprecate put_tag |
|
44 |
+ 22a3212 rename url_fopen/fclose -> avio_open/close. |
|
45 |
+ 0ac8e2b deprecate put_nbyte |
|
46 |
+ 77eb550 rename put_byte -> avio_w8 |
|
47 |
+ put_[b/l]e<type> -> avio_w[b/l]<type> |
|
48 |
+ put_buffer -> avio_write |
|
49 |
+ b7effd4 rename get_byte -> avio_r8, |
|
50 |
+ get_[b/l]e<type> -> avio_r[b/l]<type> |
|
51 |
+ get_buffer -> avio_read |
|
52 |
+ b3db9ce deprecate get_partial_buffer |
|
53 |
+ 8d9ac96 rename av_alloc_put_byte -> avio_alloc_context |
|
54 |
+ |
|
15 | 55 |
2011-03-25 - 34b47d7 - lavc 52.115.0 - AVCodecContext.audio_service_type |
16 | 56 |
Add audio_service_type field to AVCodecContext. |
17 | 57 |
|
... | ... |
@@ -33,6 +33,8 @@ |
33 | 33 |
#include "libavformat/os_support.h" |
34 | 34 |
#include "libavformat/rtpdec.h" |
35 | 35 |
#include "libavformat/rtsp.h" |
36 |
+// XXX for ffio_open_dyn_packet_buffer, to be removed |
|
37 |
+#include "libavformat/avio_internal.h" |
|
36 | 38 |
#include "libavutil/avstring.h" |
37 | 39 |
#include "libavutil/lfg.h" |
38 | 40 |
#include "libavutil/random_seed.h" |
... | ... |
@@ -869,10 +871,10 @@ static void close_connection(HTTPContext *c) |
869 | 869 |
if (!c->last_packet_sent && c->state == HTTPSTATE_SEND_DATA_TRAILER) { |
870 | 870 |
if (ctx->oformat) { |
871 | 871 |
/* prepare header */ |
872 |
- if (url_open_dyn_buf(&ctx->pb) >= 0) { |
|
872 |
+ if (avio_open_dyn_buf(&ctx->pb) >= 0) { |
|
873 | 873 |
av_write_trailer(ctx); |
874 | 874 |
av_freep(&c->pb_buffer); |
875 |
- url_close_dyn_buf(ctx->pb, &c->pb_buffer); |
|
875 |
+ avio_close_dyn_buf(ctx->pb, &c->pb_buffer); |
|
876 | 876 |
} |
877 | 877 |
} |
878 | 878 |
} |
... | ... |
@@ -1873,7 +1875,7 @@ static void compute_status(HTTPContext *c) |
1873 | 1873 |
int i, len; |
1874 | 1874 |
AVIOContext *pb; |
1875 | 1875 |
|
1876 |
- if (url_open_dyn_buf(&pb) < 0) { |
|
1876 |
+ if (avio_open_dyn_buf(&pb) < 0) { |
|
1877 | 1877 |
/* XXX: return an error ? */ |
1878 | 1878 |
c->buffer_ptr = c->buffer; |
1879 | 1879 |
c->buffer_end = c->buffer; |
... | ... |
@@ -2101,7 +2103,7 @@ static void compute_status(HTTPContext *c) |
2101 | 2101 |
avio_printf(pb, "<hr size=1 noshade>Generated at %s", p); |
2102 | 2102 |
avio_printf(pb, "</body>\n</html>\n"); |
2103 | 2103 |
|
2104 |
- len = url_close_dyn_buf(pb, &c->pb_buffer); |
|
2104 |
+ len = avio_close_dyn_buf(pb, &c->pb_buffer); |
|
2105 | 2105 |
c->buffer_ptr = c->pb_buffer; |
2106 | 2106 |
c->buffer_end = c->pb_buffer + len; |
2107 | 2107 |
} |
... | ... |
@@ -2256,11 +2258,11 @@ static int http_prepare_data(HTTPContext *c) |
2256 | 2256 |
c->got_key_frame = 0; |
2257 | 2257 |
|
2258 | 2258 |
/* prepare header and save header data in a stream */ |
2259 |
- if (url_open_dyn_buf(&c->fmt_ctx.pb) < 0) { |
|
2259 |
+ if (avio_open_dyn_buf(&c->fmt_ctx.pb) < 0) { |
|
2260 | 2260 |
/* XXX: potential leak */ |
2261 | 2261 |
return -1; |
2262 | 2262 |
} |
2263 |
- c->fmt_ctx.pb->is_streamed = 1; |
|
2263 |
+ c->fmt_ctx.pb->seekable = 0; |
|
2264 | 2264 |
|
2265 | 2265 |
/* |
2266 | 2266 |
* HACK to avoid mpeg ps muxer to spit many underflow errors |
... | ... |
@@ -2277,7 +2279,7 @@ static int http_prepare_data(HTTPContext *c) |
2277 | 2277 |
} |
2278 | 2278 |
av_metadata_free(&c->fmt_ctx.metadata); |
2279 | 2279 |
|
2280 |
- len = url_close_dyn_buf(c->fmt_ctx.pb, &c->pb_buffer); |
|
2280 |
+ len = avio_close_dyn_buf(c->fmt_ctx.pb, &c->pb_buffer); |
|
2281 | 2281 |
c->buffer_ptr = c->pb_buffer; |
2282 | 2282 |
c->buffer_end = c->pb_buffer + len; |
2283 | 2283 |
|
... | ... |
@@ -2389,9 +2391,9 @@ static int http_prepare_data(HTTPContext *c) |
2389 | 2389 |
max_packet_size = RTSP_TCP_MAX_PACKET_SIZE; |
2390 | 2390 |
else |
2391 | 2391 |
max_packet_size = url_get_max_packet_size(c->rtp_handles[c->packet_stream_index]); |
2392 |
- ret = url_open_dyn_packet_buf(&ctx->pb, max_packet_size); |
|
2392 |
+ ret = ffio_open_dyn_packet_buf(&ctx->pb, max_packet_size); |
|
2393 | 2393 |
} else { |
2394 |
- ret = url_open_dyn_buf(&ctx->pb); |
|
2394 |
+ ret = avio_open_dyn_buf(&ctx->pb); |
|
2395 | 2395 |
} |
2396 | 2396 |
if (ret < 0) { |
2397 | 2397 |
/* XXX: potential leak */ |
... | ... |
@@ -2399,7 +2401,7 @@ static int http_prepare_data(HTTPContext *c) |
2399 | 2399 |
} |
2400 | 2400 |
ost = ctx->streams[pkt.stream_index]; |
2401 | 2401 |
|
2402 |
- ctx->pb->is_streamed = 1; |
|
2402 |
+ ctx->pb->seekable = 0; |
|
2403 | 2403 |
if (pkt.dts != AV_NOPTS_VALUE) |
2404 | 2404 |
pkt.dts = av_rescale_q(pkt.dts, ist->time_base, ost->time_base); |
2405 | 2405 |
if (pkt.pts != AV_NOPTS_VALUE) |
... | ... |
@@ -2410,7 +2412,7 @@ static int http_prepare_data(HTTPContext *c) |
2410 | 2410 |
c->state = HTTPSTATE_SEND_DATA_TRAILER; |
2411 | 2411 |
} |
2412 | 2412 |
|
2413 |
- len = url_close_dyn_buf(ctx->pb, &c->pb_buffer); |
|
2413 |
+ len = avio_close_dyn_buf(ctx->pb, &c->pb_buffer); |
|
2414 | 2414 |
c->cur_frame_bytes = len; |
2415 | 2415 |
c->buffer_ptr = c->pb_buffer; |
2416 | 2416 |
c->buffer_end = c->pb_buffer + len; |
... | ... |
@@ -2432,13 +2434,13 @@ static int http_prepare_data(HTTPContext *c) |
2432 | 2432 |
return -1; |
2433 | 2433 |
ctx = &c->fmt_ctx; |
2434 | 2434 |
/* prepare header */ |
2435 |
- if (url_open_dyn_buf(&ctx->pb) < 0) { |
|
2435 |
+ if (avio_open_dyn_buf(&ctx->pb) < 0) { |
|
2436 | 2436 |
/* XXX: potential leak */ |
2437 | 2437 |
return -1; |
2438 | 2438 |
} |
2439 |
- c->fmt_ctx.pb->is_streamed = 1; |
|
2439 |
+ c->fmt_ctx.pb->seekable = 0; |
|
2440 | 2440 |
av_write_trailer(ctx); |
2441 |
- len = url_close_dyn_buf(ctx->pb, &c->pb_buffer); |
|
2441 |
+ len = avio_close_dyn_buf(ctx->pb, &c->pb_buffer); |
|
2442 | 2442 |
c->buffer_ptr = c->pb_buffer; |
2443 | 2443 |
c->buffer_end = c->pb_buffer + len; |
2444 | 2444 |
|
... | ... |
@@ -2503,7 +2505,7 @@ static int http_send_data(HTTPContext *c) |
2503 | 2503 |
/* if already sending something, then wait. */ |
2504 | 2504 |
if (rtsp_c->state != RTSPSTATE_WAIT_REQUEST) |
2505 | 2505 |
break; |
2506 |
- if (url_open_dyn_buf(&pb) < 0) |
|
2506 |
+ if (avio_open_dyn_buf(&pb) < 0) |
|
2507 | 2507 |
goto fail1; |
2508 | 2508 |
interleaved_index = c->packet_stream_index * 2; |
2509 | 2509 |
/* RTCP packets are sent at odd indexes */ |
... | ... |
@@ -2518,7 +2520,7 @@ static int http_send_data(HTTPContext *c) |
2518 | 2518 |
/* write RTP packet data */ |
2519 | 2519 |
c->buffer_ptr += 4; |
2520 | 2520 |
avio_write(pb, c->buffer_ptr, len); |
2521 |
- size = url_close_dyn_buf(pb, &c->packet_buffer); |
|
2521 |
+ size = avio_close_dyn_buf(pb, &c->packet_buffer); |
|
2522 | 2522 |
/* prepare asynchronous TCP sending */ |
2523 | 2523 |
rtsp_c->packet_buffer_ptr = c->packet_buffer; |
2524 | 2524 |
rtsp_c->packet_buffer_end = c->packet_buffer + size; |
... | ... |
@@ -2723,7 +2725,7 @@ static int http_receive_data(HTTPContext *c) |
2723 | 2723 |
|
2724 | 2724 |
pb = avio_alloc_context(c->buffer, c->buffer_end - c->buffer, |
2725 | 2725 |
0, NULL, NULL, NULL, NULL); |
2726 |
- pb->is_streamed = 1; |
|
2726 |
+ pb->seekable = 0; |
|
2727 | 2727 |
|
2728 | 2728 |
if (av_open_input_stream(&s, pb, c->stream->feed_filename, fmt_in, NULL) < 0) { |
2729 | 2729 |
av_free(pb); |
... | ... |
@@ -2850,7 +2852,7 @@ static int rtsp_parse_request(HTTPContext *c) |
2850 | 2850 |
av_strlcpy(c->url, url, sizeof(c->url)); |
2851 | 2851 |
av_strlcpy(c->protocol, protocol, sizeof(c->protocol)); |
2852 | 2852 |
|
2853 |
- if (url_open_dyn_buf(&c->pb) < 0) { |
|
2853 |
+ if (avio_open_dyn_buf(&c->pb) < 0) { |
|
2854 | 2854 |
/* XXX: cannot do more */ |
2855 | 2855 |
c->pb = NULL; /* safety */ |
2856 | 2856 |
return -1; |
... | ... |
@@ -2907,7 +2909,7 @@ static int rtsp_parse_request(HTTPContext *c) |
2907 | 2907 |
rtsp_reply_error(c, RTSP_STATUS_METHOD); |
2908 | 2908 |
|
2909 | 2909 |
the_end: |
2910 |
- len = url_close_dyn_buf(c->pb, &c->pb_buffer); |
|
2910 |
+ len = avio_close_dyn_buf(c->pb, &c->pb_buffer); |
|
2911 | 2911 |
c->pb = NULL; /* safety */ |
2912 | 2912 |
if (len < 0) { |
2913 | 2913 |
/* XXX: cannot do more */ |
... | ... |
@@ -3444,7 +3446,7 @@ static int rtp_new_av_stream(HTTPContext *c, |
3444 | 3444 |
c->stream->filename, stream_index, c->protocol); |
3445 | 3445 |
|
3446 | 3446 |
/* normally, no packets should be output here, but the packet size may be checked */ |
3447 |
- if (url_open_dyn_packet_buf(&ctx->pb, max_packet_size) < 0) { |
|
3447 |
+ if (ffio_open_dyn_packet_buf(&ctx->pb, max_packet_size) < 0) { |
|
3448 | 3448 |
/* XXX: close stream */ |
3449 | 3449 |
goto fail; |
3450 | 3450 |
} |
... | ... |
@@ -3456,7 +3458,7 @@ static int rtp_new_av_stream(HTTPContext *c, |
3456 | 3456 |
av_free(ctx); |
3457 | 3457 |
return -1; |
3458 | 3458 |
} |
3459 |
- url_close_dyn_buf(ctx->pb, &dummy_buf); |
|
3459 |
+ avio_close_dyn_buf(ctx->pb, &dummy_buf); |
|
3460 | 3460 |
av_free(dummy_buf); |
3461 | 3461 |
|
3462 | 3462 |
c->rtp_ctx[stream_index] = ctx; |
... | ... |
@@ -29,6 +29,8 @@ |
29 | 29 |
//#define DEBUG |
30 | 30 |
//#define ASSERT_LEVEL 2 |
31 | 31 |
|
32 |
+#include <stdint.h> |
|
33 |
+ |
|
32 | 34 |
#include "libavutil/audioconvert.h" |
33 | 35 |
#include "libavutil/avassert.h" |
34 | 36 |
#include "libavutil/crc.h" |
... | ... |
@@ -39,6 +41,7 @@ |
39 | 39 |
#include "ac3dsp.h" |
40 | 40 |
#include "ac3.h" |
41 | 41 |
#include "audioconvert.h" |
42 |
+#include "fft.h" |
|
42 | 43 |
|
43 | 44 |
|
44 | 45 |
#ifndef CONFIG_AC3ENC_FLOAT |
... | ... |
@@ -55,16 +58,22 @@ |
55 | 55 |
#define AC3_REMATRIXING_NONE 1 |
56 | 56 |
#define AC3_REMATRIXING_ALWAYS 3 |
57 | 57 |
|
58 |
-/** Scale a float value by 2^bits and convert to an integer. */ |
|
59 |
-#define SCALE_FLOAT(a, bits) lrintf((a) * (float)(1 << (bits))) |
|
60 |
- |
|
61 |
- |
|
62 | 58 |
#if CONFIG_AC3ENC_FLOAT |
63 |
-#include "ac3enc_float.h" |
|
59 |
+#define MAC_COEF(d,a,b) ((d)+=(a)*(b)) |
|
60 |
+typedef float SampleType; |
|
61 |
+typedef float CoefType; |
|
62 |
+typedef float CoefSumType; |
|
64 | 63 |
#else |
65 |
-#include "ac3enc_fixed.h" |
|
64 |
+#define MAC_COEF(d,a,b) MAC64(d,a,b) |
|
65 |
+typedef int16_t SampleType; |
|
66 |
+typedef int32_t CoefType; |
|
67 |
+typedef int64_t CoefSumType; |
|
66 | 68 |
#endif |
67 | 69 |
|
70 |
+typedef struct AC3MDCTContext { |
|
71 |
+ const SampleType *window; ///< MDCT window function |
|
72 |
+ FFTContext fft; ///< FFT context for MDCT calculation |
|
73 |
+} AC3MDCTContext; |
|
68 | 74 |
|
69 | 75 |
/** |
70 | 76 |
* Encoding Options used by AVOption. |
... | ... |
@@ -279,8 +288,6 @@ static av_cold void mdct_end(AC3MDCTContext *mdct); |
279 | 279 |
static av_cold int mdct_init(AVCodecContext *avctx, AC3MDCTContext *mdct, |
280 | 280 |
int nbits); |
281 | 281 |
|
282 |
-static void mdct512(AC3MDCTContext *mdct, CoefType *out, SampleType *in); |
|
283 |
- |
|
284 | 282 |
static void apply_window(DSPContext *dsp, SampleType *output, const SampleType *input, |
285 | 283 |
const SampleType *window, unsigned int len); |
286 | 284 |
|
... | ... |
@@ -386,7 +393,8 @@ static void apply_mdct(AC3EncodeContext *s) |
386 | 386 |
|
387 | 387 |
block->coeff_shift[ch] = normalize_samples(s); |
388 | 388 |
|
389 |
- mdct512(&s->mdct, block->mdct_coef[ch], s->windowed_samples); |
|
389 |
+ s->mdct.fft.mdct_calcw(&s->mdct.fft, block->mdct_coef[ch], |
|
390 |
+ s->windowed_samples); |
|
390 | 391 |
} |
391 | 392 |
} |
392 | 393 |
} |
... | ... |
@@ -26,54 +26,17 @@ |
26 | 26 |
* fixed-point AC-3 encoder. |
27 | 27 |
*/ |
28 | 28 |
|
29 |
+#define CONFIG_FFT_FLOAT 0 |
|
29 | 30 |
#undef CONFIG_AC3ENC_FLOAT |
30 | 31 |
#include "ac3enc.c" |
31 | 32 |
|
32 | 33 |
|
33 |
-/** Scale a float value by 2^15, convert to an integer, and clip to range -32767..32767. */ |
|
34 |
-#define FIX15(a) av_clip(SCALE_FLOAT(a, 15), -32767, 32767) |
|
35 |
- |
|
36 |
- |
|
37 | 34 |
/** |
38 | 35 |
* Finalize MDCT and free allocated memory. |
39 | 36 |
*/ |
40 | 37 |
static av_cold void mdct_end(AC3MDCTContext *mdct) |
41 | 38 |
{ |
42 |
- mdct->nbits = 0; |
|
43 |
- av_freep(&mdct->costab); |
|
44 |
- av_freep(&mdct->sintab); |
|
45 |
- av_freep(&mdct->xcos1); |
|
46 |
- av_freep(&mdct->xsin1); |
|
47 |
- av_freep(&mdct->rot_tmp); |
|
48 |
- av_freep(&mdct->cplx_tmp); |
|
49 |
-} |
|
50 |
- |
|
51 |
- |
|
52 |
-/** |
|
53 |
- * Initialize FFT tables. |
|
54 |
- * @param ln log2(FFT size) |
|
55 |
- */ |
|
56 |
-static av_cold int fft_init(AVCodecContext *avctx, AC3MDCTContext *mdct, int ln) |
|
57 |
-{ |
|
58 |
- int i, n, n2; |
|
59 |
- float alpha; |
|
60 |
- |
|
61 |
- n = 1 << ln; |
|
62 |
- n2 = n >> 1; |
|
63 |
- |
|
64 |
- FF_ALLOC_OR_GOTO(avctx, mdct->costab, n2 * sizeof(*mdct->costab), fft_alloc_fail); |
|
65 |
- FF_ALLOC_OR_GOTO(avctx, mdct->sintab, n2 * sizeof(*mdct->sintab), fft_alloc_fail); |
|
66 |
- |
|
67 |
- for (i = 0; i < n2; i++) { |
|
68 |
- alpha = 2.0 * M_PI * i / n; |
|
69 |
- mdct->costab[i] = FIX15(cos(alpha)); |
|
70 |
- mdct->sintab[i] = FIX15(sin(alpha)); |
|
71 |
- } |
|
72 |
- |
|
73 |
- return 0; |
|
74 |
-fft_alloc_fail: |
|
75 |
- mdct_end(mdct); |
|
76 |
- return AVERROR(ENOMEM); |
|
39 |
+ ff_fft_end(&mdct->fft); |
|
77 | 40 |
} |
78 | 41 |
|
79 | 42 |
|
... | ... |
@@ -84,167 +47,9 @@ fft_alloc_fail: |
84 | 84 |
static av_cold int mdct_init(AVCodecContext *avctx, AC3MDCTContext *mdct, |
85 | 85 |
int nbits) |
86 | 86 |
{ |
87 |
- int i, n, n4, ret; |
|
88 |
- |
|
89 |
- n = 1 << nbits; |
|
90 |
- n4 = n >> 2; |
|
91 |
- |
|
92 |
- mdct->nbits = nbits; |
|
93 |
- |
|
94 |
- ret = fft_init(avctx, mdct, nbits - 2); |
|
95 |
- if (ret) |
|
96 |
- return ret; |
|
97 |
- |
|
87 |
+ int ret = ff_mdct_init(&mdct->fft, nbits, 0, 1.0); |
|
98 | 88 |
mdct->window = ff_ac3_window; |
99 |
- |
|
100 |
- FF_ALLOC_OR_GOTO(avctx, mdct->xcos1, n4 * sizeof(*mdct->xcos1), mdct_alloc_fail); |
|
101 |
- FF_ALLOC_OR_GOTO(avctx, mdct->xsin1, n4 * sizeof(*mdct->xsin1), mdct_alloc_fail); |
|
102 |
- FF_ALLOC_OR_GOTO(avctx, mdct->rot_tmp, n * sizeof(*mdct->rot_tmp), mdct_alloc_fail); |
|
103 |
- FF_ALLOC_OR_GOTO(avctx, mdct->cplx_tmp, n4 * sizeof(*mdct->cplx_tmp), mdct_alloc_fail); |
|
104 |
- |
|
105 |
- for (i = 0; i < n4; i++) { |
|
106 |
- float alpha = 2.0 * M_PI * (i + 1.0 / 8.0) / n; |
|
107 |
- mdct->xcos1[i] = FIX15(-cos(alpha)); |
|
108 |
- mdct->xsin1[i] = FIX15(-sin(alpha)); |
|
109 |
- } |
|
110 |
- |
|
111 |
- return 0; |
|
112 |
-mdct_alloc_fail: |
|
113 |
- mdct_end(mdct); |
|
114 |
- return AVERROR(ENOMEM); |
|
115 |
-} |
|
116 |
- |
|
117 |
- |
|
118 |
-/** Butterfly op */ |
|
119 |
-#define BF(pre, pim, qre, qim, pre1, pim1, qre1, qim1) \ |
|
120 |
-{ \ |
|
121 |
- int ax, ay, bx, by; \ |
|
122 |
- bx = pre1; \ |
|
123 |
- by = pim1; \ |
|
124 |
- ax = qre1; \ |
|
125 |
- ay = qim1; \ |
|
126 |
- pre = (bx + ax) >> 1; \ |
|
127 |
- pim = (by + ay) >> 1; \ |
|
128 |
- qre = (bx - ax) >> 1; \ |
|
129 |
- qim = (by - ay) >> 1; \ |
|
130 |
-} |
|
131 |
- |
|
132 |
- |
|
133 |
-/** Complex multiply */ |
|
134 |
-#define CMUL(pre, pim, are, aim, bre, bim, rshift) \ |
|
135 |
-{ \ |
|
136 |
- pre = (MUL16(are, bre) - MUL16(aim, bim)) >> rshift; \ |
|
137 |
- pim = (MUL16(are, bim) + MUL16(bre, aim)) >> rshift; \ |
|
138 |
-} |
|
139 |
- |
|
140 |
- |
|
141 |
-/** |
|
142 |
- * Calculate a 2^n point complex FFT on 2^ln points. |
|
143 |
- * @param z complex input/output samples |
|
144 |
- * @param ln log2(FFT size) |
|
145 |
- */ |
|
146 |
-static void fft(AC3MDCTContext *mdct, IComplex *z, int ln) |
|
147 |
-{ |
|
148 |
- int j, l, np, np2; |
|
149 |
- int nblocks, nloops; |
|
150 |
- register IComplex *p,*q; |
|
151 |
- int tmp_re, tmp_im; |
|
152 |
- |
|
153 |
- np = 1 << ln; |
|
154 |
- |
|
155 |
- /* reverse */ |
|
156 |
- for (j = 0; j < np; j++) { |
|
157 |
- int k = av_reverse[j] >> (8 - ln); |
|
158 |
- if (k < j) |
|
159 |
- FFSWAP(IComplex, z[k], z[j]); |
|
160 |
- } |
|
161 |
- |
|
162 |
- /* pass 0 */ |
|
163 |
- |
|
164 |
- p = &z[0]; |
|
165 |
- j = np >> 1; |
|
166 |
- do { |
|
167 |
- BF(p[0].re, p[0].im, p[1].re, p[1].im, |
|
168 |
- p[0].re, p[0].im, p[1].re, p[1].im); |
|
169 |
- p += 2; |
|
170 |
- } while (--j); |
|
171 |
- |
|
172 |
- /* pass 1 */ |
|
173 |
- |
|
174 |
- p = &z[0]; |
|
175 |
- j = np >> 2; |
|
176 |
- do { |
|
177 |
- BF(p[0].re, p[0].im, p[2].re, p[2].im, |
|
178 |
- p[0].re, p[0].im, p[2].re, p[2].im); |
|
179 |
- BF(p[1].re, p[1].im, p[3].re, p[3].im, |
|
180 |
- p[1].re, p[1].im, p[3].im, -p[3].re); |
|
181 |
- p+=4; |
|
182 |
- } while (--j); |
|
183 |
- |
|
184 |
- /* pass 2 .. ln-1 */ |
|
185 |
- |
|
186 |
- nblocks = np >> 3; |
|
187 |
- nloops = 1 << 2; |
|
188 |
- np2 = np >> 1; |
|
189 |
- do { |
|
190 |
- p = z; |
|
191 |
- q = z + nloops; |
|
192 |
- for (j = 0; j < nblocks; j++) { |
|
193 |
- BF(p->re, p->im, q->re, q->im, |
|
194 |
- p->re, p->im, q->re, q->im); |
|
195 |
- p++; |
|
196 |
- q++; |
|
197 |
- for(l = nblocks; l < np2; l += nblocks) { |
|
198 |
- CMUL(tmp_re, tmp_im, mdct->costab[l], -mdct->sintab[l], q->re, q->im, 15); |
|
199 |
- BF(p->re, p->im, q->re, q->im, |
|
200 |
- p->re, p->im, tmp_re, tmp_im); |
|
201 |
- p++; |
|
202 |
- q++; |
|
203 |
- } |
|
204 |
- p += nloops; |
|
205 |
- q += nloops; |
|
206 |
- } |
|
207 |
- nblocks = nblocks >> 1; |
|
208 |
- nloops = nloops << 1; |
|
209 |
- } while (nblocks); |
|
210 |
-} |
|
211 |
- |
|
212 |
- |
|
213 |
-/** |
|
214 |
- * Calculate a 512-point MDCT |
|
215 |
- * @param out 256 output frequency coefficients |
|
216 |
- * @param in 512 windowed input audio samples |
|
217 |
- */ |
|
218 |
-static void mdct512(AC3MDCTContext *mdct, int32_t *out, int16_t *in) |
|
219 |
-{ |
|
220 |
- int i, re, im, n, n2, n4; |
|
221 |
- int16_t *rot = mdct->rot_tmp; |
|
222 |
- IComplex *x = mdct->cplx_tmp; |
|
223 |
- |
|
224 |
- n = 1 << mdct->nbits; |
|
225 |
- n2 = n >> 1; |
|
226 |
- n4 = n >> 2; |
|
227 |
- |
|
228 |
- /* shift to simplify computations */ |
|
229 |
- for (i = 0; i <n4; i++) |
|
230 |
- rot[i] = -in[i + 3*n4]; |
|
231 |
- memcpy(&rot[n4], &in[0], 3*n4*sizeof(*in)); |
|
232 |
- |
|
233 |
- /* pre rotation */ |
|
234 |
- for (i = 0; i < n4; i++) { |
|
235 |
- re = ((int)rot[ 2*i] - (int)rot[ n-1-2*i]) >> 1; |
|
236 |
- im = -((int)rot[n2+2*i] - (int)rot[n2-1-2*i]) >> 1; |
|
237 |
- CMUL(x[i].re, x[i].im, re, im, -mdct->xcos1[i], mdct->xsin1[i], 15); |
|
238 |
- } |
|
239 |
- |
|
240 |
- fft(mdct, x, mdct->nbits - 2); |
|
241 |
- |
|
242 |
- /* post rotation */ |
|
243 |
- for (i = 0; i < n4; i++) { |
|
244 |
- re = x[i].re; |
|
245 |
- im = x[i].im; |
|
246 |
- CMUL(out[n2-1-2*i], out[2*i], re, im, mdct->xsin1[i], mdct->xcos1[i], 0); |
|
247 |
- } |
|
89 |
+ return ret; |
|
248 | 90 |
} |
249 | 91 |
|
250 | 92 |
|
... | ... |
@@ -304,101 +109,6 @@ static void scale_coefficients(AC3EncodeContext *s) |
304 | 304 |
} |
305 | 305 |
|
306 | 306 |
|
307 |
-#ifdef TEST |
|
308 |
-/*************************************************************************/ |
|
309 |
-/* TEST */ |
|
310 |
- |
|
311 |
-#include "libavutil/lfg.h" |
|
312 |
- |
|
313 |
-#define MDCT_NBITS 9 |
|
314 |
-#define MDCT_SAMPLES (1 << MDCT_NBITS) |
|
315 |
-#define FN (MDCT_SAMPLES/4) |
|
316 |
- |
|
317 |
- |
|
318 |
-static void fft_test(AC3MDCTContext *mdct, AVLFG *lfg) |
|
319 |
-{ |
|
320 |
- IComplex in[FN], in1[FN]; |
|
321 |
- int k, n, i; |
|
322 |
- float sum_re, sum_im, a; |
|
323 |
- |
|
324 |
- for (i = 0; i < FN; i++) { |
|
325 |
- in[i].re = av_lfg_get(lfg) % 65535 - 32767; |
|
326 |
- in[i].im = av_lfg_get(lfg) % 65535 - 32767; |
|
327 |
- in1[i] = in[i]; |
|
328 |
- } |
|
329 |
- fft(mdct, in, 7); |
|
330 |
- |
|
331 |
- /* do it by hand */ |
|
332 |
- for (k = 0; k < FN; k++) { |
|
333 |
- sum_re = 0; |
|
334 |
- sum_im = 0; |
|
335 |
- for (n = 0; n < FN; n++) { |
|
336 |
- a = -2 * M_PI * (n * k) / FN; |
|
337 |
- sum_re += in1[n].re * cos(a) - in1[n].im * sin(a); |
|
338 |
- sum_im += in1[n].re * sin(a) + in1[n].im * cos(a); |
|
339 |
- } |
|
340 |
- av_log(NULL, AV_LOG_DEBUG, "%3d: %6d,%6d %6.0f,%6.0f\n", |
|
341 |
- k, in[k].re, in[k].im, sum_re / FN, sum_im / FN); |
|
342 |
- } |
|
343 |
-} |
|
344 |
- |
|
345 |
- |
|
346 |
-static void mdct_test(AC3MDCTContext *mdct, AVLFG *lfg) |
|
347 |
-{ |
|
348 |
- int16_t input[MDCT_SAMPLES]; |
|
349 |
- int32_t output[AC3_MAX_COEFS]; |
|
350 |
- float input1[MDCT_SAMPLES]; |
|
351 |
- float output1[AC3_MAX_COEFS]; |
|
352 |
- float s, a, err, e, emax; |
|
353 |
- int i, k, n; |
|
354 |
- |
|
355 |
- for (i = 0; i < MDCT_SAMPLES; i++) { |
|
356 |
- input[i] = (av_lfg_get(lfg) % 65535 - 32767) * 9 / 10; |
|
357 |
- input1[i] = input[i]; |
|
358 |
- } |
|
359 |
- |
|
360 |
- mdct512(mdct, output, input); |
|
361 |
- |
|
362 |
- /* do it by hand */ |
|
363 |
- for (k = 0; k < AC3_MAX_COEFS; k++) { |
|
364 |
- s = 0; |
|
365 |
- for (n = 0; n < MDCT_SAMPLES; n++) { |
|
366 |
- a = (2*M_PI*(2*n+1+MDCT_SAMPLES/2)*(2*k+1) / (4 * MDCT_SAMPLES)); |
|
367 |
- s += input1[n] * cos(a); |
|
368 |
- } |
|
369 |
- output1[k] = -2 * s / MDCT_SAMPLES; |
|
370 |
- } |
|
371 |
- |
|
372 |
- err = 0; |
|
373 |
- emax = 0; |
|
374 |
- for (i = 0; i < AC3_MAX_COEFS; i++) { |
|
375 |
- av_log(NULL, AV_LOG_DEBUG, "%3d: %7d %7.0f\n", i, output[i], output1[i]); |
|
376 |
- e = output[i] - output1[i]; |
|
377 |
- if (e > emax) |
|
378 |
- emax = e; |
|
379 |
- err += e * e; |
|
380 |
- } |
|
381 |
- av_log(NULL, AV_LOG_DEBUG, "err2=%f emax=%f\n", err / AC3_MAX_COEFS, emax); |
|
382 |
-} |
|
383 |
- |
|
384 |
- |
|
385 |
-int main(void) |
|
386 |
-{ |
|
387 |
- AVLFG lfg; |
|
388 |
- AC3MDCTContext mdct; |
|
389 |
- |
|
390 |
- mdct.avctx = NULL; |
|
391 |
- av_log_set_level(AV_LOG_DEBUG); |
|
392 |
- mdct_init(&mdct, 9); |
|
393 |
- |
|
394 |
- fft_test(&mdct, &lfg); |
|
395 |
- mdct_test(&mdct, &lfg); |
|
396 |
- |
|
397 |
- return 0; |
|
398 |
-} |
|
399 |
-#endif /* TEST */ |
|
400 |
- |
|
401 |
- |
|
402 | 307 |
AVCodec ff_ac3_fixed_encoder = { |
403 | 308 |
"ac3_fixed", |
404 | 309 |
AVMEDIA_TYPE_AUDIO, |
405 | 310 |
deleted file mode 100644 |
... | ... |
@@ -1,61 +0,0 @@ |
1 |
-/* |
|
2 |
- * The simplest AC-3 encoder |
|
3 |
- * Copyright (c) 2000 Fabrice Bellard |
|
4 |
- * Copyright (c) 2006-2010 Justin Ruggles <justin.ruggles@gmail.com> |
|
5 |
- * Copyright (c) 2006-2010 Prakash Punnoor <prakash@punnoor.de> |
|
6 |
- * |
|
7 |
- * This file is part of FFmpeg. |
|
8 |
- * |
|
9 |
- * FFmpeg is free software; you can redistribute it and/or |
|
10 |
- * modify it under the terms of the GNU Lesser General Public |
|
11 |
- * License as published by the Free Software Foundation; either |
|
12 |
- * version 2.1 of the License, or (at your option) any later version. |
|
13 |
- * |
|
14 |
- * FFmpeg is distributed in the hope that it will be useful, |
|
15 |
- * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
16 |
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
17 |
- * Lesser General Public License for more details. |
|
18 |
- * |
|
19 |
- * You should have received a copy of the GNU Lesser General Public |
|
20 |
- * License along with FFmpeg; if not, write to the Free Software |
|
21 |
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
22 |
- */ |
|
23 |
- |
|
24 |
-/** |
|
25 |
- * @file |
|
26 |
- * fixed-point AC-3 encoder header. |
|
27 |
- */ |
|
28 |
- |
|
29 |
-#ifndef AVCODEC_AC3ENC_FIXED_H |
|
30 |
-#define AVCODEC_AC3ENC_FIXED_H |
|
31 |
- |
|
32 |
-#include <stdint.h> |
|
33 |
- |
|
34 |
- |
|
35 |
-typedef int16_t SampleType; |
|
36 |
-typedef int32_t CoefType; |
|
37 |
-typedef int64_t CoefSumType; |
|
38 |
- |
|
39 |
-#define MAC_COEF(d,a,b) MAC64(d,a,b) |
|
40 |
- |
|
41 |
- |
|
42 |
-/** |
|
43 |
- * Compex number. |
|
44 |
- * Used in fixed-point MDCT calculation. |
|
45 |
- */ |
|
46 |
-typedef struct IComplex { |
|
47 |
- int16_t re,im; |
|
48 |
-} IComplex; |
|
49 |
- |
|
50 |
-typedef struct AC3MDCTContext { |
|
51 |
- const int16_t *window; ///< MDCT window function |
|
52 |
- int nbits; ///< log2(transform size) |
|
53 |
- int16_t *costab; ///< FFT cos table |
|
54 |
- int16_t *sintab; ///< FFT sin table |
|
55 |
- int16_t *xcos1; ///< MDCT cos table |
|
56 |
- int16_t *xsin1; ///< MDCT sin table |
|
57 |
- int16_t *rot_tmp; ///< temp buffer for pre-rotated samples |
|
58 |
- IComplex *cplx_tmp; ///< temp buffer for complex pre-rotated samples |
|
59 |
-} AC3MDCTContext; |
|
60 |
- |
|
61 |
-#endif /* AVCODEC_AC3ENC_FIXED_H */ |
... | ... |
@@ -69,17 +69,6 @@ static av_cold int mdct_init(AVCodecContext *avctx, AC3MDCTContext *mdct, |
69 | 69 |
|
70 | 70 |
|
71 | 71 |
/** |
72 |
- * Calculate a 512-point MDCT |
|
73 |
- * @param out 256 output frequency coefficients |
|
74 |
- * @param in 512 windowed input audio samples |
|
75 |
- */ |
|
76 |
-static void mdct512(AC3MDCTContext *mdct, float *out, float *in) |
|
77 |
-{ |
|
78 |
- mdct->fft.mdct_calc(&mdct->fft, out, in); |
|
79 |
-} |
|
80 |
- |
|
81 |
- |
|
82 |
-/** |
|
83 | 72 |
* Apply KBD window to input samples prior to MDCT. |
84 | 73 |
*/ |
85 | 74 |
static void apply_window(DSPContext *dsp, float *output, const float *input, |
86 | 75 |
deleted file mode 100644 |
... | ... |
@@ -1,47 +0,0 @@ |
1 |
-/* |
|
2 |
- * The simplest AC-3 encoder |
|
3 |
- * Copyright (c) 2000 Fabrice Bellard |
|
4 |
- * Copyright (c) 2006-2010 Justin Ruggles <justin.ruggles@gmail.com> |
|
5 |
- * Copyright (c) 2006-2010 Prakash Punnoor <prakash@punnoor.de> |
|
6 |
- * |
|
7 |
- * This file is part of FFmpeg. |
|
8 |
- * |
|
9 |
- * FFmpeg is free software; you can redistribute it and/or |
|
10 |
- * modify it under the terms of the GNU Lesser General Public |
|
11 |
- * License as published by the Free Software Foundation; either |
|
12 |
- * version 2.1 of the License, or (at your option) any later version. |
|
13 |
- * |
|
14 |
- * FFmpeg is distributed in the hope that it will be useful, |
|
15 |
- * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
16 |
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
17 |
- * Lesser General Public License for more details. |
|
18 |
- * |
|
19 |
- * You should have received a copy of the GNU Lesser General Public |
|
20 |
- * License along with FFmpeg; if not, write to the Free Software |
|
21 |
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
22 |
- */ |
|
23 |
- |
|
24 |
-/** |
|
25 |
- * @file |
|
26 |
- * floating-point AC-3 encoder header. |
|
27 |
- */ |
|
28 |
- |
|
29 |
-#ifndef AVCODEC_AC3ENC_FLOAT_H |
|
30 |
-#define AVCODEC_AC3ENC_FLOAT_H |
|
31 |
- |
|
32 |
-#include "fft.h" |
|
33 |
- |
|
34 |
- |
|
35 |
-typedef float SampleType; |
|
36 |
-typedef float CoefType; |
|
37 |
-typedef float CoefSumType; |
|
38 |
- |
|
39 |
-#define MAC_COEF(d,a,b) ((d)+=(a)*(b)) |
|
40 |
- |
|
41 |
- |
|
42 |
-typedef struct AC3MDCTContext { |
|
43 |
- const float *window; ///< MDCT window function |
|
44 |
- FFTContext fft; ///< FFT context for MDCT calculation |
|
45 |
-} AC3MDCTContext; |
|
46 |
- |
|
47 |
-#endif /* AVCODEC_AC3ENC_FLOAT_H */ |
... | ... |
@@ -16,6 +16,7 @@ OBJS-$(CONFIG_H264PRED) += arm/h264pred_init_arm.o |
16 | 16 |
OBJS += arm/dsputil_init_arm.o \ |
17 | 17 |
arm/dsputil_arm.o \ |
18 | 18 |
arm/fft_init_arm.o \ |
19 |
+ arm/fft_fixed_init_arm.o \ |
|
19 | 20 |
arm/fmtconvert_init_arm.o \ |
20 | 21 |
arm/jrevdct_arm.o \ |
21 | 22 |
arm/mpegvideo_arm.o \ |
... | ... |
@@ -41,8 +42,10 @@ OBJS-$(HAVE_IWMMXT) += arm/dsputil_iwmmxt.o \ |
41 | 41 |
arm/mpegvideo_iwmmxt.o \ |
42 | 42 |
|
43 | 43 |
NEON-OBJS-$(CONFIG_FFT) += arm/fft_neon.o \ |
44 |
+ arm/fft_fixed_neon.o \ |
|
44 | 45 |
|
45 | 46 |
NEON-OBJS-$(CONFIG_MDCT) += arm/mdct_neon.o \ |
47 |
+ arm/mdct_fixed_neon.o \ |
|
46 | 48 |
|
47 | 49 |
NEON-OBJS-$(CONFIG_RDFT) += arm/rdft_neon.o \ |
48 | 50 |
|
49 | 51 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,42 @@ |
0 |
+/* |
|
1 |
+ * Copyright (c) 2009 Mans Rullgard <mans@mansr.com> |
|
2 |
+ * |
|
3 |
+ * This file is part of FFmpeg. |
|
4 |
+ * |
|
5 |
+ * FFMpeg is free software; you can redistribute it and/or |
|
6 |
+ * modify it under the terms of the GNU Lesser General Public |
|
7 |
+ * License as published by the Free Software Foundation; either |
|
8 |
+ * version 2.1 of the License, or (at your option) any later version. |
|
9 |
+ * |
|
10 |
+ * FFmpeg is distributed in the hope that it will be useful, |
|
11 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 |
+ * Lesser General Public License for more details. |
|
14 |
+ * |
|
15 |
+ * You should have received a copy of the GNU Lesser General Public |
|
16 |
+ * License along with FFmpeg; if not, write to the Free Software |
|
17 |
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
18 |
+ */ |
|
19 |
+ |
|
20 |
+#define CONFIG_FFT_FLOAT 0 |
|
21 |
+#include "libavcodec/fft.h" |
|
22 |
+ |
|
23 |
+void ff_fft_fixed_calc_neon(FFTContext *s, FFTComplex *z); |
|
24 |
+void ff_mdct_fixed_calc_neon(FFTContext *s, FFTSample *o, const FFTSample *i); |
|
25 |
+void ff_mdct_fixed_calcw_neon(FFTContext *s, FFTDouble *o, const FFTSample *i); |
|
26 |
+ |
|
27 |
+av_cold void ff_fft_fixed_init_arm(FFTContext *s) |
|
28 |
+{ |
|
29 |
+ if (HAVE_NEON) { |
|
30 |
+ s->fft_permutation = FF_FFT_PERM_SWAP_LSBS; |
|
31 |
+ s->fft_calc = ff_fft_fixed_calc_neon; |
|
32 |
+ |
|
33 |
+#if CONFIG_MDCT |
|
34 |
+ if (!s->inverse && s->mdct_bits >= 5) { |
|
35 |
+ s->mdct_permutation = FF_MDCT_PERM_INTERLEAVE; |
|
36 |
+ s->mdct_calc = ff_mdct_fixed_calc_neon; |
|
37 |
+ s->mdct_calcw = ff_mdct_fixed_calcw_neon; |
|
38 |
+ } |
|
39 |
+#endif |
|
40 |
+ } |
|
41 |
+} |
0 | 42 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,261 @@ |
0 |
+/* |
|
1 |
+ * Copyright (c) 2011 Mans Rullgard <mans@mansr.com> |
|
2 |
+ * |
|
3 |
+ * This file is part of Libav. |
|
4 |
+ * |
|
5 |
+ * Libav is free software; you can redistribute it and/or |
|
6 |
+ * modify it under the terms of the GNU Lesser General Public |
|
7 |
+ * License as published by the Free Software Foundation; either |
|
8 |
+ * version 2.1 of the License, or (at your option) any later version. |
|
9 |
+ * |
|
10 |
+ * Libav is distributed in the hope that it will be useful, |
|
11 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 |
+ * Lesser General Public License for more details. |
|
14 |
+ * |
|
15 |
+ * You should have received a copy of the GNU Lesser General Public |
|
16 |
+ * License along with Libav; if not, write to the Free Software |
|
17 |
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
18 |
+ */ |
|
19 |
+ |
|
20 |
+#include "asm.S" |
|
21 |
+ |
|
22 |
+.macro bflies d0, d1, r0, r1 |
|
23 |
+ vrev64.32 \r0, \d1 @ t5, t6, t1, t2 |
|
24 |
+ vhsub.s16 \r1, \d1, \r0 @ t1-t5, t2-t6, t5-t1, t6-t2 |
|
25 |
+ vhadd.s16 \r0, \d1, \r0 @ t1+t5, t2+t6, t5+t1, t6+t2 |
|
26 |
+ vext.16 \r1, \r1, \r1, #1 @ t2-t6, t5-t1, t6-t2, t1-t5 |
|
27 |
+ vtrn.32 \r0, \r1 @ t1+t5, t2+t6, t2-t6, t5-t1 |
|
28 |
+ @ t5, t6, t4, t3 |
|
29 |
+ vhsub.s16 \d1, \d0, \r0 |
|
30 |
+ vhadd.s16 \d0, \d0, \r0 |
|
31 |
+.endm |
|
32 |
+ |
|
33 |
+.macro transform01 q0, q1, d3, c0, c1, r0, w0, w1 |
|
34 |
+ vrev32.16 \r0, \d3 |
|
35 |
+ vmull.s16 \w0, \d3, \c0 |
|
36 |
+ vmlal.s16 \w0, \r0, \c1 |
|
37 |
+ vshrn.s32 \d3, \w0, #15 |
|
38 |
+ bflies \q0, \q1, \w0, \w1 |
|
39 |
+.endm |
|
40 |
+ |
|
41 |
+.macro transform2 d0, d1, d2, d3, q0, q1, c0, c1, c2, c3, \ |
|
42 |
+ r0, r1, w0, w1 |
|
43 |
+ vrev32.16 \r0, \d1 |
|
44 |
+ vrev32.16 \r1, \d3 |
|
45 |
+ vmull.s16 \w0, \d1, \c0 |
|
46 |
+ vmlal.s16 \w0, \r0, \c1 |
|
47 |
+ vmull.s16 \w1, \d3, \c2 |
|
48 |
+ vmlal.s16 \w1, \r1, \c3 |
|
49 |
+ vshrn.s32 \d1, \w0, #15 |
|
50 |
+ vshrn.s32 \d3, \w1, #15 |
|
51 |
+ bflies \q0, \q1, \w0, \w1 |
|
52 |
+.endm |
|
53 |
+ |
|
54 |
+.macro fft4 d0, d1, r0, r1 |
|
55 |
+ vhsub.s16 \r0, \d0, \d1 @ t3, t4, t8, t7 |
|
56 |
+ vhsub.s16 \r1, \d1, \d0 |
|
57 |
+ vhadd.s16 \d0, \d0, \d1 @ t1, t2, t6, t5 |
|
58 |
+ vmov.i64 \d1, #0xffff<<32 |
|
59 |
+ vbit \r0, \r1, \d1 |
|
60 |
+ vrev64.16 \r1, \r0 @ t7, t8, t4, t3 |
|
61 |
+ vtrn.32 \r0, \r1 @ t3, t4, t7, t8 |
|
62 |
+ vtrn.32 \d0, \r0 @ t1, t2, t3, t4, t6, t5, t8, t7 |
|
63 |
+ vhsub.s16 \d1, \d0, \r0 @ r2, i2, r3, i1 |
|
64 |
+ vhadd.s16 \d0, \d0, \r0 @ r0, i0, r1, i3 |
|
65 |
+.endm |
|
66 |
+ |
|
67 |
+.macro fft8 d0, d1, d2, d3, q0, q1, c0, c1, r0, r1, w0, w1 |
|
68 |
+ fft4 \d0, \d1, \r0, \r1 |
|
69 |
+ vtrn.32 \d0, \d1 @ z0, z2, z1, z3 |
|
70 |
+ vhadd.s16 \r0, \d2, \d3 @ t1, t2, t3, t4 |
|
71 |
+ vhsub.s16 \d3, \d2, \d3 @ z5, z7 |
|
72 |
+ vmov \d2, \r0 |
|
73 |
+ transform01 \q0, \q1, \d3, \c0, \c1, \r0, \w0, \w1 |
|
74 |
+.endm |
|
75 |
+ |
|
76 |
+function fft4_neon |
|
77 |
+ vld1.16 {d0-d1}, [r0,:128] |
|
78 |
+ fft4 d0, d1, d2, d3 |
|
79 |
+ vst1.16 {d0-d1}, [r0,:128] |
|
80 |
+ bx lr |
|
81 |
+endfunc |
|
82 |
+ |
|
83 |
+function fft8_neon |
|
84 |
+ vld1.16 {d0-d3}, [r0,:128] |
|
85 |
+ movrel r1, coefs |
|
86 |
+ vld1.16 {d30}, [r1,:64] |
|
87 |
+ vdup.16 d31, d30[0] |
|
88 |
+ fft8 d0, d1, d2, d3, q0, q1, d31, d30, d20, d21, q8, q9 |
|
89 |
+ vtrn.32 d0, d1 |
|
90 |
+ vtrn.32 d2, d3 |
|
91 |
+ vst1.16 {d0-d3}, [r0,:128] |
|
92 |
+ bx lr |
|
93 |
+endfunc |
|
94 |
+ |
|
95 |
+function fft16_neon |
|
96 |
+ vld1.16 {d0-d3}, [r0,:128]! |
|
97 |
+ vld1.16 {d4-d7}, [r0,:128] |
|
98 |
+ movrel r1, coefs |
|
99 |
+ sub r0, r0, #32 |
|
100 |
+ vld1.16 {d28-d31},[r1,:128] |
|
101 |
+ vdup.16 d31, d28[0] |
|
102 |
+ fft8 d0, d1, d2, d3, q0, q1, d31, d28, d20, d21, q8, q9 |
|
103 |
+ vswp d5, d6 |
|
104 |
+ fft4 q2, q3, q8, q9 |
|
105 |
+ vswp d5, d6 |
|
106 |
+ vtrn.32 q0, q1 @ z0, z4, z2, z6, z1, z5, z3, z7 |
|
107 |
+ vtrn.32 q2, q3 @ z8, z12,z10,z14,z9, z13,z11,z15 |
|
108 |
+ vswp d1, d2 |
|
109 |
+ vdup.16 d31, d28[0] |
|
110 |
+ transform01 q0, q2, d5, d31, d28, d20, q8, q9 |
|
111 |
+ vdup.16 d26, d29[0] |
|
112 |
+ vdup.16 d27, d30[0] |
|
113 |
+ transform2 d2, d6, d3, d7, q1, q3, d26, d30, d27, d29, \ |
|
114 |
+ d20, d21, q8, q9 |
|
115 |
+ vtrn.32 q0, q1 |
|
116 |
+ vtrn.32 q2, q3 |
|
117 |
+ vst1.16 {d0-d3}, [r0,:128]! |
|
118 |
+ vst1.16 {d4-d7}, [r0,:128] |
|
119 |
+ bx lr |
|
120 |
+endfunc |
|
121 |
+ |
|
122 |
+function fft_pass_neon |
|
123 |
+ push {r4,lr} |
|
124 |
+ movrel lr, coefs + 24 |
|
125 |
+ vld1.16 {d30}, [lr,:64] |
|
126 |
+ lsl r12, r2, #3 |
|
127 |
+ vmov d31, d30 |
|
128 |
+ add r3, r1, r2, lsl #2 |
|
129 |
+ mov lr, #-8 |
|
130 |
+ sub r3, r3, #2 |
|
131 |
+ mov r4, r0 |
|
132 |
+ vld1.16 {d27[]}, [r3,:16] |
|
133 |
+ sub r3, r3, #6 |
|
134 |
+ vld1.16 {q0}, [r4,:128], r12 |
|
135 |
+ vld1.16 {q1}, [r4,:128], r12 |
|
136 |
+ vld1.16 {q2}, [r4,:128], r12 |
|
137 |
+ vld1.16 {q3}, [r4,:128], r12 |
|
138 |
+ vld1.16 {d28}, [r1,:64]! |
|
139 |
+ vld1.16 {d29}, [r3,:64], lr |
|
140 |
+ vswp d1, d2 |
|
141 |
+ vswp d5, d6 |
|
142 |
+ vtrn.32 d0, d1 |
|
143 |
+ vtrn.32 d4, d5 |
|
144 |
+ vdup.16 d25, d28[1] |
|
145 |
+ vmul.s16 d27, d27, d31 |
|
146 |
+ transform01 q0, q2, d5, d25, d27, d20, q8, q9 |
|
147 |
+ b 2f |
|
148 |
+1: |
|
149 |
+ mov r4, r0 |
|
150 |
+ vdup.16 d26, d29[0] |
|
151 |
+ vld1.16 {q0}, [r4,:128], r12 |
|
152 |
+ vld1.16 {q1}, [r4,:128], r12 |
|
153 |
+ vld1.16 {q2}, [r4,:128], r12 |
|
154 |
+ vld1.16 {q3}, [r4,:128], r12 |
|
155 |
+ vld1.16 {d28}, [r1,:64]! |
|
156 |
+ vld1.16 {d29}, [r3,:64], lr |
|
157 |
+ vswp d1, d2 |
|
158 |
+ vswp d5, d6 |
|
159 |
+ vtrn.32 d0, d1 |
|
160 |
+ vtrn.32 d4, d5 |
|
161 |
+ vdup.16 d24, d28[0] |
|
162 |
+ vdup.16 d25, d28[1] |
|
163 |
+ vdup.16 d27, d29[3] |
|
164 |
+ vmul.s16 q13, q13, q15 |
|
165 |
+ transform2 d0, d4, d1, d5, q0, q2, d24, d26, d25, d27, \ |
|
166 |
+ d16, d17, q9, q10 |
|
167 |
+2: |
|
168 |
+ vtrn.32 d2, d3 |
|
169 |
+ vtrn.32 d6, d7 |
|
170 |
+ vdup.16 d24, d28[2] |
|
171 |
+ vdup.16 d26, d29[2] |
|
172 |
+ vdup.16 d25, d28[3] |
|
173 |
+ vdup.16 d27, d29[1] |
|
174 |
+ vmul.s16 q13, q13, q15 |
|
175 |
+ transform2 d2, d6, d3, d7, q1, q3, d24, d26, d25, d27, \ |
|
176 |
+ d16, d17, q9, q10 |
|
177 |
+ vtrn.32 d0, d1 |
|
178 |
+ vtrn.32 d2, d3 |
|
179 |
+ vtrn.32 d4, d5 |
|
180 |
+ vtrn.32 d6, d7 |
|
181 |
+ vswp d1, d2 |
|
182 |
+ vswp d5, d6 |
|
183 |
+ mov r4, r0 |
|
184 |
+ vst1.16 {q0}, [r4,:128], r12 |
|
185 |
+ vst1.16 {q1}, [r4,:128], r12 |
|
186 |
+ vst1.16 {q2}, [r4,:128], r12 |
|
187 |
+ vst1.16 {q3}, [r4,:128], r12 |
|
188 |
+ add r0, r0, #16 |
|
189 |
+ subs r2, r2, #2 |
|
190 |
+ bgt 1b |
|
191 |
+ pop {r4,pc} |
|
192 |
+endfunc |
|
193 |
+ |
|
194 |
+#define F_SQRT1_2 23170 |
|
195 |
+#define F_COS_16_1 30274 |
|
196 |
+#define F_COS_16_3 12540 |
|
197 |
+ |
|
198 |
+const coefs, align=4 |
|
199 |
+ .short F_SQRT1_2, -F_SQRT1_2, -F_SQRT1_2, F_SQRT1_2 |
|
200 |
+ .short F_COS_16_1,-F_COS_16_1,-F_COS_16_1, F_COS_16_1 |
|
201 |
+ .short F_COS_16_3,-F_COS_16_3,-F_COS_16_3, F_COS_16_3 |
|
202 |
+ .short 1, -1, -1, 1 |
|
203 |
+endconst |
|
204 |
+ |
|
205 |
+.macro def_fft n, n2, n4 |
|
206 |
+function fft\n\()_neon |
|
207 |
+ push {r4, lr} |
|
208 |
+ mov r4, r0 |
|
209 |
+ bl fft\n2\()_neon |
|
210 |
+ add r0, r4, #\n4*2*4 |
|
211 |
+ bl fft\n4\()_neon |
|
212 |
+ add r0, r4, #\n4*3*4 |
|
213 |
+ bl fft\n4\()_neon |
|
214 |
+ mov r0, r4 |
|
215 |
+ pop {r4, lr} |
|
216 |
+ movrel r1, X(ff_cos_\n\()_fixed) |
|
217 |
+ mov r2, #\n4/2 |
|
218 |
+ b fft_pass_neon |
|
219 |
+endfunc |
|
220 |
+.endm |
|
221 |
+ |
|
222 |
+ def_fft 32, 16, 8 |
|
223 |
+ def_fft 64, 32, 16 |
|
224 |
+ def_fft 128, 64, 32 |
|
225 |
+ def_fft 256, 128, 64 |
|
226 |
+ def_fft 512, 256, 128 |
|
227 |
+ def_fft 1024, 512, 256 |
|
228 |
+ def_fft 2048, 1024, 512 |
|
229 |
+ def_fft 4096, 2048, 1024 |
|
230 |
+ def_fft 8192, 4096, 2048 |
|
231 |
+ def_fft 16384, 8192, 4096 |
|
232 |
+ def_fft 32768, 16384, 8192 |
|
233 |
+ def_fft 65536, 32768, 16384 |
|
234 |
+ |
|
235 |
+function ff_fft_fixed_calc_neon, export=1 |
|
236 |
+ ldr r2, [r0] |
|
237 |
+ sub r2, r2, #2 |
|
238 |
+ movrel r3, fft_fixed_tab_neon |
|
239 |
+ ldr r3, [r3, r2, lsl #2] |
|
240 |
+ mov r0, r1 |
|
241 |
+ bx r3 |
|
242 |
+endfunc |
|
243 |
+ |
|
244 |
+const fft_fixed_tab_neon |
|
245 |
+ .word fft4_neon |
|
246 |
+ .word fft8_neon |
|
247 |
+ .word fft16_neon |
|
248 |
+ .word fft32_neon |
|
249 |
+ .word fft64_neon |
|
250 |
+ .word fft128_neon |
|
251 |
+ .word fft256_neon |
|
252 |
+ .word fft512_neon |
|
253 |
+ .word fft1024_neon |
|
254 |
+ .word fft2048_neon |
|
255 |
+ .word fft4096_neon |
|
256 |
+ .word fft8192_neon |
|
257 |
+ .word fft16384_neon |
|
258 |
+ .word fft32768_neon |
|
259 |
+ .word fft65536_neon |
|
260 |
+endconst |
0 | 261 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,195 @@ |
0 |
+/* |
|
1 |
+ * Copyright (c) 2011 Mans Rullgard <mans@mansr.com> |
|
2 |
+ * |
|
3 |
+ * This file is part of Libav. |
|
4 |
+ * |
|
5 |
+ * Libav is free software; you can redistribute it and/or |
|
6 |
+ * modify it under the terms of the GNU Lesser General Public |
|
7 |
+ * License as published by the Free Software Foundation; either |
|
8 |
+ * version 2.1 of the License, or (at your option) any later version. |
|
9 |
+ * |
|
10 |
+ * Libav is distributed in the hope that it will be useful, |
|
11 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 |
+ * Lesser General Public License for more details. |
|
14 |
+ * |
|
15 |
+ * You should have received a copy of the GNU Lesser General Public |
|
16 |
+ * License along with Libav; if not, write to the Free Software |
|
17 |
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
18 |
+ */ |
|
19 |
+ |
|
20 |
+#include "asm.S" |
|
21 |
+ |
|
22 |
+ preserve8 |
|
23 |
+ |
|
24 |
+.macro prerot dst, rt |
|
25 |
+ lsr r3, r6, #2 @ n4 |
|
26 |
+ add \rt, r4, r6, lsr #1 @ revtab + n4 |
|
27 |
+ add r9, r3, r3, lsl #1 @ n3 |
|
28 |
+ add r8, r7, r6 @ tcos + n4 |
|
29 |
+ add r3, r2, r6, lsr #1 @ in + n4 |
|
30 |
+ add r9, r2, r9, lsl #1 @ in + n3 |
|
31 |
+ sub r8, r8, #16 |
|
32 |
+ sub r10, r3, #16 |
|
33 |
+ sub r11, r9, #16 |
|
34 |
+ mov r12, #-16 |
|
35 |
+1: |
|
36 |
+ vld2.16 {d0,d1}, [r9, :128]! |
|
37 |
+ vld2.16 {d2,d3}, [r11,:128], r12 |
|
38 |
+ vld2.16 {d4,d5}, [r3, :128]! |
|
39 |
+ vld2.16 {d6,d7}, [r10,:128], r12 |
|
40 |
+ vld2.16 {d16,d17},[r7, :128]! @ cos, sin |
|
41 |
+ vld2.16 {d18,d19},[r8, :128], r12 |
|
42 |
+ vrev64.16 q1, q1 |
|
43 |
+ vrev64.16 q3, q3 |
|
44 |
+ vrev64.16 q9, q9 |
|
45 |
+ vneg.s16 d0, d0 |
|
46 |
+ vneg.s16 d2, d2 |
|
47 |
+ vneg.s16 d16, d16 |
|
48 |
+ vneg.s16 d18, d18 |
|
49 |
+ vhsub.s16 d0, d0, d3 @ re |
|
50 |
+ vhsub.s16 d4, d7, d4 @ im |
|
51 |
+ vhsub.s16 d6, d6, d5 |
|
52 |
+ vhsub.s16 d2, d2, d1 |
|
53 |
+ vmull.s16 q10, d0, d16 |
|
54 |
+ vmlsl.s16 q10, d4, d17 |
|
55 |
+ vmull.s16 q11, d0, d17 |
|
56 |
+ vmlal.s16 q11, d4, d16 |
|
57 |
+ vmull.s16 q12, d6, d18 |
|
58 |
+ vmlsl.s16 q12, d2, d19 |
|
59 |
+ vmull.s16 q13, d6, d19 |
|
60 |
+ vmlal.s16 q13, d2, d18 |
|
61 |
+ vshrn.s32 d0, q10, #15 |
|
62 |
+ vshrn.s32 d1, q11, #15 |
|
63 |
+ vshrn.s32 d2, q12, #15 |
|
64 |
+ vshrn.s32 d3, q13, #15 |
|
65 |
+ vzip.16 d0, d1 |
|
66 |
+ vzip.16 d2, d3 |
|
67 |
+ ldrh lr, [r4], #2 |
|
68 |
+ ldrh r2, [\rt, #-2]! |
|
69 |
+ add lr, \dst, lr, lsl #2 |
|
70 |
+ add r2, \dst, r2, lsl #2 |
|
71 |
+ vst1.32 {d0[0]}, [lr,:32] |
|
72 |
+ vst1.32 {d2[0]}, [r2,:32] |
|
73 |
+ ldrh lr, [r4], #2 |
|
74 |
+ ldrh r2, [\rt, #-2]! |
|
75 |
+ add lr, \dst, lr, lsl #2 |
|
76 |
+ add r2, \dst, r2, lsl #2 |
|
77 |
+ vst1.32 {d0[1]}, [lr,:32] |
|
78 |
+ vst1.32 {d2[1]}, [r2,:32] |
|
79 |
+ ldrh lr, [r4], #2 |
|
80 |
+ ldrh r2, [\rt, #-2]! |
|
81 |
+ add lr, \dst, lr, lsl #2 |
|
82 |
+ add r2, \dst, r2, lsl #2 |
|
83 |
+ vst1.32 {d1[0]}, [lr,:32] |
|
84 |
+ vst1.32 {d3[0]}, [r2,:32] |
|
85 |
+ ldrh lr, [r4], #2 |
|
86 |
+ ldrh r2, [\rt, #-2]! |
|
87 |
+ add lr, \dst, lr, lsl #2 |
|
88 |
+ add r2, \dst, r2, lsl #2 |
|
89 |
+ vst1.32 {d1[1]}, [lr,:32] |
|
90 |
+ vst1.32 {d3[1]}, [r2,:32] |
|
91 |
+ subs r6, r6, #32 |
|
92 |
+ bgt 1b |
|
93 |
+.endm |
|
94 |
+ |
|
95 |
+function ff_mdct_fixed_calc_neon, export=1 |
|
96 |
+ push {r1,r4-r11,lr} |
|
97 |
+ |
|
98 |
+ ldr r4, [r0, #8] @ revtab |
|
99 |
+ ldr r6, [r0, #16] @ mdct_size; n |
|
100 |
+ ldr r7, [r0, #24] @ tcos |
|
101 |
+ |
|
102 |
+ prerot r1, r5 |
|
103 |
+ |
|
104 |
+ mov r4, r0 |
|
105 |
+ bl X(ff_fft_fixed_calc_neon) |
|
106 |
+ |
|
107 |
+ pop {r5} |
|
108 |
+ mov r12, #-16 |
|
109 |
+ ldr r6, [r4, #16] @ mdct_size; n |
|
110 |
+ ldr r7, [r4, #24] @ tcos |
|
111 |
+ add r5, r5, r6, lsr #1 |
|
112 |
+ add r7, r7, r6, lsr #1 |
|
113 |
+ sub r1, r5, #16 |
|
114 |
+ sub r2, r7, #16 |
|
115 |
+1: |
|
116 |
+ vld2.16 {d4,d5}, [r7,:128]! |
|
117 |
+ vld2.16 {d6,d7}, [r2,:128], r12 |
|
118 |
+ vld2.16 {d0,d1}, [r5,:128] |
|
119 |
+ vld2.16 {d2,d3}, [r1,:128] |
|
120 |
+ vrev64.16 q3, q3 |
|
121 |
+ vrev64.16 q1, q1 |
|
122 |
+ vneg.s16 q3, q3 |
|
123 |
+ vneg.s16 q2, q2 |
|
124 |
+ vmull.s16 q11, d2, d6 |
|
125 |
+ vmlal.s16 q11, d3, d7 |
|
126 |
+ vmull.s16 q8, d0, d5 |
|
127 |
+ vmlsl.s16 q8, d1, d4 |
|
128 |
+ vmull.s16 q9, d0, d4 |
|
129 |
+ vmlal.s16 q9, d1, d5 |
|
130 |
+ vmull.s16 q10, d2, d7 |
|
131 |
+ vmlsl.s16 q10, d3, d6 |
|
132 |
+ vshrn.s32 d0, q11, #15 |
|
133 |
+ vshrn.s32 d1, q8, #15 |
|
134 |
+ vshrn.s32 d2, q9, #15 |
|
135 |
+ vshrn.s32 d3, q10, #15 |
|
136 |
+ vrev64.16 q0, q0 |
|
137 |
+ vst2.16 {d2,d3}, [r5,:128]! |
|
138 |
+ vst2.16 {d0,d1}, [r1,:128], r12 |
|
139 |
+ subs r6, r6, #32 |
|
140 |
+ bgt 1b |
|
141 |
+ |
|
142 |
+ pop {r4-r11,pc} |
|
143 |
+endfunc |
|
144 |
+ |
|
145 |
+function ff_mdct_fixed_calcw_neon, export=1 |
|
146 |
+ push {r1,r4-r11,lr} |
|
147 |
+ |
|
148 |
+ ldrd r4, r5, [r0, #8] @ revtab, tmp_buf |
|
149 |
+ ldr r6, [r0, #16] @ mdct_size; n |
|
150 |
+ ldr r7, [r0, #24] @ tcos |
|
151 |
+ |
|
152 |
+ prerot r5, r1 |
|
153 |
+ |
|
154 |
+ mov r4, r0 |
|
155 |
+ mov r1, r5 |
|
156 |
+ bl X(ff_fft_fixed_calc_neon) |
|
157 |
+ |
|
158 |
+ pop {r7} |
|
159 |
+ mov r12, #-16 |
|
160 |
+ ldr r6, [r4, #16] @ mdct_size; n |
|
161 |
+ ldr r9, [r4, #24] @ tcos |
|
162 |
+ add r5, r5, r6, lsr #1 |
|
163 |
+ add r7, r7, r6 |
|
164 |
+ add r9, r9, r6, lsr #1 |
|
165 |
+ sub r3, r5, #16 |
|
166 |
+ sub r1, r7, #16 |
|
167 |
+ sub r2, r9, #16 |
|
168 |
+1: |
|
169 |
+ vld2.16 {d4,d5}, [r9,:128]! |
|
170 |
+ vld2.16 {d6,d7}, [r2,:128], r12 |
|
171 |
+ vld2.16 {d0,d1}, [r5,:128]! |
|
172 |
+ vld2.16 {d2,d3}, [r3,:128], r12 |
|
173 |
+ vrev64.16 q3, q3 |
|
174 |
+ vrev64.16 q1, q1 |
|
175 |
+ vneg.s16 q3, q3 |
|
176 |
+ vneg.s16 q2, q2 |
|
177 |
+ vmull.s16 q8, d2, d6 |
|
178 |
+ vmlal.s16 q8, d3, d7 |
|
179 |
+ vmull.s16 q9, d0, d5 |
|
180 |
+ vmlsl.s16 q9, d1, d4 |
|
181 |
+ vmull.s16 q10, d0, d4 |
|
182 |
+ vmlal.s16 q10, d1, d5 |
|
183 |
+ vmull.s16 q11, d2, d7 |
|
184 |
+ vmlsl.s16 q11, d3, d6 |
|
185 |
+ vrev64.32 q8, q8 |
|
186 |
+ vrev64.32 q9, q9 |
|
187 |
+ vst2.32 {q10,q11},[r7,:128]! |
|
188 |
+ vst2.32 {d16,d18},[r1,:128], r12 |
|
189 |
+ vst2.32 {d17,d19},[r1,:128], r12 |
|
190 |
+ subs r6, r6, #32 |
|
191 |
+ bgt 1b |
|
192 |
+ |
|
193 |
+ pop {r4-r11,pc} |
|
194 |
+endfunc |
... | ... |
@@ -1829,19 +1829,21 @@ typedef struct AVCodecContext { |
1829 | 1829 |
*/ |
1830 | 1830 |
uint64_t error[4]; |
1831 | 1831 |
|
1832 |
+#if FF_API_MB_Q |
|
1832 | 1833 |
/** |
1833 | 1834 |
* minimum MB quantizer |
1834 | 1835 |
* - encoding: unused |
1835 | 1836 |
* - decoding: unused |
1836 | 1837 |
*/ |
1837 |
- int mb_qmin; |
|
1838 |
+ attribute_deprecated int mb_qmin; |
|
1838 | 1839 |
|
1839 | 1840 |
/** |
1840 | 1841 |
* maximum MB quantizer |
1841 | 1842 |
* - encoding: unused |
1842 | 1843 |
* - decoding: unused |
1843 | 1844 |
*/ |
1844 |
- int mb_qmax; |
|
1845 |
+ attribute_deprecated int mb_qmax; |
|
1846 |
+#endif |
|
1845 | 1847 |
|
1846 | 1848 |
/** |
1847 | 1849 |
* motion estimation comparison function |
... | ... |
@@ -2162,16 +2164,19 @@ typedef struct AVCodecContext { |
2162 | 2162 |
*/ |
2163 | 2163 |
int error_rate; |
2164 | 2164 |
|
2165 |
+#if FF_API_ANTIALIAS_ALGO |
|
2165 | 2166 |
/** |
2166 | 2167 |
* MP3 antialias algorithm, see FF_AA_* below. |
2167 | 2168 |
* - encoding: unused |
2168 | 2169 |
* - decoding: Set by user. |
2169 | 2170 |
*/ |
2170 |
- int antialias_algo; |
|
2171 |
+ attribute_deprecated int antialias_algo; |
|
2171 | 2172 |
#define FF_AA_AUTO 0 |
2172 | 2173 |
#define FF_AA_FASTINT 1 //not implemented yet |
2173 | 2174 |
#define FF_AA_INT 2 |
2174 | 2175 |
#define FF_AA_FLOAT 3 |
2176 |
+#endif |
|
2177 |
+ |
|
2175 | 2178 |
/** |
2176 | 2179 |
* quantizer noise shaping |
2177 | 2180 |
* - encoding: Set by user. |
... | ... |
@@ -126,6 +126,7 @@ av_cold int ff_fft_init(FFTContext *s, int nbits, int inverse) |
126 | 126 |
if (CONFIG_MDCT) s->mdct_calcw = s->mdct_calc; |
127 | 127 |
#else |
128 | 128 |
if (CONFIG_MDCT) s->mdct_calcw = ff_mdct_calcw_c; |
129 |
+ if (ARCH_ARM) ff_fft_fixed_init_arm(s); |
|
129 | 130 |
#endif |
130 | 131 |
|
131 | 132 |
for(j=4; j<=nbits; j++) { |
... | ... |
@@ -132,9 +132,13 @@ void ff_init_ff_cos_tabs(int index); |
132 | 132 |
*/ |
133 | 133 |
int ff_fft_init(FFTContext *s, int nbits, int inverse); |
134 | 134 |
|
135 |
+#if CONFIG_FFT_FLOAT |
|
135 | 136 |
void ff_fft_init_altivec(FFTContext *s); |
136 | 137 |
void ff_fft_init_mmx(FFTContext *s); |
137 | 138 |
void ff_fft_init_arm(FFTContext *s); |
139 |
+#else |
|
140 |
+void ff_fft_fixed_init_arm(FFTContext *s); |
|
141 |
+#endif |
|
138 | 142 |
|
139 | 143 |
void ff_fft_end(FFTContext *s); |
140 | 144 |
|
... | ... |
@@ -259,8 +259,10 @@ static const AVOption options[]={ |
259 | 259 |
{"pf", "forward predicted MVs of P-frames", 0, FF_OPT_TYPE_CONST, FF_DEBUG_VIS_MV_P_FOR, INT_MIN, INT_MAX, V|D, "debug_mv"}, |
260 | 260 |
{"bf", "forward predicted MVs of B-frames", 0, FF_OPT_TYPE_CONST, FF_DEBUG_VIS_MV_B_FOR, INT_MIN, INT_MAX, V|D, "debug_mv"}, |
261 | 261 |
{"bb", "backward predicted MVs of B-frames", 0, FF_OPT_TYPE_CONST, FF_DEBUG_VIS_MV_B_BACK, INT_MIN, INT_MAX, V|D, "debug_mv"}, |
262 |
+#if FF_API_MB_Q |
|
262 | 263 |
{"mb_qmin", "obsolete, use qmin", OFFSET(mb_qmin), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, |
263 | 264 |
{"mb_qmax", "obsolete, use qmax", OFFSET(mb_qmax), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, |
265 |
+#endif |
|
264 | 266 |
{"cmp", "full pel me compare function", OFFSET(me_cmp), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E, "cmp_func"}, |
265 | 267 |
{"subcmp", "sub pel me compare function", OFFSET(me_sub_cmp), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E, "cmp_func"}, |
266 | 268 |
{"mbcmp", "macroblock compare function", OFFSET(mb_cmp), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E, "cmp_func"}, |
... | ... |
@@ -317,7 +319,9 @@ static const AVOption options[]={ |
317 | 317 |
{"inter_threshold", NULL, OFFSET(inter_threshold), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, |
318 | 318 |
{"flags2", NULL, OFFSET(flags2), FF_OPT_TYPE_FLAGS, CODEC_FLAG2_FASTPSKIP|CODEC_FLAG2_BIT_RESERVOIR|CODEC_FLAG2_PSY|CODEC_FLAG2_MBTREE, 0, UINT_MAX, V|A|E|D, "flags2"}, |
319 | 319 |
{"error", NULL, OFFSET(error_rate), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, |
320 |
+#if FF_API_ANTIALIAS_ALGO |
|
320 | 321 |
{"antialias", "MP3 antialias algorithm", OFFSET(antialias_algo), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|D, "aa"}, |
322 |
+#endif |
|
321 | 323 |
{"auto", NULL, 0, FF_OPT_TYPE_CONST, FF_AA_AUTO, INT_MIN, INT_MAX, V|D, "aa"}, |
322 | 324 |
{"fastint", NULL, 0, FF_OPT_TYPE_CONST, FF_AA_FASTINT, INT_MIN, INT_MAX, V|D, "aa"}, |
323 | 325 |
{"int", NULL, 0, FF_OPT_TYPE_CONST, FF_AA_INT, INT_MIN, INT_MAX, V|D, "aa"}, |
... | ... |
@@ -77,5 +77,11 @@ |
77 | 77 |
#ifndef FF_API_RATE_EMU |
78 | 78 |
#define FF_API_RATE_EMU (LIBAVCODEC_VERSION_MAJOR < 53) |
79 | 79 |
#endif |
80 |
+#ifndef FF_API_MB_Q |
|
81 |
+#define FF_API_MB_Q (LIBAVCODEC_VERSION_MAJOR < 53) |
|
82 |
+#endif |
|
83 |
+#ifndef FF_API_ANTIALIAS_ALGO |
|
84 |
+#define FF_API_ANTIALIAS_ALGO (LIBAVCODEC_VERSION_MAJOR < 54) |
|
85 |
+#endif |
|
80 | 86 |
|
81 | 87 |
#endif /* AVCODEC_VERSION_H */ |
... | ... |
@@ -26,7 +26,7 @@ |
26 | 26 |
#include "libavutil/samplefmt.h" |
27 | 27 |
|
28 | 28 |
#define LIBAVFILTER_VERSION_MAJOR 1 |
29 |
-#define LIBAVFILTER_VERSION_MINOR 76 |
|
29 |
+#define LIBAVFILTER_VERSION_MINOR 77 |
|
30 | 30 |
#define LIBAVFILTER_VERSION_MICRO 0 |
31 | 31 |
|
32 | 32 |
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ |
... | ... |
@@ -238,7 +238,7 @@ static int aiff_read_header(AVFormatContext *s, |
238 | 238 |
offset += avio_tell(pb); /* Compute absolute data offset */ |
239 | 239 |
if (st->codec->block_align) /* Assume COMM already parsed */ |
240 | 240 |
goto got_sound; |
241 |
- if (url_is_streamed(pb)) { |
|
241 |
+ if (!pb->seekable) { |
|
242 | 242 |
av_log(s, AV_LOG_ERROR, "file is not seekable\n"); |
243 | 243 |
return -1; |
244 | 244 |
} |
... | ... |
@@ -124,7 +124,7 @@ static int aiff_write_trailer(AVFormatContext *s) |
124 | 124 |
end_size++; |
125 | 125 |
} |
126 | 126 |
|
127 |
- if (!url_is_streamed(s->pb)) { |
|
127 |
+ if (s->pb->seekable) { |
|
128 | 128 |
/* File length */ |
129 | 129 |
avio_seek(pb, aiff->form, SEEK_SET); |
130 | 130 |
avio_wb32(pb, file_size - aiff->form - 4); |
... | ... |
@@ -296,7 +296,7 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap) |
296 | 296 |
ape_dumpinfo(s, ape); |
297 | 297 |
|
298 | 298 |
/* try to read APE tags */ |
299 |
- if (!url_is_streamed(pb)) { |
|
299 |
+ if (pb->seekable) { |
|
300 | 300 |
ff_ape_parse_tag(s); |
301 | 301 |
avio_seek(pb, 0, SEEK_SET); |
302 | 302 |
} |
... | ... |
@@ -234,11 +234,11 @@ static void put_str16(AVIOContext *s, const char *tag) |
234 | 234 |
int len; |
235 | 235 |
uint8_t *pb; |
236 | 236 |
AVIOContext *dyn_buf; |
237 |
- if (url_open_dyn_buf(&dyn_buf) < 0) |
|
237 |
+ if (avio_open_dyn_buf(&dyn_buf) < 0) |
|
238 | 238 |
return; |
239 | 239 |
|
240 | 240 |
avio_put_str16le(dyn_buf, tag); |
241 |
- len = url_close_dyn_buf(dyn_buf, &pb); |
|
241 |
+ len = avio_close_dyn_buf(dyn_buf, &pb); |
|
242 | 242 |
avio_wl16(s, len); |
243 | 243 |
avio_write(s, pb, len); |
244 | 244 |
av_freep(&pb); |
... | ... |
@@ -347,7 +347,7 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data |
347 | 347 |
avio_wl64(pb, duration); /* end time stamp (in 100ns units) */ |
348 | 348 |
avio_wl64(pb, asf->duration); /* duration (in 100ns units) */ |
349 | 349 |
avio_wl64(pb, PREROLL_TIME); /* start time stamp */ |
350 |
- avio_wl32(pb, (asf->is_streamed || url_is_streamed(pb)) ? 3 : 2); /* ??? */ |
|
350 |
+ avio_wl32(pb, (asf->is_streamed || !pb->seekable ) ? 3 : 2); /* ??? */ |
|
351 | 351 |
avio_wl32(pb, s->packet_size); /* packet size */ |
352 | 352 |
avio_wl32(pb, s->packet_size); /* packet size */ |
353 | 353 |
avio_wl32(pb, bit_rate); /* Nominal data rate in bps */ |
... | ... |
@@ -366,7 +366,7 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data |
366 | 366 |
uint8_t *buf; |
367 | 367 |
AVIOContext *dyn_buf; |
368 | 368 |
|
369 |
- if (url_open_dyn_buf(&dyn_buf) < 0) |
|
369 |
+ if (avio_open_dyn_buf(&dyn_buf) < 0) |
|
370 | 370 |
return AVERROR(ENOMEM); |
371 | 371 |
|
372 | 372 |
hpos = put_header(pb, &ff_asf_comment_header); |
... | ... |
@@ -375,7 +375,7 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data |
375 | 375 |
len = tags[n] ? avio_put_str16le(dyn_buf, tags[n]->value) : 0; |
376 | 376 |
avio_wl16(pb, len); |
377 | 377 |
} |
378 |
- len = url_close_dyn_buf(dyn_buf, &buf); |
|
378 |
+ len = avio_close_dyn_buf(dyn_buf, &buf); |
|
379 | 379 |
avio_write(pb, buf, len); |
380 | 380 |
av_freep(&buf); |
381 | 381 |
end_header(pb, hpos); |
... | ... |
@@ -497,11 +497,11 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data |
497 | 497 |
else |
498 | 498 |
desc = p ? p->name : enc->codec_name; |
499 | 499 |
|
500 |
- if ( url_open_dyn_buf(&dyn_buf) < 0) |
|
500 |
+ if ( avio_open_dyn_buf(&dyn_buf) < 0) |
|
501 | 501 |
return AVERROR(ENOMEM); |
502 | 502 |
|
503 | 503 |
avio_put_str16le(dyn_buf, desc); |
504 |
- len = url_close_dyn_buf(dyn_buf, &buf); |
|
504 |
+ len = avio_close_dyn_buf(dyn_buf, &buf); |
|
505 | 505 |
avio_wl16(pb, len / 2); // "number of characters" = length in bytes / 2 |
506 | 506 |
|
507 | 507 |
avio_write(pb, buf, len); |
... | ... |
@@ -866,7 +866,7 @@ static int asf_write_trailer(AVFormatContext *s) |
866 | 866 |
} |
867 | 867 |
avio_flush(s->pb); |
868 | 868 |
|
869 |
- if (asf->is_streamed || url_is_streamed(s->pb)) { |
|
869 |
+ if (asf->is_streamed || !s->pb->seekable) { |
|
870 | 870 |
put_chunk(s, 0x4524, 0, 0); /* end of stream */ |
871 | 871 |
} else { |
872 | 872 |
/* rewrite an updated header */ |
... | ... |
@@ -89,14 +89,14 @@ int ff_avc_parse_nal_units(AVIOContext *pb, const uint8_t *buf_in, int size) |
89 | 89 |
int ff_avc_parse_nal_units_buf(const uint8_t *buf_in, uint8_t **buf, int *size) |
90 | 90 |
{ |
91 | 91 |
AVIOContext *pb; |
92 |
- int ret = url_open_dyn_buf(&pb); |
|
92 |
+ int ret = avio_open_dyn_buf(&pb); |
|
93 | 93 |
if(ret < 0) |
94 | 94 |
return ret; |
95 | 95 |
|
96 | 96 |
ff_avc_parse_nal_units(pb, buf_in, *size); |
97 | 97 |
|
98 | 98 |
av_freep(buf); |
99 |
- *size = url_close_dyn_buf(pb, buf); |
|
99 |
+ *size = avio_close_dyn_buf(pb, buf); |
|
100 | 100 |
return 0; |
101 | 101 |
} |
102 | 102 |
|
... | ... |
@@ -665,7 +665,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) |
665 | 665 |
break; |
666 | 666 |
case MKTAG('i', 'n', 'd', 'x'): |
667 | 667 |
i= avio_tell(pb); |
668 |
- if(!url_is_streamed(pb) && !(s->flags & AVFMT_FLAG_IGNIDX)){ |
|
668 |
+ if(pb->seekable && !(s->flags & AVFMT_FLAG_IGNIDX)){ |
|
669 | 669 |
read_braindead_odml_indx(s, 0); |
670 | 670 |
} |
671 | 671 |
avio_seek(pb, i+size, SEEK_SET); |
... | ... |
@@ -721,7 +721,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) |
721 | 721 |
return -1; |
722 | 722 |
} |
723 | 723 |
|
724 |
- if(!avi->index_loaded && !url_is_streamed(pb)) |
|
724 |
+ if(!avi->index_loaded && pb->seekable) |
|
725 | 725 |
avi_load_index(s); |
726 | 726 |
avi->index_loaded = 1; |
727 | 727 |
avi->non_interleaved |= guess_ni_flag(s); |
... | ... |
@@ -197,7 +197,7 @@ static int avi_write_header(AVFormatContext *s) |
197 | 197 |
} |
198 | 198 |
avio_wl32(pb, bitrate / 8); /* XXX: not quite exact */ |
199 | 199 |
avio_wl32(pb, 0); /* padding */ |
200 |
- if (url_is_streamed(pb)) |
|
200 |
+ if (!pb->seekable) |
|
201 | 201 |
avio_wl32(pb, AVIF_TRUSTCKTYPE | AVIF_ISINTERLEAVED); /* flags */ |
202 | 202 |
else |
203 | 203 |
avio_wl32(pb, AVIF_TRUSTCKTYPE | AVIF_HASINDEX | AVIF_ISINTERLEAVED); /* flags */ |
... | ... |
@@ -259,7 +259,7 @@ static int avi_write_header(AVFormatContext *s) |
259 | 259 |
|
260 | 260 |
avio_wl32(pb, 0); /* start */ |
261 | 261 |
avist->frames_hdr_strm = avio_tell(pb); /* remember this offset to fill later */ |
262 |
- if (url_is_streamed(pb)) |
|
262 |
+ if (!pb->seekable) |
|
263 | 263 |
avio_wl32(pb, AVI_MAX_RIFF_SIZE); /* FIXME: this may be broken, but who cares */ |
264 | 264 |
else |
265 | 265 |
avio_wl32(pb, 0); /* length, XXX: filled later */ |
... | ... |
@@ -303,7 +303,7 @@ static int avi_write_header(AVFormatContext *s) |
303 | 303 |
} |
304 | 304 |
} |
305 | 305 |
|
306 |
- if (!url_is_streamed(pb)) { |
|
306 |
+ if (pb->seekable) { |
|
307 | 307 |
unsigned char tag[5]; |
308 | 308 |
int j; |
309 | 309 |
|
... | ... |
@@ -362,7 +362,7 @@ static int avi_write_header(AVFormatContext *s) |
362 | 362 |
ff_end_tag(pb, list2); |
363 | 363 |
} |
364 | 364 |
|
365 |
- if (!url_is_streamed(pb)) { |
|
365 |
+ if (pb->seekable) { |
|
366 | 366 |
/* AVI could become an OpenDML one, if it grows beyond 2Gb range */ |
367 | 367 |
avi->odml_list = ff_start_tag(pb, "JUNK"); |
368 | 368 |
ffio_wfourcc(pb, "odml"); |
... | ... |
@@ -406,7 +406,7 @@ static int avi_write_ix(AVFormatContext *s) |
406 | 406 |
char ix_tag[] = "ix00"; |
407 | 407 |
int i, j; |
408 | 408 |
|
409 |
- assert(!url_is_streamed(pb)); |
|
409 |
+ assert(pb->seekable); |
|
410 | 410 |
|
411 | 411 |
if (avi->riff_id > AVI_MASTER_INDEX_SIZE) |
412 | 412 |
return -1; |
... | ... |
@@ -464,7 +464,7 @@ static int avi_write_idx1(AVFormatContext *s) |
464 | 464 |
int i; |
465 | 465 |
char tag[5]; |
466 | 466 |
|
467 |
- if (!url_is_streamed(pb)) { |
|
467 |
+ if (pb->seekable) { |
|
468 | 468 |
AVIStream *avist; |
469 | 469 |
AVIIentry* ie = 0, *tie; |
470 | 470 |
int empty, stream_id = -1; |
... | ... |
@@ -532,7 +532,7 @@ static int avi_write_packet(AVFormatContext *s, AVPacket *pkt) |
532 | 532 |
avist->packet_count++; |
533 | 533 |
|
534 | 534 |
// Make sure to put an OpenDML chunk when the file size exceeds the limits |
535 |
- if (!url_is_streamed(pb) && |
|
535 |
+ if (pb->seekable && |
|
536 | 536 |
(avio_tell(pb) - avi->riff_start > AVI_MAX_RIFF_SIZE)) { |
537 | 537 |
|
538 | 538 |
avi_write_ix(s); |
... | ... |
@@ -552,7 +552,7 @@ static int avi_write_packet(AVFormatContext *s, AVPacket *pkt) |
552 | 552 |
avist->audio_strm_length += size; |
553 | 553 |
} |
554 | 554 |
|
555 |
- if (!url_is_streamed(s->pb)) { |
|
555 |
+ if (s->pb->seekable) { |
|
556 | 556 |
AVIIndex* idx = &avist->indexes; |
557 | 557 |
int cl = idx->entry / AVI_INDEX_CLUSTER_SIZE; |
558 | 558 |
int id = idx->entry % AVI_INDEX_CLUSTER_SIZE; |
... | ... |
@@ -590,7 +590,7 @@ static int avi_write_trailer(AVFormatContext *s) |
590 | 590 |
int i, j, n, nb_frames; |
591 | 591 |
int64_t file_size; |
592 | 592 |
|
593 |
- if (!url_is_streamed(pb)){ |
|
593 |
+ if (pb->seekable){ |
|
594 | 594 |
if (avi->riff_id == 1) { |
595 | 595 |
ff_end_tag(pb, avi->movi_list); |
596 | 596 |
res = avi_write_idx1(s); |
... | ... |
@@ -332,6 +332,8 @@ attribute_deprecated int av_register_protocol(URLProtocol *protocol); |
332 | 332 |
*/ |
333 | 333 |
int av_register_protocol2(URLProtocol *protocol, int size); |
334 | 334 |
|
335 |
+#define AVIO_SEEKABLE_NORMAL 0x0001 /**< Seeking works like for a local file */ |
|
336 |
+ |
|
335 | 337 |
/** |
336 | 338 |
* Bytestream IO Context. |
337 | 339 |
* New fields can be added to the end with minor version bumps. |
... | ... |
@@ -351,7 +353,9 @@ typedef struct { |
351 | 351 |
int must_flush; /**< true if the next seek should flush */ |
352 | 352 |
int eof_reached; /**< true if eof reached */ |
353 | 353 |
int write_flag; /**< true if open for writing */ |
354 |
- int is_streamed; |
|
354 |
+#if FF_API_OLD_AVIO |
|
355 |
+ attribute_deprecated int is_streamed; |
|
356 |
+#endif |
|
355 | 357 |
int max_packet_size; |
356 | 358 |
unsigned long checksum; |
357 | 359 |
unsigned char *checksum_ptr; |
... | ... |
@@ -360,6 +364,10 @@ typedef struct { |
360 | 360 |
int (*read_pause)(void *opaque, int pause); |
361 | 361 |
int64_t (*read_seek)(void *opaque, int stream_index, |
362 | 362 |
int64_t timestamp, int flags); |
363 |
+ /** |
|
364 |
+ * A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable. |
|
365 |
+ */ |
|
366 |
+ int seekable; |
|
363 | 367 |
} AVIOContext; |
364 | 368 |
|
365 | 369 |
#if FF_API_OLD_AVIO |
... | ... |
@@ -439,6 +447,10 @@ attribute_deprecated int url_fprintf(AVIOContext *s, const char *fmt, ...) __att |
439 | 439 |
attribute_deprecated int url_fprintf(AVIOContext *s, const char *fmt, ...); |
440 | 440 |
#endif |
441 | 441 |
attribute_deprecated void put_flush_packet(AVIOContext *s); |
442 |
+attribute_deprecated int url_open_dyn_buf(AVIOContext **s); |
|
443 |
+attribute_deprecated int url_open_dyn_packet_buf(AVIOContext **s, int max_packet_size); |
|
444 |
+attribute_deprecated int url_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer); |
|
445 |
+attribute_deprecated int url_fdopen(AVIOContext **s, URLContext *h); |
|
442 | 446 |
/** |
443 | 447 |
* @} |
444 | 448 |
*/ |
... | ... |
@@ -603,23 +615,15 @@ unsigned int avio_rb24(AVIOContext *s); |
603 | 603 |
unsigned int avio_rb32(AVIOContext *s); |
604 | 604 |
uint64_t avio_rb64(AVIOContext *s); |
605 | 605 |
|
606 |
-static inline int url_is_streamed(AVIOContext *s) |
|
607 |
-{ |
|
608 |
- return s->is_streamed; |
|
609 |
-} |
|
610 |
- |
|
606 |
+#if FF_API_OLD_AVIO |
|
611 | 607 |
/** |
612 |
- * Create and initialize a AVIOContext for accessing the |
|
613 |
- * resource referenced by the URLContext h. |
|
614 |
- * @note When the URLContext h has been opened in read+write mode, the |
|
615 |
- * AVIOContext can be used only for writing. |
|
616 |
- * |
|
617 |
- * @param s Used to return the pointer to the created AVIOContext. |
|
618 |
- * In case of failure the pointed to value is set to NULL. |
|
619 |
- * @return 0 in case of success, a negative value corresponding to an |
|
620 |
- * AVERROR code in case of failure |
|
608 |
+ * @deprecated Use AVIOContext.seekable field directly. |
|
621 | 609 |
*/ |
622 |
-int url_fdopen(AVIOContext **s, URLContext *h); |
|
610 |
+attribute_deprecated static inline int url_is_streamed(AVIOContext *s) |
|
611 |
+{ |
|
612 |
+ return !s->seekable; |
|
613 |
+} |
|
614 |
+#endif |
|
623 | 615 |
|
624 | 616 |
#if FF_API_URL_RESETBUF |
625 | 617 |
/** Reset the buffer for reading or writing. |
... | ... |
@@ -666,30 +670,18 @@ attribute_deprecated int url_close_buf(AVIOContext *s); |
666 | 666 |
* @param s new IO context |
667 | 667 |
* @return zero if no error. |
668 | 668 |
*/ |
669 |
-int url_open_dyn_buf(AVIOContext **s); |
|
670 |
- |
|
671 |
-/** |
|
672 |
- * Open a write only packetized memory stream with a maximum packet |
|
673 |
- * size of 'max_packet_size'. The stream is stored in a memory buffer |
|
674 |
- * with a big endian 4 byte header giving the packet size in bytes. |
|
675 |
- * |
|
676 |
- * @param s new IO context |
|
677 |
- * @param max_packet_size maximum packet size (must be > 0) |
|
678 |
- * @return zero if no error. |
|
679 |
- */ |
|
680 |
-int url_open_dyn_packet_buf(AVIOContext **s, int max_packet_size); |
|
669 |
+int avio_open_dyn_buf(AVIOContext **s); |
|
681 | 670 |
|
682 | 671 |
/** |
683 | 672 |
* Return the written size and a pointer to the buffer. The buffer |
684 |
- * must be freed with av_free(). If the buffer is opened with |
|
685 |
- * url_open_dyn_buf, then padding of FF_INPUT_BUFFER_PADDING_SIZE is |
|
686 |
- * added; if opened with url_open_dyn_packet_buf, no padding is added. |
|
673 |
+ * must be freed with av_free(). |
|
674 |
+ * Padding of FF_INPUT_BUFFER_PADDING_SIZE is added to the buffer. |
|
687 | 675 |
* |
688 | 676 |
* @param s IO context |
689 | 677 |
* @param pbuffer pointer to a byte buffer |
690 | 678 |
* @return the length of the byte buffer |
691 | 679 |
*/ |
692 |
-int url_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer); |
|
680 |
+int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer); |
|
693 | 681 |
|
694 | 682 |
#if FF_API_UDP_GET_FILE |
695 | 683 |
int udp_get_file_handle(URLContext *h); |
... | ... |
@@ -81,4 +81,28 @@ unsigned long ffio_get_checksum(AVIOContext *s); |
81 | 81 |
unsigned long ff_crc04C11DB7_update(unsigned long checksum, const uint8_t *buf, |
82 | 82 |
unsigned int len); |
83 | 83 |
|
84 |
+/** |
|
85 |
+ * Open a write only packetized memory stream with a maximum packet |
|
86 |
+ * size of 'max_packet_size'. The stream is stored in a memory buffer |
|
87 |
+ * with a big endian 4 byte header giving the packet size in bytes. |
|
88 |
+ * |
|
89 |
+ * @param s new IO context |
|
90 |
+ * @param max_packet_size maximum packet size (must be > 0) |
|
91 |
+ * @return zero if no error. |
|
92 |
+ */ |
|
93 |
+int ffio_open_dyn_packet_buf(AVIOContext **s, int max_packet_size); |
|
94 |
+ |
|
95 |
+/** |
|
96 |
+ * Create and initialize a AVIOContext for accessing the |
|
97 |
+ * resource referenced by the URLContext h. |
|
98 |
+ * @note When the URLContext h has been opened in read+write mode, the |
|
99 |
+ * AVIOContext can be used only for writing. |
|
100 |
+ * |
|
101 |
+ * @param s Used to return the pointer to the created AVIOContext. |
|
102 |
+ * In case of failure the pointed to value is set to NULL. |
|
103 |
+ * @return 0 in case of success, a negative value corresponding to an |
|
104 |
+ * AVERROR code in case of failure |
|
105 |
+ */ |
|
106 |
+int ffio_fdopen(AVIOContext **s, URLContext *h); |
|
107 |
+ |
|
84 | 108 |
#endif // AVFORMAT_AVIO_INTERNAL_H |
... | ... |
@@ -62,7 +62,10 @@ int ffio_init_context(AVIOContext *s, |
62 | 62 |
s->must_flush = 0; |
63 | 63 |
s->eof_reached = 0; |
64 | 64 |
s->error = 0; |
65 |
+#if FF_API_OLD_AVIO |
|
65 | 66 |
s->is_streamed = 0; |
67 |
+#endif |
|
68 |
+ s->seekable = AVIO_SEEKABLE_NORMAL; |
|
66 | 69 |
s->max_packet_size = 0; |
67 | 70 |
s->update_checksum= NULL; |
68 | 71 |
if(!read_packet && !write_flag){ |
... | ... |
@@ -202,7 +205,7 @@ int64_t avio_seek(AVIOContext *s, int64_t offset, int whence) |
202 | 202 |
offset1 >= 0 && offset1 <= (s->buf_end - s->buffer)) { |
203 | 203 |
/* can do the seek inside the buffer */ |
204 | 204 |
s->buf_ptr = s->buffer + offset1; |
205 |
- } else if ((s->is_streamed || |
|
205 |
+ } else if ((!s->seekable || |
|
206 | 206 |
offset1 <= s->buf_end + SHORT_SEEK_THRESHOLD - s->buffer) && |
207 | 207 |
!s->write_flag && offset1 >= 0 && |
208 | 208 |
(whence != SEEK_END || force)) { |
... | ... |
@@ -425,6 +428,22 @@ unsigned long get_checksum(AVIOContext *s) |
425 | 425 |
{ |
426 | 426 |
return ffio_get_checksum(s); |
427 | 427 |
} |
428 |
+int url_open_dyn_buf(AVIOContext **s) |
|
429 |
+{ |
|
430 |
+ return avio_open_dyn_buf(s); |
|
431 |
+} |
|
432 |
+int url_open_dyn_packet_buf(AVIOContext **s, int max_packet_size) |
|
433 |
+{ |
|
434 |
+ return ffio_open_dyn_packet_buf(s, max_packet_size); |
|
435 |
+} |
|
436 |
+int url_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer) |
|
437 |
+{ |
|
438 |
+ return avio_close_dyn_buf(s, pbuffer); |
|
439 |
+} |
|
440 |
+int url_fdopen(AVIOContext **s, URLContext *h) |
|
441 |
+{ |
|
442 |
+ return ffio_fdopen(s, h); |
|
443 |
+} |
|
428 | 444 |
#endif |
429 | 445 |
|
430 | 446 |
int avio_put_str(AVIOContext *s, const char *str) |
... | ... |
@@ -812,7 +831,7 @@ uint64_t ffio_read_varlen(AVIOContext *bc){ |
812 | 812 |
return val; |
813 | 813 |
} |
814 | 814 |
|
815 |
-int url_fdopen(AVIOContext **s, URLContext *h) |
|
815 |
+int ffio_fdopen(AVIOContext **s, URLContext *h) |
|
816 | 816 |
{ |
817 | 817 |
uint8_t *buffer; |
818 | 818 |
int buffer_size, max_packet_size; |
... | ... |
@@ -840,7 +859,10 @@ int url_fdopen(AVIOContext **s, URLContext *h) |
840 | 840 |
av_freep(s); |
841 | 841 |
return AVERROR(EIO); |
842 | 842 |
} |
843 |
+#if FF_API_OLD_AVIO |
|
843 | 844 |
(*s)->is_streamed = h->is_streamed; |
845 |
+#endif |
|
846 |
+ (*s)->seekable = h->is_streamed ? 0 : AVIO_SEEKABLE_NORMAL; |
|
844 | 847 |
(*s)->max_packet_size = max_packet_size; |
845 | 848 |
if(h->prot) { |
846 | 849 |
(*s)->read_pause = (int (*)(void *, int))h->prot->url_read_pause; |
... | ... |
@@ -934,7 +956,7 @@ int avio_open(AVIOContext **s, const char *filename, int flags) |
934 | 934 |
err = url_open(&h, filename, flags); |
935 | 935 |
if (err < 0) |
936 | 936 |
return err; |
937 |
- err = url_fdopen(s, h); |
|
937 |
+ err = ffio_fdopen(s, h); |
|
938 | 938 |
if (err < 0) { |
939 | 939 |
url_close(h); |
940 | 940 |
return err; |
... | ... |
@@ -1026,7 +1048,7 @@ int64_t ffio_read_seek(AVIOContext *s, int stream_index, |
1026 | 1026 |
return ret; |
1027 | 1027 |
} |
1028 | 1028 |
|
1029 |
-/* url_open_dyn_buf and url_close_dyn_buf are used in rtp.c to send a response |
|
1029 |
+/* avio_open_dyn_buf and avio_close_dyn_buf are used in rtp.c to send a response |
|
1030 | 1030 |
* back to the server even if CONFIG_MUXERS is false. */ |
1031 | 1031 |
#if CONFIG_MUXERS || CONFIG_NETWORK |
1032 | 1032 |
/* buffer handling */ |
... | ... |
@@ -1123,7 +1145,6 @@ static int64_t dyn_buf_seek(void *opaque, int64_t offset, int whence) |
1123 | 1123 |
static int url_open_dyn_buf_internal(AVIOContext **s, int max_packet_size) |
1124 | 1124 |
{ |
1125 | 1125 |
DynBuffer *d; |
1126 |
- int ret; |
|
1127 | 1126 |
unsigned io_buffer_size = max_packet_size ? max_packet_size : 1024; |
1128 | 1127 |
|
1129 | 1128 |
if(sizeof(DynBuffer) + io_buffer_size < io_buffer_size) |
... | ... |
@@ -1131,38 +1152,31 @@ static int url_open_dyn_buf_internal(AVIOContext **s, int max_packet_size) |
1131 | 1131 |
d = av_mallocz(sizeof(DynBuffer) + io_buffer_size); |
1132 | 1132 |
if (!d) |
1133 | 1133 |
return AVERROR(ENOMEM); |
1134 |
- *s = av_mallocz(sizeof(AVIOContext)); |
|
1134 |
+ d->io_buffer_size = io_buffer_size; |
|
1135 |
+ *s = avio_alloc_context(d->io_buffer, d->io_buffer_size, 1, d, NULL, |
|
1136 |
+ max_packet_size ? dyn_packet_buf_write : dyn_buf_write, |
|
1137 |
+ max_packet_size ? NULL : dyn_buf_seek); |
|
1135 | 1138 |
if(!*s) { |
1136 | 1139 |
av_free(d); |
1137 | 1140 |
return AVERROR(ENOMEM); |
1138 | 1141 |
} |
1139 |
- d->io_buffer_size = io_buffer_size; |
|
1140 |
- ret = ffio_init_context(*s, d->io_buffer, io_buffer_size, |
|
1141 |
- 1, d, NULL, |
|
1142 |
- max_packet_size ? dyn_packet_buf_write : dyn_buf_write, |
|
1143 |
- max_packet_size ? NULL : dyn_buf_seek); |
|
1144 |
- if (ret == 0) { |
|
1145 |
- (*s)->max_packet_size = max_packet_size; |
|
1146 |
- } else { |
|
1147 |
- av_free(d); |
|
1148 |
- av_freep(s); |
|
1149 |
- } |
|
1150 |
- return ret; |
|
1142 |
+ (*s)->max_packet_size = max_packet_size; |
|
1143 |
+ return 0; |
|
1151 | 1144 |
} |
1152 | 1145 |
|
1153 |
-int url_open_dyn_buf(AVIOContext **s) |
|
1146 |
+int avio_open_dyn_buf(AVIOContext **s) |
|
1154 | 1147 |
{ |
1155 | 1148 |
return url_open_dyn_buf_internal(s, 0); |
1156 | 1149 |
} |
1157 | 1150 |
|
1158 |
-int url_open_dyn_packet_buf(AVIOContext **s, int max_packet_size) |
|
1151 |
+int ffio_open_dyn_packet_buf(AVIOContext **s, int max_packet_size) |
|
1159 | 1152 |
{ |
1160 | 1153 |
if (max_packet_size <= 0) |
1161 | 1154 |
return -1; |
1162 | 1155 |
return url_open_dyn_buf_internal(s, max_packet_size); |
1163 | 1156 |
} |
1164 | 1157 |
|
1165 |
-int url_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer) |
|
1158 |
+int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer) |
|
1166 | 1159 |
{ |
1167 | 1160 |
DynBuffer *d = s->opaque; |
1168 | 1161 |
int size; |
... | ... |
@@ -247,7 +247,7 @@ static int read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, in |
247 | 247 |
BinkDemuxContext *bink = s->priv_data; |
248 | 248 |
AVStream *vst = s->streams[0]; |
249 | 249 |
|
250 |
- if (url_is_streamed(s->pb)) |
|
250 |
+ if (!s->pb->seekable) |
|
251 | 251 |
return -1; |
252 | 252 |
|
253 | 253 |
/* seek to the first frame */ |
... | ... |
@@ -223,7 +223,7 @@ static int read_header(AVFormatContext *s, |
223 | 223 |
|
224 | 224 |
/* stop at data chunk if seeking is not supported or |
225 | 225 |
data chunk size is unknown */ |
226 |
- if (found_data && (caf->data_size < 0 || url_is_streamed(pb))) |
|
226 |
+ if (found_data && (caf->data_size < 0 || !pb->seekable)) |
|
227 | 227 |
break; |
228 | 228 |
|
229 | 229 |
tag = avio_rb32(pb); |
... | ... |
@@ -236,7 +236,7 @@ static int read_header(AVFormatContext *s, |
236 | 236 |
avio_skip(pb, 4); /* edit count */ |
237 | 237 |
caf->data_start = avio_tell(pb); |
238 | 238 |
caf->data_size = size < 0 ? -1 : size - 4; |
239 |
- if (caf->data_size > 0 && !url_is_streamed(pb)) |
|
239 |
+ if (caf->data_size > 0 && pb->seekable) |
|
240 | 240 |
avio_skip(pb, caf->data_size); |
241 | 241 |
found_data = 1; |
242 | 242 |
break; |
... | ... |
@@ -281,7 +281,7 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap) |
281 | 281 |
goto fail; |
282 | 282 |
ffm->write_index = avio_rb64(pb); |
283 | 283 |
/* get also filesize */ |
284 |
- if (!url_is_streamed(pb)) { |
|
284 |
+ if (pb->seekable) { |
|
285 | 285 |
ffm->file_size = avio_size(pb); |
286 | 286 |
if (ffm->write_index) |
287 | 287 |
adjust_write_index(s); |
... | ... |
@@ -98,7 +98,7 @@ static int flac_write_trailer(struct AVFormatContext *s) |
98 | 98 |
if (!ff_flac_is_extradata_valid(s->streams[0]->codec, &format, &streaminfo)) |
99 | 99 |
return -1; |
100 | 100 |
|
101 |
- if (!url_is_streamed(pb)) { |
|
101 |
+ if (pb->seekable) { |
|
102 | 102 |
/* rewrite the STREAMINFO header block data */ |
103 | 103 |
file_size = avio_tell(pb); |
104 | 104 |
avio_seek(pb, 8, SEEK_SET); |
... | ... |
@@ -428,7 +428,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) |
428 | 428 |
} |
429 | 429 |
|
430 | 430 |
// if not streamed and no duration from metadata then seek to end to find the duration from the timestamps |
431 |
- if(!url_is_streamed(s->pb) && (!s->duration || s->duration==AV_NOPTS_VALUE)){ |
|
431 |
+ if(s->pb->seekable && (!s->duration || s->duration==AV_NOPTS_VALUE)){ |
|
432 | 432 |
int size; |
433 | 433 |
const int64_t pos= avio_tell(s->pb); |
434 | 434 |
const int64_t fsize= avio_size(s->pb); |
... | ... |
@@ -530,7 +530,7 @@ static int flv_read_seek2(AVFormatContext *s, int stream_index, |
530 | 530 |
|
531 | 531 |
if (ts - min_ts > (uint64_t)(max_ts - ts)) flags |= AVSEEK_FLAG_BACKWARD; |
532 | 532 |
|
533 |
- if (url_is_streamed(s->pb)) { |
|
533 |
+ if (!s->pb->seekable) { |
|
534 | 534 |
if (stream_index < 0) { |
535 | 535 |
stream_index = av_find_default_stream_index(s); |
536 | 536 |
if (stream_index < 0) |
... | ... |
@@ -634,7 +634,7 @@ static int gxf_write_header(AVFormatContext *s) |
634 | 634 |
uint8_t tracks[255] = {0}; |
635 | 635 |
int i, media_info = 0; |
636 | 636 |
|
637 |
- if (url_is_streamed(pb)) { |
|
637 |
+ if (!pb->seekable) { |
|
638 | 638 |
av_log(s, AV_LOG_ERROR, "gxf muxer does not support streamed output, patch welcome"); |
639 | 639 |
return -1; |
640 | 640 |
} |
... | ... |
@@ -229,7 +229,7 @@ void ff_id3v1_read(AVFormatContext *s) |
229 | 229 |
uint8_t buf[ID3v1_TAG_SIZE]; |
230 | 230 |
int64_t filesize, position = avio_tell(s->pb); |
231 | 231 |
|
232 |
- if (!url_is_streamed(s->pb)) { |
|
232 |
+ if (s->pb->seekable) { |
|
233 | 233 |
/* XXX: change that */ |
234 | 234 |
filesize = avio_size(s->pb); |
235 | 235 |
if (filesize > 128) { |
... | ... |
@@ -1120,7 +1120,7 @@ static void matroska_execute_seekhead(MatroskaDemuxContext *matroska) |
1120 | 1120 |
int i; |
1121 | 1121 |
|
1122 | 1122 |
// we should not do any seeking in the streaming case |
1123 |
- if (url_is_streamed(matroska->ctx->pb) || |
|
1123 |
+ if (!matroska->ctx->pb->seekable || |
|
1124 | 1124 |
(matroska->ctx->flags & AVFMT_FLAG_IGNIDX)) |
1125 | 1125 |
return; |
1126 | 1126 |
|
... | ... |
@@ -455,7 +455,7 @@ static int mkv_write_codecprivate(AVFormatContext *s, AVIOContext *pb, AVCodecCo |
455 | 455 |
uint8_t *codecpriv; |
456 | 456 |
int ret, codecpriv_size; |
457 | 457 |
|
458 |
- ret = url_open_dyn_buf(&dyn_cp); |
|
458 |
+ ret = avio_open_dyn_buf(&dyn_cp); |
|
459 | 459 |
if(ret < 0) |
460 | 460 |
return ret; |
461 | 461 |
|
... | ... |
@@ -498,7 +498,7 @@ static int mkv_write_codecprivate(AVFormatContext *s, AVIOContext *pb, AVCodecCo |
498 | 498 |
ff_put_wav_header(dyn_cp, codec); |
499 | 499 |
} |
500 | 500 |
|
501 |
- codecpriv_size = url_close_dyn_buf(dyn_cp, &codecpriv); |
|
501 |
+ codecpriv_size = avio_close_dyn_buf(dyn_cp, &codecpriv); |
|
502 | 502 |
if (codecpriv_size) |
503 | 503 |
put_ebml_binary(pb, MATROSKA_ID_CODECPRIVATE, codecpriv, codecpriv_size); |
504 | 504 |
av_free(codecpriv); |
... | ... |
@@ -852,7 +852,7 @@ static int mkv_write_header(AVFormatContext *s) |
852 | 852 |
if (ret < 0) return ret; |
853 | 853 |
} |
854 | 854 |
|
855 |
- if (url_is_streamed(s->pb)) |
|
855 |
+ if (!s->pb->seekable) |
|
856 | 856 |
mkv_write_seekhead(pb, mkv->main_seekhead); |
857 | 857 |
|
858 | 858 |
mkv->cues = mkv_start_cues(mkv->segment_offset); |
... | ... |
@@ -1007,7 +1007,7 @@ static void mkv_flush_dynbuf(AVFormatContext *s) |
1007 | 1007 |
if (!mkv->dyn_bc) |
1008 | 1008 |
return; |
1009 | 1009 |
|
1010 |
- bufsize = url_close_dyn_buf(mkv->dyn_bc, &dyn_buf); |
|
1010 |
+ bufsize = avio_close_dyn_buf(mkv->dyn_bc, &dyn_buf); |
|
1011 | 1011 |
avio_write(s->pb, dyn_buf, bufsize); |
1012 | 1012 |
av_free(dyn_buf); |
1013 | 1013 |
mkv->dyn_bc = NULL; |
... | ... |
@@ -1028,9 +1028,9 @@ static int mkv_write_packet_internal(AVFormatContext *s, AVPacket *pkt) |
1028 | 1028 |
return AVERROR(EINVAL); |
1029 | 1029 |
} |
1030 | 1030 |
|
1031 |
- if (url_is_streamed(s->pb)) { |
|
1031 |
+ if (!s->pb->seekable) { |
|
1032 | 1032 |
if (!mkv->dyn_bc) |
1033 |
- url_open_dyn_buf(&mkv->dyn_bc); |
|
1033 |
+ avio_open_dyn_buf(&mkv->dyn_bc); |
|
1034 | 1034 |
pb = mkv->dyn_bc; |
1035 | 1035 |
} |
1036 | 1036 |
|
... | ... |
@@ -1080,16 +1080,16 @@ static int mkv_copy_packet(MatroskaMuxContext *mkv, const AVPacket *pkt) |
1080 | 1080 |
static int mkv_write_packet(AVFormatContext *s, AVPacket *pkt) |
1081 | 1081 |
{ |
1082 | 1082 |
MatroskaMuxContext *mkv = s->priv_data; |
1083 |
- AVIOContext *pb = url_is_streamed(s->pb) ? mkv->dyn_bc : s->pb; |
|
1083 |
+ AVIOContext *pb = s->pb->seekable ? s->pb : mkv->dyn_bc; |
|
1084 | 1084 |
AVCodecContext *codec = s->streams[pkt->stream_index]->codec; |
1085 | 1085 |
int ret, keyframe = !!(pkt->flags & AV_PKT_FLAG_KEY); |
1086 | 1086 |
int64_t ts = mkv->tracks[pkt->stream_index].write_dts ? pkt->dts : pkt->pts; |
1087 |
- int cluster_size = avio_tell(pb) - (url_is_streamed(s->pb) ? 0 : mkv->cluster_pos); |
|
1087 |
+ int cluster_size = avio_tell(pb) - (s->pb->seekable ? mkv->cluster_pos : 0); |
|
1088 | 1088 |
|
1089 | 1089 |
// start a new cluster every 5 MB or 5 sec, or 32k / 1 sec for streaming or |
1090 | 1090 |
// after 4k and on a keyframe |
1091 | 1091 |
if (mkv->cluster_pos && |
1092 |
- ((url_is_streamed(s->pb) && (cluster_size > 32*1024 || ts > mkv->cluster_pts + 1000)) |
|
1092 |
+ ((!s->pb->seekable && (cluster_size > 32*1024 || ts > mkv->cluster_pts + 1000)) |
|
1093 | 1093 |
|| cluster_size > 5*1024*1024 || ts > mkv->cluster_pts + 5000 |
1094 | 1094 |
|| (codec->codec_type == AVMEDIA_TYPE_VIDEO && keyframe && cluster_size > 4*1024))) { |
1095 | 1095 |
av_log(s, AV_LOG_DEBUG, "Starting new cluster at offset %" PRIu64 |
... | ... |
@@ -1143,7 +1143,7 @@ static int mkv_write_trailer(AVFormatContext *s) |
1143 | 1143 |
end_ebml_master(pb, mkv->cluster); |
1144 | 1144 |
} |
1145 | 1145 |
|
1146 |
- if (!url_is_streamed(pb)) { |
|
1146 |
+ if (pb->seekable) { |
|
1147 | 1147 |
cuespos = mkv_write_cues(pb, mkv->cues, s->nb_streams); |
1148 | 1148 |
|
1149 | 1149 |
ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_CUES , cuespos); |
... | ... |
@@ -133,7 +133,7 @@ static int mmf_write_trailer(AVFormatContext *s) |
133 | 133 |
int64_t pos, size; |
134 | 134 |
int gatetime; |
135 | 135 |
|
136 |
- if (!url_is_streamed(s->pb)) { |
|
136 |
+ if (s->pb->seekable) { |
|
137 | 137 |
/* Fill in length fields */ |
138 | 138 |
end_tag_be(pb, mmf->awapos); |
139 | 139 |
end_tag_be(pb, mmf->atrpos); |
... | ... |
@@ -304,7 +304,7 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom) |
304 | 304 |
if (err < 0) |
305 | 305 |
return err; |
306 | 306 |
if (c->found_moov && c->found_mdat && |
307 |
- (url_is_streamed(pb) || start_pos + a.size == avio_size(pb))) |
|
307 |
+ (!pb->seekable || start_pos + a.size == avio_size(pb))) |
|
308 | 308 |
return 0; |
309 | 309 |
left = a.size - avio_tell(pb) + start_pos; |
310 | 310 |
if (left > 0) /* skip garbage at atom end */ |
... | ... |
@@ -2354,7 +2354,7 @@ static int mov_read_header(AVFormatContext *s, AVFormatParameters *ap) |
2354 | 2354 |
|
2355 | 2355 |
mov->fc = s; |
2356 | 2356 |
/* .mov and .mp4 aren't streamable anyway (only progressive download if moov is before mdat) */ |
2357 |
- if(!url_is_streamed(pb)) |
|
2357 |
+ if(pb->seekable) |
|
2358 | 2358 |
atom.size = avio_size(pb); |
2359 | 2359 |
else |
2360 | 2360 |
atom.size = INT64_MAX; |
... | ... |
@@ -2370,7 +2370,7 @@ static int mov_read_header(AVFormatContext *s, AVFormatParameters *ap) |
2370 | 2370 |
} |
2371 | 2371 |
av_dlog(mov->fc, "on_parse_exit_offset=%lld\n", avio_tell(pb)); |
2372 | 2372 |
|
2373 |
- if (!url_is_streamed(pb) && mov->chapter_track > 0) |
|
2373 |
+ if (pb->seekable && mov->chapter_track > 0) |
|
2374 | 2374 |
mov_read_chapters(s); |
2375 | 2375 |
|
2376 | 2376 |
return 0; |
... | ... |
@@ -2388,8 +2388,8 @@ static AVIndexEntry *mov_find_next_sample(AVFormatContext *s, AVStream **st) |
2388 | 2388 |
AVIndexEntry *current_sample = &avst->index_entries[msc->current_sample]; |
2389 | 2389 |
int64_t dts = av_rescale(current_sample->timestamp, AV_TIME_BASE, msc->time_scale); |
2390 | 2390 |
av_dlog(s, "stream %d, sample %d, dts %"PRId64"\n", i, msc->current_sample, dts); |
2391 |
- if (!sample || (url_is_streamed(s->pb) && current_sample->pos < sample->pos) || |
|
2392 |
- (!url_is_streamed(s->pb) && |
|
2391 |
+ if (!sample || (!s->pb->seekable && current_sample->pos < sample->pos) || |
|
2392 |
+ (s->pb->seekable && |
|
2393 | 2393 |
((msc->pb != s->pb && dts < best_dts) || (msc->pb == s->pb && |
2394 | 2394 |
((FFABS(best_dts - dts) <= AV_TIME_BASE && current_sample->pos < sample->pos) || |
2395 | 2395 |
(FFABS(best_dts - dts) > AV_TIME_BASE && dts < best_dts)))))) { |
... | ... |
@@ -2413,7 +2413,7 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt) |
2413 | 2413 |
sample = mov_find_next_sample(s, &st); |
2414 | 2414 |
if (!sample) { |
2415 | 2415 |
mov->found_mdat = 0; |
2416 |
- if (!url_is_streamed(s->pb) || |
|
2416 |
+ if (s->pb->seekable|| |
|
2417 | 2417 |
mov_read_default(mov, s->pb, (MOVAtom){ AV_RL32("root"), INT64_MAX }) < 0 || |
2418 | 2418 |
url_feof(s->pb)) |
2419 | 2419 |
return AVERROR_EOF; |
... | ... |
@@ -1653,7 +1653,7 @@ static int mov_write_udta_tag(AVIOContext *pb, MOVMuxContext *mov, |
1653 | 1653 |
return 0; |
1654 | 1654 |
} |
1655 | 1655 |
|
1656 |
- ret = url_open_dyn_buf(&pb_buf); |
|
1656 |
+ ret = avio_open_dyn_buf(&pb_buf); |
|
1657 | 1657 |
if(ret < 0) |
1658 | 1658 |
return ret; |
1659 | 1659 |
|
... | ... |
@@ -1684,7 +1684,7 @@ static int mov_write_udta_tag(AVIOContext *pb, MOVMuxContext *mov, |
1684 | 1684 |
if (s->nb_chapters) |
1685 | 1685 |
mov_write_chpl_tag(pb_buf, s); |
1686 | 1686 |
|
1687 |
- if ((size = url_close_dyn_buf(pb_buf, &buf)) > 0) { |
|
1687 |
+ if ((size = avio_close_dyn_buf(pb_buf, &buf)) > 0) { |
|
1688 | 1688 |
avio_wb32(pb, size+8); |
1689 | 1689 |
ffio_wfourcc(pb, "udta"); |
1690 | 1690 |
avio_write(pb, buf, size); |
... | ... |
@@ -1948,7 +1948,7 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt) |
1948 | 1948 |
unsigned int samplesInChunk = 0; |
1949 | 1949 |
int size= pkt->size; |
1950 | 1950 |
|
1951 |
- if (url_is_streamed(s->pb)) return 0; /* Can't handle that */ |
|
1951 |
+ if (!s->pb->seekable) return 0; /* Can't handle that */ |
|
1952 | 1952 |
if (!size) return 0; /* Discard 0 sized packets */ |
1953 | 1953 |
|
1954 | 1954 |
if (enc->codec_id == CODEC_ID_AMR_NB) { |
... | ... |
@@ -2083,7 +2083,7 @@ static int mov_write_header(AVFormatContext *s) |
2083 | 2083 |
MOVMuxContext *mov = s->priv_data; |
2084 | 2084 |
int i, hint_track = 0; |
2085 | 2085 |
|
2086 |
- if (url_is_streamed(s->pb)) { |
|
2086 |
+ if (!s->pb->seekable) { |
|
2087 | 2087 |
av_log(s, AV_LOG_ERROR, "muxer does not support non seekable output\n"); |
2088 | 2088 |
return -1; |
2089 | 2089 |
} |
... | ... |
@@ -23,6 +23,7 @@ |
23 | 23 |
#include "libavutil/intreadwrite.h" |
24 | 24 |
#include "internal.h" |
25 | 25 |
#include "rtpenc_chain.h" |
26 |
+#include "avio_internal.h" |
|
26 | 27 |
|
27 | 28 |
int ff_mov_init_hinting(AVFormatContext *s, int index, int src_index) |
28 | 29 |
{ |
... | ... |
@@ -408,8 +409,8 @@ int ff_mov_add_hinted_packet(AVFormatContext *s, AVPacket *pkt, |
408 | 408 |
|
409 | 409 |
/* Fetch the output from the RTP muxer, open a new output buffer |
410 | 410 |
* for next time. */ |
411 |
- size = url_close_dyn_buf(rtp_ctx->pb, &buf); |
|
412 |
- if ((ret = url_open_dyn_packet_buf(&rtp_ctx->pb, |
|
411 |
+ size = avio_close_dyn_buf(rtp_ctx->pb, &buf); |
|
412 |
+ if ((ret = ffio_open_dyn_packet_buf(&rtp_ctx->pb, |
|
413 | 413 |
RTP_MAX_PACKET_SIZE)) < 0) |
414 | 414 |
goto done; |
415 | 415 |
|
... | ... |
@@ -417,14 +418,14 @@ int ff_mov_add_hinted_packet(AVFormatContext *s, AVPacket *pkt, |
417 | 417 |
goto done; |
418 | 418 |
|
419 | 419 |
/* Open a buffer for writing the hint */ |
420 |
- if ((ret = url_open_dyn_buf(&hintbuf)) < 0) |
|
420 |
+ if ((ret = avio_open_dyn_buf(&hintbuf)) < 0) |
|
421 | 421 |
goto done; |
422 | 422 |
av_init_packet(&hint_pkt); |
423 | 423 |
count = write_hint_packets(hintbuf, buf, size, trk, &hint_pkt.dts); |
424 | 424 |
av_freep(&buf); |
425 | 425 |
|
426 | 426 |
/* Write the hint data into the hint track */ |
427 |
- hint_pkt.size = size = url_close_dyn_buf(hintbuf, &buf); |
|
427 |
+ hint_pkt.size = size = avio_close_dyn_buf(hintbuf, &buf); |
|
428 | 428 |
hint_pkt.data = buf; |
429 | 429 |
hint_pkt.pts = hint_pkt.dts; |
430 | 430 |
hint_pkt.stream_index = track_index; |
... | ... |
@@ -448,7 +449,7 @@ void ff_mov_close_hinting(MOVTrack *track) { |
448 | 448 |
return; |
449 | 449 |
if (rtp_ctx->pb) { |
450 | 450 |
av_write_trailer(rtp_ctx); |
451 |
- url_close_dyn_buf(rtp_ctx->pb, &ptr); |
|
451 |
+ avio_close_dyn_buf(rtp_ctx->pb, &ptr); |
|
452 | 452 |
av_free(ptr); |
453 | 453 |
} |
454 | 454 |
avformat_free_context(rtp_ctx); |
... | ... |
@@ -96,7 +96,7 @@ static int id3v2_put_ttag(AVFormatContext *s, const char *str1, const char *str2 |
96 | 96 |
uint8_t *pb; |
97 | 97 |
int (*put)(AVIOContext*, const char*); |
98 | 98 |
AVIOContext *dyn_buf; |
99 |
- if (url_open_dyn_buf(&dyn_buf) < 0) |
|
99 |
+ if (avio_open_dyn_buf(&dyn_buf) < 0) |
|
100 | 100 |
return AVERROR(ENOMEM); |
101 | 101 |
|
102 | 102 |
/* check if the strings are ASCII-only and use UTF16 only if |
... | ... |
@@ -115,7 +115,7 @@ static int id3v2_put_ttag(AVFormatContext *s, const char *str1, const char *str2 |
115 | 115 |
put(dyn_buf, str1); |
116 | 116 |
if (str2) |
117 | 117 |
put(dyn_buf, str2); |
118 |
- len = url_close_dyn_buf(dyn_buf, &pb); |
|
118 |
+ len = avio_close_dyn_buf(dyn_buf, &pb); |
|
119 | 119 |
|
120 | 120 |
avio_wb32(s->pb, tag); |
121 | 121 |
id3v2_put_size(s, len); |
... | ... |
@@ -93,7 +93,7 @@ static int mpc_read_header(AVFormatContext *s, AVFormatParameters *ap) |
93 | 93 |
st->duration = c->fcount; |
94 | 94 |
|
95 | 95 |
/* try to read APE tags */ |
96 |
- if (!url_is_streamed(s->pb)) { |
|
96 |
+ if (s->pb->seekable) { |
|
97 | 97 |
int64_t pos = avio_tell(s->pb); |
98 | 98 |
ff_ape_parse_tag(s); |
99 | 99 |
if (!av_metadata_get(s->metadata, "", NULL, AV_METADATA_IGNORE_SUFFIX)) |
... | ... |
@@ -403,7 +403,7 @@ static int mpegps_read_pes_header(AVFormatContext *s, |
403 | 403 |
int i; |
404 | 404 |
for(i=0; i<s->nb_streams; i++){ |
405 | 405 |
if(startcode == s->streams[i]->id && |
406 |
- !url_is_streamed(s->pb) /* index useless on streams anyway */) { |
|
406 |
+ s->pb->seekable /* index useless on streams anyway */) { |
|
407 | 407 |
ff_reduce_index(s, i); |
408 | 408 |
av_add_index_entry(s->streams[i], *ppos, dts, 0, 0, AVINDEX_KEYFRAME /* FIXME keyframe? */); |
409 | 409 |
} |
... | ... |
@@ -1784,7 +1784,7 @@ static int mxf_write_footer(AVFormatContext *s) |
1784 | 1784 |
mxf_write_klv_fill(s); |
1785 | 1785 |
mxf_write_random_index_pack(s); |
1786 | 1786 |
|
1787 |
- if (!url_is_streamed(s->pb)) { |
|
1787 |
+ if (s->pb->seekable) { |
|
1788 | 1788 |
avio_seek(pb, 0, SEEK_SET); |
1789 | 1789 |
if (mxf->edit_unit_byte_count) { |
1790 | 1790 |
mxf_write_partition(s, 1, 2, header_closed_partition_key, 1); |
... | ... |
@@ -653,7 +653,7 @@ static int nut_read_header(AVFormatContext *s, AVFormatParameters *ap) |
653 | 653 |
|
654 | 654 |
s->data_offset= pos-8; |
655 | 655 |
|
656 |
- if(!url_is_streamed(bc)){ |
|
656 |
+ if(bc->seekable){ |
|
657 | 657 |
int64_t orig_pos= avio_tell(bc); |
658 | 658 |
find_and_decode_index(nut); |
659 | 659 |
avio_seek(bc, orig_pos, SEEK_SET); |
... | ... |
@@ -281,7 +281,7 @@ static inline void put_s_trace(AVIOContext *bc, int64_t v, char *file, char *fun |
281 | 281 |
//FIXME remove calculate_checksum |
282 | 282 |
static void put_packet(NUTContext *nut, AVIOContext *bc, AVIOContext *dyn_bc, int calculate_checksum, uint64_t startcode){ |
283 | 283 |
uint8_t *dyn_buf=NULL; |
284 |
- int dyn_size= url_close_dyn_buf(dyn_bc, &dyn_buf); |
|
284 |
+ int dyn_size= avio_close_dyn_buf(dyn_bc, &dyn_buf); |
|
285 | 285 |
int forw_ptr= dyn_size + 4*calculate_checksum; |
286 | 286 |
|
287 | 287 |
if(forw_ptr > 4096) |
... | ... |
@@ -436,7 +436,7 @@ static int write_globalinfo(NUTContext *nut, AVIOContext *bc){ |
436 | 436 |
AVIOContext *dyn_bc; |
437 | 437 |
uint8_t *dyn_buf=NULL; |
438 | 438 |
int count=0, dyn_size; |
439 |
- int ret = url_open_dyn_buf(&dyn_bc); |
|
439 |
+ int ret = avio_open_dyn_buf(&dyn_bc); |
|
440 | 440 |
if(ret < 0) |
441 | 441 |
return ret; |
442 | 442 |
|
... | ... |
@@ -450,7 +450,7 @@ static int write_globalinfo(NUTContext *nut, AVIOContext *bc){ |
450 | 450 |
|
451 | 451 |
ff_put_v(bc, count); |
452 | 452 |
|
453 |
- dyn_size= url_close_dyn_buf(dyn_bc, &dyn_buf); |
|
453 |
+ dyn_size= avio_close_dyn_buf(dyn_bc, &dyn_buf); |
|
454 | 454 |
avio_write(bc, dyn_buf, dyn_size); |
455 | 455 |
av_free(dyn_buf); |
456 | 456 |
return 0; |
... | ... |
@@ -462,7 +462,7 @@ static int write_streaminfo(NUTContext *nut, AVIOContext *bc, int stream_id){ |
462 | 462 |
AVIOContext *dyn_bc; |
463 | 463 |
uint8_t *dyn_buf=NULL; |
464 | 464 |
int count=0, dyn_size, i; |
465 |
- int ret = url_open_dyn_buf(&dyn_bc); |
|
465 |
+ int ret = avio_open_dyn_buf(&dyn_bc); |
|
466 | 466 |
if(ret < 0) |
467 | 467 |
return ret; |
468 | 468 |
|
... | ... |
@@ -470,7 +470,7 @@ static int write_streaminfo(NUTContext *nut, AVIOContext *bc, int stream_id){ |
470 | 470 |
if (st->disposition & ff_nut_dispositions[i].flag) |
471 | 471 |
count += add_info(dyn_bc, "Disposition", ff_nut_dispositions[i].str); |
472 | 472 |
} |
473 |
- dyn_size = url_close_dyn_buf(dyn_bc, &dyn_buf); |
|
473 |
+ dyn_size = avio_close_dyn_buf(dyn_bc, &dyn_buf); |
|
474 | 474 |
|
475 | 475 |
if (count) { |
476 | 476 |
ff_put_v(bc, stream_id + 1); //stream_id_plus1 |
... | ... |
@@ -495,7 +495,7 @@ static int write_chapter(NUTContext *nut, AVIOContext *bc, int id) |
495 | 495 |
AVChapter *ch = nut->avf->chapters[id]; |
496 | 496 |
int ret, dyn_size, count = 0; |
497 | 497 |
|
498 |
- ret = url_open_dyn_buf(&dyn_bc); |
|
498 |
+ ret = avio_open_dyn_buf(&dyn_bc); |
|
499 | 499 |
if (ret < 0) |
500 | 500 |
return ret; |
501 | 501 |
|
... | ... |
@@ -509,7 +509,7 @@ static int write_chapter(NUTContext *nut, AVIOContext *bc, int id) |
509 | 509 |
|
510 | 510 |
ff_put_v(bc, count); |
511 | 511 |
|
512 |
- dyn_size = url_close_dyn_buf(dyn_bc, &dyn_buf); |
|
512 |
+ dyn_size = avio_close_dyn_buf(dyn_bc, &dyn_buf); |
|
513 | 513 |
avio_write(bc, dyn_buf, dyn_size); |
514 | 514 |
av_freep(&dyn_buf); |
515 | 515 |
return 0; |
... | ... |
@@ -522,14 +522,14 @@ static int write_headers(AVFormatContext *avctx, AVIOContext *bc){ |
522 | 522 |
|
523 | 523 |
ff_metadata_conv_ctx(avctx, ff_nut_metadata_conv, NULL); |
524 | 524 |
|
525 |
- ret = url_open_dyn_buf(&dyn_bc); |
|
525 |
+ ret = avio_open_dyn_buf(&dyn_bc); |
|
526 | 526 |
if(ret < 0) |
527 | 527 |
return ret; |
528 | 528 |
write_mainheader(nut, dyn_bc); |
529 | 529 |
put_packet(nut, bc, dyn_bc, 1, MAIN_STARTCODE); |
530 | 530 |
|
531 | 531 |
for (i=0; i < nut->avf->nb_streams; i++){ |
532 |
- ret = url_open_dyn_buf(&dyn_bc); |
|
532 |
+ ret = avio_open_dyn_buf(&dyn_bc); |
|
533 | 533 |
if(ret < 0) |
534 | 534 |
return ret; |
535 | 535 |
if ((ret = write_streamheader(avctx, dyn_bc, nut->avf->streams[i], i)) < 0) |
... | ... |
@@ -537,14 +537,14 @@ static int write_headers(AVFormatContext *avctx, AVIOContext *bc){ |
537 | 537 |
put_packet(nut, bc, dyn_bc, 1, STREAM_STARTCODE); |
538 | 538 |
} |
539 | 539 |
|
540 |
- ret = url_open_dyn_buf(&dyn_bc); |
|
540 |
+ ret = avio_open_dyn_buf(&dyn_bc); |
|
541 | 541 |
if(ret < 0) |
542 | 542 |
return ret; |
543 | 543 |
write_globalinfo(nut, dyn_bc); |
544 | 544 |
put_packet(nut, bc, dyn_bc, 1, INFO_STARTCODE); |
545 | 545 |
|
546 | 546 |
for (i = 0; i < nut->avf->nb_streams; i++) { |
547 |
- ret = url_open_dyn_buf(&dyn_bc); |
|
547 |
+ ret = avio_open_dyn_buf(&dyn_bc); |
|
548 | 548 |
if(ret < 0) |
549 | 549 |
return ret; |
550 | 550 |
ret = write_streaminfo(nut, dyn_bc, i); |
... | ... |
@@ -554,19 +554,19 @@ static int write_headers(AVFormatContext *avctx, AVIOContext *bc){ |
554 | 554 |
put_packet(nut, bc, dyn_bc, 1, INFO_STARTCODE); |
555 | 555 |
else { |
556 | 556 |
uint8_t* buf; |
557 |
- url_close_dyn_buf(dyn_bc, &buf); |
|
557 |
+ avio_close_dyn_buf(dyn_bc, &buf); |
|
558 | 558 |
av_free(buf); |
559 | 559 |
} |
560 | 560 |
} |
561 | 561 |
|
562 | 562 |
for (i = 0; i < nut->avf->nb_chapters; i++) { |
563 |
- ret = url_open_dyn_buf(&dyn_bc); |
|
563 |
+ ret = avio_open_dyn_buf(&dyn_bc); |
|
564 | 564 |
if (ret < 0) |
565 | 565 |
return ret; |
566 | 566 |
ret = write_chapter(nut, dyn_bc, i); |
567 | 567 |
if (ret < 0) { |
568 | 568 |
uint8_t *buf; |
569 |
- url_close_dyn_buf(dyn_bc, &buf); |
|
569 |
+ avio_close_dyn_buf(dyn_bc, &buf); |
|
570 | 570 |
av_freep(&buf); |
571 | 571 |
return ret; |
572 | 572 |
} |
... | ... |
@@ -728,7 +728,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt){ |
728 | 728 |
NULL); |
729 | 729 |
|
730 | 730 |
nut->last_syncpoint_pos= avio_tell(bc); |
731 |
- ret = url_open_dyn_buf(&dyn_bc); |
|
731 |
+ ret = avio_open_dyn_buf(&dyn_bc); |
|
732 | 732 |
if(ret < 0) |
733 | 733 |
return ret; |
734 | 734 |
put_tt(nut, nus->time_base, dyn_bc, pkt->dts); |
... | ... |
@@ -82,7 +82,7 @@ static int ogg_write_page(AVFormatContext *s, OGGPage *page, int extra_flags) |
82 | 82 |
int ret, size; |
83 | 83 |
uint8_t *buf; |
84 | 84 |
|
85 |
- ret = url_open_dyn_buf(&pb); |
|
85 |
+ ret = avio_open_dyn_buf(&pb); |
|
86 | 86 |
if (ret < 0) |
87 | 87 |
return ret; |
88 | 88 |
ffio_init_checksum(pb, ff_crc04C11DB7_update, 0); |
... | ... |
@@ -101,7 +101,7 @@ static int ogg_write_page(AVFormatContext *s, OGGPage *page, int extra_flags) |
101 | 101 |
ogg_update_checksum(s, pb, crc_offset); |
102 | 102 |
avio_flush(pb); |
103 | 103 |
|
104 |
- size = url_close_dyn_buf(pb, &buf); |
|
104 |
+ size = avio_close_dyn_buf(pb, &buf); |
|
105 | 105 |
if (size < 0) |
106 | 106 |
return size; |
107 | 107 |
|
... | ... |
@@ -177,7 +177,7 @@ static int r3d_read_header(AVFormatContext *s, AVFormatParameters *ap) |
177 | 177 |
|
178 | 178 |
s->data_offset = avio_tell(s->pb); |
179 | 179 |
av_dlog(s, "data offset %#llx\n", s->data_offset); |
180 |
- if (url_is_streamed(s->pb)) |
|
180 |
+ if (!s->pb->seekable) |
|
181 | 181 |
return 0; |
182 | 182 |
// find REOB/REOF/REOS to load index |
183 | 183 |
avio_seek(s->pb, avio_size(s->pb)-48-8, SEEK_SET); |
... | ... |
@@ -481,7 +481,7 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap) |
481 | 481 |
|
482 | 482 |
if (!data_off) |
483 | 483 |
data_off = avio_tell(pb) - 18; |
484 |
- if (indx_off && !url_is_streamed(pb) && !(s->flags & AVFMT_FLAG_IGNIDX) && |
|
484 |
+ if (indx_off && pb->seekable && !(s->flags & AVFMT_FLAG_IGNIDX) && |
|
485 | 485 |
avio_seek(pb, indx_off, SEEK_SET) >= 0) { |
486 | 486 |
rm_read_index(s); |
487 | 487 |
avio_seek(pb, data_off + 18, SEEK_SET); |
... | ... |
@@ -118,7 +118,7 @@ static int rv10_write_header(AVFormatContext *ctx, |
118 | 118 |
avio_wb32(s, 0); /* data offset : will be patched after */ |
119 | 119 |
avio_wb16(s, ctx->nb_streams); /* num streams */ |
120 | 120 |
flags = 1 | 2; /* save allowed & perfect play */ |
121 |
- if (url_is_streamed(s)) |
|
121 |
+ if (!s->seekable) |
|
122 | 122 |
flags |= 4; /* live broadcast */ |
123 | 123 |
avio_wb16(s, flags); |
124 | 124 |
|
... | ... |
@@ -170,7 +170,7 @@ static int rv10_write_header(AVFormatContext *ctx, |
170 | 170 |
avio_wb32(s, 0); /* start time */ |
171 | 171 |
avio_wb32(s, BUFFER_DURATION); /* preroll */ |
172 | 172 |
/* duration */ |
173 |
- if (url_is_streamed(s) || !stream->total_frames) |
|
173 |
+ if (!s->seekable || !stream->total_frames) |
|
174 | 174 |
avio_wb32(s, (int)(3600 * 1000)); |
175 | 175 |
else |
176 | 176 |
avio_wb32(s, (int)(stream->total_frames * 1000 / stream->frame_rate)); |
... | ... |
@@ -434,7 +434,7 @@ static int rm_write_trailer(AVFormatContext *s) |
434 | 434 |
int data_size, index_pos, i; |
435 | 435 |
AVIOContext *pb = s->pb; |
436 | 436 |
|
437 |
- if (!url_is_streamed(s->pb)) { |
|
437 |
+ if (s->pb->seekable) { |
|
438 | 438 |
/* end of file: finish to write header */ |
439 | 439 |
index_pos = avio_tell(pb); |
440 | 440 |
data_size = index_pos - rm->data_pos; |
... | ... |
@@ -38,7 +38,7 @@ static int rso_write_header(AVFormatContext *s) |
38 | 38 |
return AVERROR_INVALIDDATA; |
39 | 39 |
} |
40 | 40 |
|
41 |
- if (url_is_streamed(s->pb)) { |
|
41 |
+ if (!s->pb->seekable) { |
|
42 | 42 |
av_log(s, AV_LOG_ERROR, "muxer does not support non seekable output\n"); |
43 | 43 |
return AVERROR_INVALIDDATA; |
44 | 44 |
} |
... | ... |
@@ -41,7 +41,7 @@ |
41 | 41 |
buffer to 'rtp_write_packet' contains all the packets for ONE |
42 | 42 |
frame. Each packet should have a four byte header containing |
43 | 43 |
the length in big endian format (same trick as |
44 |
- 'url_open_dyn_packet_buf') |
|
44 |
+ 'ffio_open_dyn_packet_buf') |
|
45 | 45 |
*/ |
46 | 46 |
|
47 | 47 |
static RTPDynamicProtocolHandler ff_realmedia_mp3_dynamic_handler = { |
... | ... |
@@ -264,7 +264,7 @@ int rtp_check_and_send_back_rr(RTPDemuxContext *s, int count) |
264 | 264 |
return -1; |
265 | 265 |
s->last_octet_count = s->octet_count; |
266 | 266 |
|
267 |
- if (url_open_dyn_buf(&pb) < 0) |
|
267 |
+ if (avio_open_dyn_buf(&pb) < 0) |
|
268 | 268 |
return -1; |
269 | 269 |
|
270 | 270 |
// Receiver Report |
... | ... |
@@ -321,7 +321,7 @@ int rtp_check_and_send_back_rr(RTPDemuxContext *s, int count) |
321 | 321 |
} |
322 | 322 |
|
323 | 323 |
avio_flush(pb); |
324 |
- len = url_close_dyn_buf(pb, &buf); |
|
324 |
+ len = avio_close_dyn_buf(pb, &buf); |
|
325 | 325 |
if ((len > 0) && buf) { |
326 | 326 |
int result; |
327 | 327 |
av_dlog(s->ic, "sending %d bytes of RR\n", len); |
... | ... |
@@ -339,7 +339,7 @@ void rtp_send_punch_packets(URLContext* rtp_handle) |
339 | 339 |
int len; |
340 | 340 |
|
341 | 341 |
/* Send a small RTP packet */ |
342 |
- if (url_open_dyn_buf(&pb) < 0) |
|
342 |
+ if (avio_open_dyn_buf(&pb) < 0) |
|
343 | 343 |
return; |
344 | 344 |
|
345 | 345 |
avio_w8(pb, (RTP_VERSION << 6)); |
... | ... |
@@ -349,13 +349,13 @@ void rtp_send_punch_packets(URLContext* rtp_handle) |
349 | 349 |
avio_wb32(pb, 0); /* SSRC */ |
350 | 350 |
|
351 | 351 |
avio_flush(pb); |
352 |
- len = url_close_dyn_buf(pb, &buf); |
|
352 |
+ len = avio_close_dyn_buf(pb, &buf); |
|
353 | 353 |
if ((len > 0) && buf) |
354 | 354 |
url_write(rtp_handle, buf, len); |
355 | 355 |
av_free(buf); |
356 | 356 |
|
357 | 357 |
/* Send a minimal RTCP RR */ |
358 |
- if (url_open_dyn_buf(&pb) < 0) |
|
358 |
+ if (avio_open_dyn_buf(&pb) < 0) |
|
359 | 359 |
return; |
360 | 360 |
|
361 | 361 |
avio_w8(pb, (RTP_VERSION << 6)); |
... | ... |
@@ -364,7 +364,7 @@ void rtp_send_punch_packets(URLContext* rtp_handle) |
364 | 364 |
avio_wb32(pb, 0); /* our own SSRC */ |
365 | 365 |
|
366 | 366 |
avio_flush(pb); |
367 |
- len = url_close_dyn_buf(pb, &buf); |
|
367 |
+ len = avio_close_dyn_buf(pb, &buf); |
|
368 | 368 |
if ((len > 0) && buf) |
369 | 369 |
url_write(rtp_handle, buf, len); |
370 | 370 |
av_free(buf); |
... | ... |
@@ -203,12 +203,12 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf, |
203 | 203 |
*/ |
204 | 204 |
if (asf->pktbuf && len_off != avio_tell(asf->pktbuf)) { |
205 | 205 |
uint8_t *p; |
206 |
- url_close_dyn_buf(asf->pktbuf, &p); |
|
206 |
+ avio_close_dyn_buf(asf->pktbuf, &p); |
|
207 | 207 |
asf->pktbuf = NULL; |
208 | 208 |
av_free(p); |
209 | 209 |
} |
210 | 210 |
if (!len_off && !asf->pktbuf && |
211 |
- (res = url_open_dyn_buf(&asf->pktbuf)) < 0) |
|
211 |
+ (res = avio_open_dyn_buf(&asf->pktbuf)) < 0) |
|
212 | 212 |
return res; |
213 | 213 |
if (!asf->pktbuf) |
214 | 214 |
return AVERROR(EIO); |
... | ... |
@@ -217,7 +217,7 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf, |
217 | 217 |
avio_skip(pb, len - off); |
218 | 218 |
if (!(flags & RTP_FLAG_MARKER)) |
219 | 219 |
return -1; |
220 |
- out_len = url_close_dyn_buf(asf->pktbuf, &asf->buf); |
|
220 |
+ out_len = avio_close_dyn_buf(asf->pktbuf, &asf->buf); |
|
221 | 221 |
asf->pktbuf = NULL; |
222 | 222 |
} else { |
223 | 223 |
/** |
... | ... |
@@ -272,7 +272,7 @@ static void asfrtp_free_context(PayloadContext *asf) |
272 | 272 |
{ |
273 | 273 |
if (asf->pktbuf) { |
274 | 274 |
uint8_t *p = NULL; |
275 |
- url_close_dyn_buf(asf->pktbuf, &p); |
|
275 |
+ avio_close_dyn_buf(asf->pktbuf, &p); |
|
276 | 276 |
asf->pktbuf = NULL; |
277 | 277 |
av_free(p); |
278 | 278 |
} |
... | ... |
@@ -43,7 +43,7 @@ static void latm_free_context(PayloadContext *data) |
43 | 43 |
return; |
44 | 44 |
if (data->dyn_buf) { |
45 | 45 |
uint8_t *p; |
46 |
- url_close_dyn_buf(data->dyn_buf, &p); |
|
46 |
+ avio_close_dyn_buf(data->dyn_buf, &p); |
|
47 | 47 |
av_free(p); |
48 | 48 |
} |
49 | 49 |
av_free(data->buf); |
... | ... |
@@ -60,12 +60,12 @@ static int latm_parse_packet(AVFormatContext *ctx, PayloadContext *data, |
60 | 60 |
if (!data->dyn_buf || data->timestamp != *timestamp) { |
61 | 61 |
av_freep(&data->buf); |
62 | 62 |
if (data->dyn_buf) |
63 |
- url_close_dyn_buf(data->dyn_buf, &data->buf); |
|
63 |
+ avio_close_dyn_buf(data->dyn_buf, &data->buf); |
|
64 | 64 |
data->dyn_buf = NULL; |
65 | 65 |
av_freep(&data->buf); |
66 | 66 |
|
67 | 67 |
data->timestamp = *timestamp; |
68 |
- if ((ret = url_open_dyn_buf(&data->dyn_buf)) < 0) |
|
68 |
+ if ((ret = avio_open_dyn_buf(&data->dyn_buf)) < 0) |
|
69 | 69 |
return ret; |
70 | 70 |
} |
71 | 71 |
avio_write(data->dyn_buf, buf, len); |
... | ... |
@@ -73,7 +73,7 @@ static int latm_parse_packet(AVFormatContext *ctx, PayloadContext *data, |
73 | 73 |
if (!(flags & RTP_FLAG_MARKER)) |
74 | 74 |
return AVERROR(EAGAIN); |
75 | 75 |
av_free(data->buf); |
76 |
- data->len = url_close_dyn_buf(data->dyn_buf, &data->buf); |
|
76 |
+ data->len = avio_close_dyn_buf(data->dyn_buf, &data->buf); |
|
77 | 77 |
data->dyn_buf = NULL; |
78 | 78 |
data->pos = 0; |
79 | 79 |
} |
... | ... |
@@ -83,10 +83,10 @@ static int svq3_parse_packet (AVFormatContext *s, PayloadContext *sv, |
83 | 83 |
|
84 | 84 |
if (sv->pktbuf) { |
85 | 85 |
uint8_t *tmp; |
86 |
- url_close_dyn_buf(sv->pktbuf, &tmp); |
|
86 |
+ avio_close_dyn_buf(sv->pktbuf, &tmp); |
|
87 | 87 |
av_free(tmp); |
88 | 88 |
} |
89 |
- if ((res = url_open_dyn_buf(&sv->pktbuf)) < 0) |
|
89 |
+ if ((res = avio_open_dyn_buf(&sv->pktbuf)) < 0) |
|
90 | 90 |
return res; |
91 | 91 |
sv->timestamp = *timestamp; |
92 | 92 |
} |
... | ... |
@@ -100,7 +100,7 @@ static int svq3_parse_packet (AVFormatContext *s, PayloadContext *sv, |
100 | 100 |
av_init_packet(pkt); |
101 | 101 |
pkt->stream_index = st->index; |
102 | 102 |
*timestamp = sv->timestamp; |
103 |
- pkt->size = url_close_dyn_buf(sv->pktbuf, &pkt->data); |
|
103 |
+ pkt->size = avio_close_dyn_buf(sv->pktbuf, &pkt->data); |
|
104 | 104 |
pkt->destruct = av_destruct_packet; |
105 | 105 |
sv->pktbuf = NULL; |
106 | 106 |
return 0; |
... | ... |
@@ -118,7 +118,7 @@ static void svq3_extradata_free(PayloadContext *sv) |
118 | 118 |
{ |
119 | 119 |
if (sv->pktbuf) { |
120 | 120 |
uint8_t *buf; |
121 |
- url_close_dyn_buf(sv->pktbuf, &buf); |
|
121 |
+ avio_close_dyn_buf(sv->pktbuf, &buf); |
|
122 | 122 |
av_free(buf); |
123 | 123 |
} |
124 | 124 |
av_free(sv); |
... | ... |
@@ -41,7 +41,7 @@ static void prepare_packet(AVPacket *pkt, PayloadContext *vp8, int stream) |
41 | 41 |
av_init_packet(pkt); |
42 | 42 |
pkt->stream_index = stream; |
43 | 43 |
pkt->flags = vp8->is_keyframe ? AV_PKT_FLAG_KEY : 0; |
44 |
- pkt->size = url_close_dyn_buf(vp8->data, &pkt->data); |
|
44 |
+ pkt->size = avio_close_dyn_buf(vp8->data, &pkt->data); |
|
45 | 45 |
pkt->destruct = av_destruct_packet; |
46 | 46 |
vp8->data = NULL; |
47 | 47 |
} |
... | ... |
@@ -85,7 +85,7 @@ static int vp8_handle_packet(AVFormatContext *ctx, |
85 | 85 |
// that for the next av_get_packet call |
86 | 86 |
ret = end_packet ? 1 : 0; |
87 | 87 |
} |
88 |
- if ((res = url_open_dyn_buf(&vp8->data)) < 0) |
|
88 |
+ if ((res = avio_open_dyn_buf(&vp8->data)) < 0) |
|
89 | 89 |
return res; |
90 | 90 |
vp8->is_keyframe = *buf & 1; |
91 | 91 |
vp8->timestamp = ts; |
... | ... |
@@ -138,7 +138,7 @@ static void vp8_free_context(PayloadContext *vp8) |
138 | 138 |
{ |
139 | 139 |
if (vp8->data) { |
140 | 140 |
uint8_t *tmp; |
141 |
- url_close_dyn_buf(vp8->data, &tmp); |
|
141 |
+ avio_close_dyn_buf(vp8->data, &tmp); |
|
142 | 142 |
av_free(tmp); |
143 | 143 |
} |
144 | 144 |
av_free(vp8); |
... | ... |
@@ -57,7 +57,7 @@ static inline void free_fragment_if_needed(PayloadContext * data) |
57 | 57 |
{ |
58 | 58 |
if (data->fragment) { |
59 | 59 |
uint8_t* p; |
60 |
- url_close_dyn_buf(data->fragment, &p); |
|
60 |
+ avio_close_dyn_buf(data->fragment, &p); |
|
61 | 61 |
av_free(p); |
62 | 62 |
data->fragment = NULL; |
63 | 63 |
} |
... | ... |
@@ -176,7 +176,7 @@ static int xiph_handle_packet(AVFormatContext * ctx, |
176 | 176 |
// end packet has been lost somewhere, so drop buffered data |
177 | 177 |
free_fragment_if_needed(data); |
178 | 178 |
|
179 |
- if((res = url_open_dyn_buf(&data->fragment)) < 0) |
|
179 |
+ if((res = avio_open_dyn_buf(&data->fragment)) < 0) |
|
180 | 180 |
return res; |
181 | 181 |
|
182 | 182 |
avio_write(data->fragment, buf, pkt_len); |
... | ... |
@@ -203,7 +203,7 @@ static int xiph_handle_packet(AVFormatContext * ctx, |
203 | 203 |
if (fragmented == 3) { |
204 | 204 |
// end of xiph data packet |
205 | 205 |
av_init_packet(pkt); |
206 |
- pkt->size = url_close_dyn_buf(data->fragment, &pkt->data); |
|
206 |
+ pkt->size = avio_close_dyn_buf(data->fragment, &pkt->data); |
|
207 | 207 |
|
208 | 208 |
if (pkt->size < 0) { |
209 | 209 |
av_log(ctx, AV_LOG_ERROR, |
... | ... |
@@ -20,7 +20,9 @@ |
20 | 20 |
*/ |
21 | 21 |
|
22 | 22 |
#include "avformat.h" |
23 |
+#include "avio_internal.h" |
|
23 | 24 |
#include "rtpenc_chain.h" |
25 |
+#include "avio_internal.h" |
|
24 | 26 |
|
25 | 27 |
AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st, |
26 | 28 |
URLContext *handle, int packet_size) |
... | ... |
@@ -53,9 +55,9 @@ AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st, |
53 | 53 |
avcodec_copy_context(rtpctx->streams[0]->codec, st->codec); |
54 | 54 |
|
55 | 55 |
if (handle) { |
56 |
- url_fdopen(&rtpctx->pb, handle); |
|
56 |
+ ffio_fdopen(&rtpctx->pb, handle); |
|
57 | 57 |
} else |
58 |
- url_open_dyn_packet_buf(&rtpctx->pb, packet_size); |
|
58 |
+ ffio_open_dyn_packet_buf(&rtpctx->pb, packet_size); |
|
59 | 59 |
ret = av_write_header(rtpctx); |
60 | 60 |
|
61 | 61 |
if (ret) { |
... | ... |
@@ -63,7 +65,7 @@ AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st, |
63 | 63 |
avio_close(rtpctx->pb); |
64 | 64 |
} else { |
65 | 65 |
uint8_t *ptr; |
66 |
- url_close_dyn_buf(rtpctx->pb, &ptr); |
|
66 |
+ avio_close_dyn_buf(rtpctx->pb, &ptr); |
|
67 | 67 |
av_free(ptr); |
68 | 68 |
} |
69 | 69 |
avformat_free_context(rtpctx); |
... | ... |
@@ -495,7 +495,7 @@ void ff_rtsp_undo_setup(AVFormatContext *s) |
495 | 495 |
av_write_trailer(rtpctx); |
496 | 496 |
if (rt->lower_transport == RTSP_LOWER_TRANSPORT_TCP) { |
497 | 497 |
uint8_t *ptr; |
498 |
- url_close_dyn_buf(rtpctx->pb, &ptr); |
|
498 |
+ avio_close_dyn_buf(rtpctx->pb, &ptr); |
|
499 | 499 |
av_free(ptr); |
500 | 500 |
} else { |
501 | 501 |
avio_close(rtpctx->pb); |
... | ... |
@@ -29,6 +29,7 @@ |
29 | 29 |
#include "os_support.h" |
30 | 30 |
#include "rtsp.h" |
31 | 31 |
#include "internal.h" |
32 |
+#include "avio_internal.h" |
|
32 | 33 |
#include "libavutil/intreadwrite.h" |
33 | 34 |
#include "libavutil/avstring.h" |
34 | 35 |
|
... | ... |
@@ -135,14 +136,14 @@ static int tcp_write_packet(AVFormatContext *s, RTSPStream *rtsp_st) |
135 | 135 |
int size; |
136 | 136 |
uint8_t *interleave_header, *interleaved_packet; |
137 | 137 |
|
138 |
- size = url_close_dyn_buf(rtpctx->pb, &buf); |
|
138 |
+ size = avio_close_dyn_buf(rtpctx->pb, &buf); |
|
139 | 139 |
ptr = buf; |
140 | 140 |
while (size > 4) { |
141 | 141 |
uint32_t packet_len = AV_RB32(ptr); |
142 | 142 |
int id; |
143 | 143 |
/* The interleaving header is exactly 4 bytes, which happens to be |
144 | 144 |
* the same size as the packet length header from |
145 |
- * url_open_dyn_packet_buf. So by writing the interleaving header |
|
145 |
+ * ffio_open_dyn_packet_buf. So by writing the interleaving header |
|
146 | 146 |
* over these bytes, we get a consecutive interleaved packet |
147 | 147 |
* that can be written in one call. */ |
148 | 148 |
interleaved_packet = interleave_header = ptr; |
... | ... |
@@ -162,7 +163,7 @@ static int tcp_write_packet(AVFormatContext *s, RTSPStream *rtsp_st) |
162 | 162 |
size -= packet_len; |
163 | 163 |
} |
164 | 164 |
av_free(buf); |
165 |
- url_open_dyn_packet_buf(&rtpctx->pb, RTSP_TCP_MAX_PACKET_SIZE); |
|
165 |
+ ffio_open_dyn_packet_buf(&rtpctx->pb, RTSP_TCP_MAX_PACKET_SIZE); |
|
166 | 166 |
return 0; |
167 | 167 |
} |
168 | 168 |
|
... | ... |
@@ -96,7 +96,7 @@ static int sox_write_trailer(AVFormatContext *s) |
96 | 96 |
AVIOContext *pb = s->pb; |
97 | 97 |
AVCodecContext *enc = s->streams[0]->codec; |
98 | 98 |
|
99 |
- if (!url_is_streamed(s->pb)) { |
|
99 |
+ if (s->pb->seekable) { |
|
100 | 100 |
/* update number of samples */ |
101 | 101 |
int64_t file_size = avio_tell(pb); |
102 | 102 |
int64_t num_samples = (file_size - sox->header_size - 4LL) >> 2LL; |
... | ... |
@@ -492,7 +492,7 @@ static int swf_write_trailer(AVFormatContext *s) |
492 | 492 |
avio_flush(s->pb); |
493 | 493 |
|
494 | 494 |
/* patch file size and number of frames if not streamed */ |
495 |
- if (!url_is_streamed(s->pb) && video_enc) { |
|
495 |
+ if (s->pb->seekable && video_enc) { |
|
496 | 496 |
file_size = avio_tell(pb); |
497 | 497 |
avio_seek(pb, 4, SEEK_SET); |
498 | 498 |
avio_wl32(pb, file_size); |
... | ... |
@@ -88,7 +88,7 @@ static int read_header(AVFormatContext *avctx, |
88 | 88 |
/* simulate tty display speed */ |
89 | 89 |
s->chars_per_frame = FFMAX(av_q2d(st->time_base) * (ap->sample_rate ? ap->sample_rate : LINE_RATE), 1); |
90 | 90 |
|
91 |
- if (!url_is_streamed(avctx->pb)) { |
|
91 |
+ if (avctx->pb->seekable) { |
|
92 | 92 |
s->fsize = avio_size(avctx->pb); |
93 | 93 |
st->duration = (s->fsize + s->chars_per_frame - 1) / s->chars_per_frame; |
94 | 94 |
|
... | ... |
@@ -2037,7 +2037,7 @@ static void av_estimate_timings(AVFormatContext *ic, int64_t old_offset) |
2037 | 2037 |
|
2038 | 2038 |
if ((!strcmp(ic->iformat->name, "mpeg") || |
2039 | 2039 |
!strcmp(ic->iformat->name, "mpegts")) && |
2040 |
- file_size && !url_is_streamed(ic->pb)) { |
|
2040 |
+ file_size && ic->pb->seekable) { |
|
2041 | 2041 |
/* get accurate estimate from the PTSes */ |
2042 | 2042 |
av_estimate_timings_from_pts(ic, old_offset); |
2043 | 2043 |
} else if (av_has_duration(ic)) { |
... | ... |
@@ -73,7 +73,7 @@ static int vc1test_write_trailer(AVFormatContext *s) |
73 | 73 |
RCVContext *ctx = s->priv_data; |
74 | 74 |
AVIOContext *pb = s->pb; |
75 | 75 |
|
76 |
- if (!url_is_streamed(s->pb)) { |
|
76 |
+ if (s->pb->seekable) { |
|
77 | 77 |
avio_seek(pb, 0, SEEK_SET); |
78 | 78 |
avio_wl24(pb, ctx->frames); |
79 | 79 |
avio_flush(pb); |
... | ... |
@@ -78,7 +78,7 @@ voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size) |
78 | 78 |
return AVERROR(EIO); |
79 | 79 |
voc->remaining_size = avio_rl24(pb); |
80 | 80 |
if (!voc->remaining_size) { |
81 |
- if (url_is_streamed(s->pb)) |
|
81 |
+ if (!s->pb->seekable) |
|
82 | 82 |
return AVERROR(EIO); |
83 | 83 |
voc->remaining_size = avio_size(pb) - avio_tell(pb); |
84 | 84 |
} |
... | ... |
@@ -57,7 +57,7 @@ static int wav_write_header(AVFormatContext *s) |
57 | 57 |
ff_end_tag(pb, fmt); |
58 | 58 |
|
59 | 59 |
if (s->streams[0]->codec->codec_tag != 0x01 /* hence for all other than PCM */ |
60 |
- && !url_is_streamed(s->pb)) { |
|
60 |
+ && s->pb->seekable) { |
|
61 | 61 |
fact = ff_start_tag(pb, "fact"); |
62 | 62 |
avio_wl32(pb, 0); |
63 | 63 |
ff_end_tag(pb, fact); |
... | ... |
@@ -97,7 +97,7 @@ static int wav_write_trailer(AVFormatContext *s) |
97 | 97 |
|
98 | 98 |
avio_flush(pb); |
99 | 99 |
|
100 |
- if (!url_is_streamed(s->pb)) { |
|
100 |
+ if (s->pb->seekable) { |
|
101 | 101 |
ff_end_tag(pb, wav->data); |
102 | 102 |
|
103 | 103 |
/* update file size */ |
... | ... |
@@ -121,7 +121,7 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int appen |
121 | 121 |
} |
122 | 122 |
if((rate == -1 || !chan) && !wc->block_parsed){ |
123 | 123 |
int64_t block_end = avio_tell(pb) + wc->blksize - 24; |
124 |
- if(url_is_streamed(pb)){ |
|
124 |
+ if(!pb->seekable){ |
|
125 | 125 |
av_log(ctx, AV_LOG_ERROR, "Cannot determine additional parameters\n"); |
126 | 126 |
return -1; |
127 | 127 |
} |
... | ... |
@@ -223,7 +223,7 @@ static int wv_read_header(AVFormatContext *s, |
223 | 223 |
st->start_time = 0; |
224 | 224 |
st->duration = wc->samples; |
225 | 225 |
|
226 |
- if(!url_is_streamed(s->pb)) { |
|
226 |
+ if(s->pb->seekable) { |
|
227 | 227 |
int64_t cur = avio_tell(s->pb); |
228 | 228 |
ff_ape_parse_tag(s); |
229 | 229 |
if(!av_metadata_get(s->metadata, "", NULL, AV_METADATA_IGNORE_SUFFIX)) |