History

Merge remote branch 'qatar/master'

* 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

Michael Niedermayer committed 15 years ago

Commit 2cae9802 parents 3c9bfb3 906fd0374 files · +833 −637Browse files

Unified · Split

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

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t