From b181b8fb96f9fdc2b166fcbd048110cec653cdf9 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Tue, 15 Mar 2011 13:30:24 -0400 Subject: [PATCH 01/34] mathops: convert MULL/MULH/MUL64 to inline functions rather than macros. This fixes unexpected name collisions that were occurring with variables declared within the macros. It also fixes the fate-acodec-ac3_fixed regression test on x86-32. --- libavcodec/x86/mathops.h | 53 ++++++++++++++++++++++++++++------------ 1 file changed, 37 insertions(+), 16 deletions(-) diff --git a/libavcodec/x86/mathops.h b/libavcodec/x86/mathops.h index 5949dfe3d4..4e54886227 100644 --- a/libavcodec/x86/mathops.h +++ b/libavcodec/x86/mathops.h @@ -26,24 +26,45 @@ #include "libavutil/common.h" #if ARCH_X86_32 -#define MULL(ra, rb, shift) \ - ({ int rt, dummy; __asm__ (\ - "imull %3 \n\t"\ - "shrdl %4, %%edx, %%eax \n\t"\ - : "=a"(rt), "=d"(dummy)\ - : "a" ((int)(ra)), "rm" ((int)(rb)), "i"(shift));\ - rt; }) -#define MULH(ra, rb) \ - ({ int rt, dummy;\ - __asm__ ("imull %3\n\t" : "=d"(rt), "=a"(dummy): "a" ((int)(ra)), "rm" ((int)(rb)));\ - rt; }) +#define MULL MULL +static av_always_inline av_const int MULL(int a, int b, unsigned shift) +{ + int rt, dummy; + __asm__ ( + "imull %3 \n\t" + "shrdl %4, %%edx, %%eax \n\t" + :"=a"(rt), "=d"(dummy) + :"a"(a), "rm"(b), "i"(shift) + ); + return rt; +} -#define MUL64(ra, rb) \ - ({ int64_t rt;\ - __asm__ ("imull %2\n\t" : "=A"(rt) : "a" ((int)(ra)), "g" ((int)(rb)));\ - rt; }) -#endif +#define MULH MULH +static av_always_inline av_const int MULH(int a, int b) +{ + int rt, dummy; + __asm__ ( + "imull %3" + :"=d"(rt), "=a"(dummy) + :"a"(a), "rm"(b) + ); + return rt; +} + +#define MUL64 MUL64 +static av_always_inline av_const int64_t MUL64(int a, int b) +{ + int64_t rt; + __asm__ ( + "imull %2" + :"=A"(rt) + :"a"(a), "g"(b) + ); + return rt; +} + +#endif /* ARCH_X86_32 */ #if HAVE_CMOV /* median of 3 */ From aaff3b312ed0a67750aa0a3a3300a3b69bb87150 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Tue, 15 Mar 2011 13:35:05 -0400 Subject: [PATCH 02/34] mathops: change "g" constraint to "rm" in x86-32 version of MUL64(). The 1-arg imul instruction cannot take an immediate argument, only a register or memory argument. --- libavcodec/x86/mathops.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/x86/mathops.h b/libavcodec/x86/mathops.h index 4e54886227..b18302744c 100644 --- a/libavcodec/x86/mathops.h +++ b/libavcodec/x86/mathops.h @@ -59,7 +59,7 @@ static av_always_inline av_const int64_t MUL64(int a, int b) __asm__ ( "imull %2" :"=A"(rt) - :"a"(a), "g"(b) + :"a"(a), "rm"(b) ); return rt; } From 56e2ac6b45ada4f9c107fe7b25f0706ec2e4dc11 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 15 Mar 2011 10:14:16 +0100 Subject: [PATCH 03/34] id3v2: merge TYER/TDAT/TIME to date tag --- libavformat/id3v2.c | 47 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c index 76c7124525..be88d10caa 100644 --- a/libavformat/id3v2.c +++ b/libavformat/id3v2.c @@ -136,6 +136,52 @@ static void read_ttag(AVFormatContext *s, AVIOContext *pb, int taglen, const cha av_metadata_set2(&s->metadata, key, val, AV_METADATA_DONT_OVERWRITE); } +static int is_number(const char *str) +{ + while (*str >= '0' && *str <= '9') str++; + return !*str; +} + +static AVMetadataTag* get_date_tag(AVMetadata *m, const char *tag) +{ + AVMetadataTag *t; + if ((t = av_metadata_get(m, tag, NULL, AV_METADATA_MATCH_CASE)) && + strlen(t->value) == 4 && is_number(t->value)) + return t; + return NULL; +} + +static void merge_date(AVMetadata **m) +{ + AVMetadataTag *t; + char date[17] = {0}; // YYYY-MM-DD hh:mm + + if (!(t = get_date_tag(*m, "TYER")) && + !(t = get_date_tag(*m, "TYE"))) + return; + av_strlcpy(date, t->value, 5); + av_metadata_set2(m, "TYER", NULL, 0); + av_metadata_set2(m, "TYE", NULL, 0); + + if (!(t = get_date_tag(*m, "TDAT")) && + !(t = get_date_tag(*m, "TDA"))) + goto finish; + snprintf(date + 4, sizeof(date) - 4, "-%.2s-%.2s", t->value + 2, t->value); + av_metadata_set2(m, "TDAT", NULL, 0); + av_metadata_set2(m, "TDA", NULL, 0); + + if (!(t = get_date_tag(*m, "TIME")) && + !(t = get_date_tag(*m, "TIM"))) + goto finish; + snprintf(date + 10, sizeof(date) - 10, " %.2s:%.2s", t->value, t->value + 2); + av_metadata_set2(m, "TIME", NULL, 0); + av_metadata_set2(m, "TIM", NULL, 0); + +finish: + if (date[0]) + av_metadata_set2(m, "date", date, 0); +} + static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t flags) { int isv34, tlen, unsync; @@ -277,6 +323,7 @@ void ff_id3v2_read(AVFormatContext *s, const char *magic) ff_metadata_conv(&s->metadata, NULL, ff_id3v2_34_metadata_conv); ff_metadata_conv(&s->metadata, NULL, ff_id3v2_2_metadata_conv); ff_metadata_conv(&s->metadata, NULL, ff_id3v2_4_metadata_conv); + merge_date(&s->metadata); } const AVMetadataConv ff_id3v2_34_metadata_conv[] = { From 79414257e23a0dee82a9978b5444ae8953376221 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Tue, 15 Mar 2011 20:38:23 -0400 Subject: [PATCH 04/34] mathops: fix MULL() when the compiler does not inline the function. If the function is not inlined, an immmediate cannot be used for the shift parameter, so the %cl register must be used instead in that case. This fixes compilation for x86-32 using gcc with --disable-optimizations. --- libavcodec/x86/mathops.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/x86/mathops.h b/libavcodec/x86/mathops.h index b18302744c..33d9a6c8ff 100644 --- a/libavcodec/x86/mathops.h +++ b/libavcodec/x86/mathops.h @@ -35,7 +35,7 @@ static av_always_inline av_const int MULL(int a, int b, unsigned shift) "imull %3 \n\t" "shrdl %4, %%edx, %%eax \n\t" :"=a"(rt), "=d"(dummy) - :"a"(a), "rm"(b), "i"(shift) + :"a"(a), "rm"(b), "ci"((uint8_t)shift) ); return rt; } From 1dac4d554734b16757b36a0adc71642c5ef2c4e6 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 16 Mar 2011 04:46:22 +0000 Subject: [PATCH 05/34] jvdec: don't use deprecated url_feof() --- libavformat/jvdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/jvdec.c b/libavformat/jvdec.c index 9235e51a99..175cd9f33b 100644 --- a/libavformat/jvdec.c +++ b/libavformat/jvdec.c @@ -139,7 +139,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) AVIOContext *pb = s->pb; AVStream *ast = s->streams[0]; - while (!url_feof(s->pb) && jv->pts < ast->nb_index_entries) { + while (!s->pb->eof_reached && jv->pts < ast->nb_index_entries) { const AVIndexEntry *e = ast->index_entries + jv->pts; const JVFrame *jvf = jv->frames + jv->pts; From 8312e3fc9041027a33c8bc667bb99740fdf41dd5 Mon Sep 17 00:00:00 2001 From: Kostya Date: Tue, 15 Mar 2011 09:19:43 +0000 Subject: [PATCH 06/34] Do not attempt to decode APE file with no frames This fixes invalid reads/writes with this sample: http://packetstorm.linuxsecurity.com/1103-exploits/vlc105-dos.txt --- libavformat/ape.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavformat/ape.c b/libavformat/ape.c index 6c269849fd..dd2aeb9ff3 100644 --- a/libavformat/ape.c +++ b/libavformat/ape.c @@ -242,6 +242,10 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap) avio_seek(pb, ape->wavheaderlength, SEEK_CUR); } + if(!ape->totalframes){ + av_log(s, AV_LOG_ERROR, "No frames in the file!\n"); + return AVERROR(EINVAL); + } if(ape->totalframes > UINT_MAX / sizeof(APEFrame)){ av_log(s, AV_LOG_ERROR, "Too many frames: %d\n", ape->totalframes); return -1; From fed5676ffeba2a37e6233e5fef42dc50d6cfeb64 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 16 Mar 2011 14:31:32 +0100 Subject: [PATCH 07/34] mp3enc: remove mp3_write_packet(), use ff_raw_write_packet() instead The two functions are identical, no point in duplicating code here. --- libavformat/Makefile | 4 ++-- libavformat/mp3enc.c | 13 +++---------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/libavformat/Makefile b/libavformat/Makefile index 4eb1620700..c521cd384c 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -131,9 +131,9 @@ OBJS-$(CONFIG_MMF_MUXER) += mmf.o riff.o OBJS-$(CONFIG_MOV_DEMUXER) += mov.o riff.o isom.o OBJS-$(CONFIG_MOV_MUXER) += movenc.o riff.o isom.o avc.o \ movenchint.o rtpenc_chain.o -OBJS-$(CONFIG_MP2_MUXER) += mp3enc.o +OBJS-$(CONFIG_MP2_MUXER) += mp3enc.o rawenc.o OBJS-$(CONFIG_MP3_DEMUXER) += mp3dec.o -OBJS-$(CONFIG_MP3_MUXER) += mp3enc.o +OBJS-$(CONFIG_MP3_MUXER) += mp3enc.o rawenc.o OBJS-$(CONFIG_MPC_DEMUXER) += mpc.o apetag.o OBJS-$(CONFIG_MPC8_DEMUXER) += mpc8.o OBJS-$(CONFIG_MPEG1SYSTEM_MUXER) += mpegenc.o diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c index 27d25f5da9..67ec826589 100644 --- a/libavformat/mp3enc.c +++ b/libavformat/mp3enc.c @@ -23,6 +23,7 @@ #include "avformat.h" #include "id3v1.h" #include "id3v2.h" +#include "rawenc.h" #include "libavutil/intreadwrite.h" #include "libavutil/opt.h" @@ -125,14 +126,6 @@ static int id3v2_put_ttag(AVFormatContext *s, const char *str1, const char *str2 return len + ID3v2_HEADER_SIZE; } - -static int mp3_write_packet(struct AVFormatContext *s, AVPacket *pkt) -{ - avio_write(s->pb, pkt->data, pkt->size); - put_flush_packet(s->pb); - return 0; -} - static int mp3_write_trailer(struct AVFormatContext *s) { uint8_t buf[ID3v1_TAG_SIZE]; @@ -155,7 +148,7 @@ AVOutputFormat ff_mp2_muxer = { CODEC_ID_MP2, CODEC_ID_NONE, NULL, - mp3_write_packet, + ff_raw_write_packet, mp3_write_trailer, }; #endif @@ -254,7 +247,7 @@ AVOutputFormat ff_mp3_muxer = { CODEC_ID_MP3, CODEC_ID_NONE, mp3_write_header, - mp3_write_packet, + ff_raw_write_packet, mp3_write_trailer, AVFMT_NOTIMESTAMPS, .priv_class = &mp3_muxer_class, From 070c5d0f3530c16c92b81f3f0de2943410367c00 Mon Sep 17 00:00:00 2001 From: Janne Grunau Date: Mon, 14 Mar 2011 21:39:58 +0100 Subject: [PATCH 08/34] partially rename FFmpeg to Libav update mailing list references and irc channels in configure --- CREDITS | 2 +- Doxyfile | 2 +- INSTALL | 6 +++--- LICENSE | 20 ++++++++++---------- README | 2 +- configure | 26 +++++++++++++------------- 6 files changed, 29 insertions(+), 29 deletions(-) diff --git a/CREDITS b/CREDITS index 1d0666b6df..4a537786f0 100644 --- a/CREDITS +++ b/CREDITS @@ -1,5 +1,5 @@ This file contains the names of some of the people who have contributed to -FFmpeg. The names are sorted alphabetically by last name. As this file is +Libav/FFmpeg. The names are sorted alphabetically by last name. As this file is currently quite outdated and git serves as a much better tool for determining authorship, it remains here for historical reasons only. diff --git a/Doxyfile b/Doxyfile index 1173836cb1..a7782f1fcf 100644 --- a/Doxyfile +++ b/Doxyfile @@ -25,7 +25,7 @@ DOXYFILE_ENCODING = UTF-8 # The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the project. -PROJECT_NAME = FFmpeg +PROJECT_NAME = Libav # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or diff --git a/INSTALL b/INSTALL index 8cd22bd441..2ed04ef2b9 100644 --- a/INSTALL +++ b/INSTALL @@ -2,10 +2,10 @@ 1) Type './configure' to create the configuration. A list of configure options is printed by running 'configure --help'. -'configure' can be launched from a directory different from the FFmpeg +'configure' can be launched from a directory different from the Libav sources to build the objects out of tree. To do this, use an absolute -path when launching 'configure', e.g. '/ffmpegdir/ffmpeg/configure'. +path when launching 'configure', e.g. '/libavdir/libav/configure'. -2) Then type 'make' to build FFmpeg. GNU Make 3.81 or later is required. +2) Then type 'make' to build Libav. GNU Make 3.81 or later is required. 3) Type 'make install' to install all binaries and libraries you built. diff --git a/LICENSE b/LICENSE index 8d4d6515b0..3b233c67c1 100644 --- a/LICENSE +++ b/LICENSE @@ -1,17 +1,17 @@ -FFmpeg: +Libav: ------- -Most files in FFmpeg are under the GNU Lesser General Public License version 2.1 +Most files in Libav are under the GNU Lesser General Public License version 2.1 or later (LGPL v2.1+). Read the file COPYING.LGPLv2.1 for details. Some other files have MIT/X11/BSD-style licenses. In combination the LGPL v2.1+ applies to -FFmpeg. +Libav. -Some optional parts of FFmpeg are licensed under the GNU General Public License +Some optional parts of Libav are licensed under the GNU General Public License version 2 or later (GPL v2+). See the file COPYING.GPLv2 for details. None of these parts are used by default, you have to explicitly pass --enable-gpl to -configure to activate them. In this case, FFmpeg's license changes to GPL v2+. +configure to activate them. In this case, Libav's license changes to GPL v2+. -Specifically, the GPL parts of FFmpeg are +Specifically, the GPL parts of Libav are - libpostproc - optional x86 optimizations in the files @@ -33,14 +33,14 @@ external libraries: ------------------- Some external libraries, e.g. libx264, are under GPL and can be used in -conjunction with FFmpeg. They require --enable-gpl to be passed to configure +conjunction with Libav. They require --enable-gpl to be passed to configure as well. The OpenCORE external libraries are under the Apache License 2.0. That license is incompatible with the LGPL v2.1 and the GPL v2, but not with version 3 of -those licenses. So to combine the OpenCORE libraries with FFmpeg, the license +those licenses. So to combine the OpenCORE libraries with Libav, the license version needs to be upgraded by passing --enable-version3 to configure. -The nonfree external library libfaac can be hooked up in FFmpeg. You need to +The nonfree external library libfaac can be hooked up in Libav. You need to pass --enable-nonfree to configure to enable it. Employ this option with care -as FFmpeg then becomes nonfree and unredistributable. +as Libav then becomes nonfree and unredistributable. diff --git a/README b/README index e907e90223..6346cff926 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -FFmpeg README +Libav README ------------- 1) Documentation diff --git a/configure b/configure index 4d308d2abd..36b9e8ab5f 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #!/bin/sh # -# FFmpeg configure script +# Libav configure script # # Copyright (c) 2000-2002 Fabrice Bellard # Copyright (c) 2005-2008 Diego Biurrun @@ -44,9 +44,9 @@ if test "$E1" != 0 || test "$E2" = 0; then echo "No compatible shell script interpreter found." echo "This configure script requires a POSIX-compatible shell" echo "such as bash or ksh." - echo "THIS IS NOT A BUG IN FFMPEG, DO NOT REPORT IT AS SUCH." + echo "THIS IS NOT A BUG IN LIBAV, DO NOT REPORT IT AS SUCH." echo "Instead, install a working POSIX-compatible shell." - echo "Disabling this configure test will create a broken FFmpeg." + echo "Disabling this configure test will create a broken Libav." if test "$BASH_VERSION" = '2.04.0(1)-release'; then echo "This bash version ($BASH_VERSION) is broken on your platform." echo "Upgrade to a later version if available." @@ -237,7 +237,7 @@ Advanced options (experts only): --enable-sram allow use of on-chip SRAM --disable-symver disable symbol versioning -Developer options (useful when working on FFmpeg itself): +Developer options (useful when working on Libav itself): --disable-debug disable debugging symbols --enable-debug=LEVEL set the debug level [$debuglevel] --disable-optimizations disable compiler optimizations @@ -279,7 +279,7 @@ die(){ If you think configure made a mistake, make sure you are using the latest version from Git. If the latest version fails, report the problem to the -ffmpeg-user@mplayerhq.hu mailing list or IRC #ffmpeg on irc.freenode.net. +libav-user@libav.org mailing list or IRC #libav on irc.freenode.net. EOF if disabled logging; then cat < Date: Mon, 14 Mar 2011 22:23:10 +0100 Subject: [PATCH 09/34] replace FFMPEG with LIBAV in FFMPEG_CONFIGURATION also update the multiple inclusion guards in config.h|mak --- Makefile | 2 +- cmdutils.c | 4 ++-- configure | 22 +++++++++++----------- libavcodec/utils.c | 2 +- libavdevice/avdevice.c | 2 +- libavfilter/avfilter.c | 2 +- libavformat/utils.c | 2 +- libavutil/utils.c | 2 +- libpostproc/postprocess.c | 2 +- libswscale/utils.c | 2 +- 10 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Makefile b/Makefile index ad1f737ebb..1ec443699e 100644 --- a/Makefile +++ b/Makefile @@ -177,7 +177,7 @@ distclean:: $(RM) version.h config.* libavutil/avconfig.h config: - $(SRC_PATH)/configure $(value FFMPEG_CONFIGURATION) + $(SRC_PATH)/configure $(value LIBAV_CONFIGURATION) # regression tests diff --git a/cmdutils.c b/cmdutils.c index 514ebadb6e..7012d04cc5 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -397,7 +397,7 @@ static int warned_cfg = 0; } \ if (flags & SHOW_CONFIG) { \ const char *cfg = libname##_configuration(); \ - if (strcmp(FFMPEG_CONFIGURATION, cfg)) { \ + if (strcmp(LIBAV_CONFIGURATION, cfg)) { \ if (!warned_cfg) { \ fprintf(outstream, \ "%sWARNING: library configuration mismatch\n", \ @@ -427,7 +427,7 @@ void show_banner(void) program_name, program_birth_year, this_year); fprintf(stderr, " built on %s %s with %s %s\n", __DATE__, __TIME__, CC_TYPE, CC_VERSION); - fprintf(stderr, " configuration: " FFMPEG_CONFIGURATION "\n"); + fprintf(stderr, " configuration: " LIBAV_CONFIGURATION "\n"); print_all_libs_info(stderr, INDENT|SHOW_CONFIG); print_all_libs_info(stderr, INDENT|SHOW_VERSION); } diff --git a/configure b/configure index 36b9e8ab5f..3dba45229c 100755 --- a/configure +++ b/configure @@ -1688,7 +1688,7 @@ for v in "$@"; do r=${v#*=} l=${v%"$r"} r=$(sh_quote "$r") - FFMPEG_CONFIGURATION="${FFMPEG_CONFIGURATION# } ${l}${r}" + LIBAV_CONFIGURATION="${LIBAV_CONFIGURATION# } ${l}${r}" done find_things(){ @@ -1800,7 +1800,7 @@ done disabled logging && logfile=/dev/null -echo "# $0 $FFMPEG_CONFIGURATION" > $logfile +echo "# $0 $LIBAV_CONFIGURATION" > $logfile set >> $logfile test -n "$cross_prefix" && enable cross_compile @@ -2495,7 +2495,7 @@ case $target_os in ;; esac -echo "config:$arch:$subarch:$cpu:$target_os:$cc_ident:$FFMPEG_CONFIGURATION" >config.fate +echo "config:$arch:$subarch:$cpu:$target_os:$cc_ident:$LIBAV_CONFIGURATION" >config.fate check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable pic @@ -3204,9 +3204,9 @@ config_files="$TMPH config.mak" cat > config.mak < $TMPH <> $TMPH -echo "endif # FFMPEG_CONFIG_MAK" >> config.mak +echo "#endif /* LIBAV_CONFIG_H */" >> $TMPH +echo "endif # LIBAV_CONFIG_MAK" >> config.mak # Do not overwrite an unchanged config.h to avoid superfluous rebuilds. cp_if_changed $TMPH config.h diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 18631ff164..be9c912560 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -1035,7 +1035,7 @@ unsigned avcodec_version( void ) const char *avcodec_configuration(void) { - return FFMPEG_CONFIGURATION; + return LIBAV_CONFIGURATION; } const char *avcodec_license(void) diff --git a/libavdevice/avdevice.c b/libavdevice/avdevice.c index 3d67b4b8be..01db8776ac 100644 --- a/libavdevice/avdevice.c +++ b/libavdevice/avdevice.c @@ -25,7 +25,7 @@ unsigned avdevice_version(void) const char * avdevice_configuration(void) { - return FFMPEG_CONFIGURATION; + return LIBAV_CONFIGURATION; } const char * avdevice_license(void) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 039e04bf64..c0ead5c4be 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -34,7 +34,7 @@ unsigned avfilter_version(void) { const char *avfilter_configuration(void) { - return FFMPEG_CONFIGURATION; + return LIBAV_CONFIGURATION; } const char *avfilter_license(void) diff --git a/libavformat/utils.c b/libavformat/utils.c index 1dfaa3caf3..2f1db44572 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -51,7 +51,7 @@ unsigned avformat_version(void) const char *avformat_configuration(void) { - return FFMPEG_CONFIGURATION; + return LIBAV_CONFIGURATION; } const char *avformat_license(void) diff --git a/libavutil/utils.c b/libavutil/utils.c index 8a1d32e167..488bac4cc3 100644 --- a/libavutil/utils.c +++ b/libavutil/utils.c @@ -31,7 +31,7 @@ unsigned avutil_version(void) const char *avutil_configuration(void) { - return FFMPEG_CONFIGURATION; + return LIBAV_CONFIGURATION; } const char *avutil_license(void) diff --git a/libpostproc/postprocess.c b/libpostproc/postprocess.c index 92c822b772..7466b18be3 100644 --- a/libpostproc/postprocess.c +++ b/libpostproc/postprocess.c @@ -94,7 +94,7 @@ unsigned postproc_version(void) const char *postproc_configuration(void) { - return FFMPEG_CONFIGURATION; + return LIBAV_CONFIGURATION; } const char *postproc_license(void) diff --git a/libswscale/utils.c b/libswscale/utils.c index 166e983477..34988a0c66 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -53,7 +53,7 @@ unsigned swscale_version(void) const char *swscale_configuration(void) { - return FFMPEG_CONFIGURATION; + return LIBAV_CONFIGURATION; } const char *swscale_license(void) From a03be6e1ba4cbf9984b0bbdb674704bbb2da6713 Mon Sep 17 00:00:00 2001 From: Janne Grunau Date: Mon, 14 Mar 2011 22:27:40 +0100 Subject: [PATCH 10/34] use LIBAV_LICENSE and LIBAV_VERSION instead of FFMPEG_* --- cmdutils.c | 4 ++-- configure | 2 +- libavcodec/utils.c | 2 +- libavdevice/avdevice.c | 2 +- libavfilter/avfilter.c | 2 +- libavformat/utils.c | 2 +- libavutil/utils.c | 2 +- libpostproc/postprocess.c | 2 +- libswscale/utils.c | 2 +- version.sh | 2 +- 10 files changed, 11 insertions(+), 11 deletions(-) diff --git a/cmdutils.c b/cmdutils.c index 7012d04cc5..1e7aacf00d 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -423,7 +423,7 @@ static void print_all_libs_info(FILE* outstream, int flags) void show_banner(void) { - fprintf(stderr, "%s version " FFMPEG_VERSION ", Copyright (c) %d-%d the FFmpeg developers\n", + fprintf(stderr, "%s version " LIBAV_VERSION ", Copyright (c) %d-%d the Libav developers\n", program_name, program_birth_year, this_year); fprintf(stderr, " built on %s %s with %s %s\n", __DATE__, __TIME__, CC_TYPE, CC_VERSION); @@ -433,7 +433,7 @@ void show_banner(void) } void show_version(void) { - printf("%s " FFMPEG_VERSION "\n", program_name); + printf("%s " LIBAV_VERSION "\n", program_name); print_all_libs_info(stdout, SHOW_VERSION); } diff --git a/configure b/configure index 3dba45229c..27d09f66cf 100755 --- a/configure +++ b/configure @@ -3298,7 +3298,7 @@ cat > $TMPH < /dev/null) # Update version.h only on revision changes to avoid spurious rebuilds From f8a45fa1b1764b34d4263eacd93411e8ba0484a4 Mon Sep 17 00:00:00 2001 From: Janne Grunau Date: Mon, 14 Mar 2011 22:59:19 +0100 Subject: [PATCH 11/34] replace FFmpeg with Libav in doc/ unless it stands for ffmpeg the program or is historic --- doc/bitstream_filters.texi | 2 +- doc/build_system.txt | 2 +- doc/demuxers.texi | 4 +-- doc/developer.texi | 20 ++++++------- doc/encoders.texi | 4 +-- doc/eval.texi | 2 +- doc/faq.texi | 56 +++++++++++++++++----------------- doc/ffmpeg.texi | 6 ++-- doc/ffplay.texi | 8 ++--- doc/ffprobe.texi | 4 +-- doc/ffserver.texi | 4 +-- doc/fftools-common-opts.texi | 2 +- doc/filters.texi | 10 +++---- doc/general.texi | 58 ++++++++++++++++++------------------ doc/git-howto.txt | 10 +++---- doc/indevs.texi | 6 ++-- doc/issue_tracker.txt | 10 +++---- doc/libavfilter.texi | 6 ++-- doc/metadata.texi | 4 +-- doc/multithreading.txt | 4 +-- doc/muxers.texi | 4 +-- doc/optimization.txt | 4 +-- doc/outdevs.texi | 4 +-- doc/protocols.texi | 4 +-- doc/soc.txt | 6 ++-- 25 files changed, 122 insertions(+), 122 deletions(-) diff --git a/doc/bitstream_filters.texi b/doc/bitstream_filters.texi index 1ad67cd5ef..c33fca6c51 100644 --- a/doc/bitstream_filters.texi +++ b/doc/bitstream_filters.texi @@ -1,7 +1,7 @@ @chapter Bitstream Filters @c man begin BITSTREAM FILTERS -When you configure your FFmpeg build, all the supported bitstream +When you configure your Libav build, all the supported bitstream filters are enabled by default. You can list all available ones using the configure option @code{--list-bsfs}. diff --git a/doc/build_system.txt b/doc/build_system.txt index 8a200695a5..5a59f350bb 100644 --- a/doc/build_system.txt +++ b/doc/build_system.txt @@ -1,4 +1,4 @@ -FFmpeg currently uses a custom build system, this text attempts to document +Libav currently uses a custom build system, this text attempts to document some of its obscure features and options. Options to make: diff --git a/doc/demuxers.texi b/doc/demuxers.texi index 05316ce5cd..bbdde9c92d 100644 --- a/doc/demuxers.texi +++ b/doc/demuxers.texi @@ -1,10 +1,10 @@ @chapter Demuxers @c man begin DEMUXERS -Demuxers are configured elements in FFmpeg which allow to read the +Demuxers are configured elements in Libav which allow to read the multimedia streams from a particular type of file. -When you configure your FFmpeg build, all the supported demuxers +When you configure your Libav build, all the supported demuxers are enabled by default. You can list all available ones using the configure option "--list-demuxers". diff --git a/doc/developer.texi b/doc/developer.texi index 96ab9f7a4b..379f6b2a40 100644 --- a/doc/developer.texi +++ b/doc/developer.texi @@ -32,12 +32,12 @@ generated by ./configure to understand what is needed. You can use libavcodec or libavformat in your commercial program, but @emph{any patch you make must be published}. The best way to proceed is -to send your patches to the FFmpeg mailing list. +to send your patches to the Libav mailing list. @anchor{Coding Rules} @section Coding Rules -FFmpeg is programmed in the ISO C90 language with a few additional +Libav is programmed in the ISO C90 language with a few additional features from ISO C99, namely: @itemize @bullet @item @@ -54,7 +54,7 @@ These features are supported by all compilers we care about, so we will not accept patches to remove their use unless they absolutely do not impair clarity and performance. -All code must compile with GCC 2.95 and GCC 3.3. Currently, FFmpeg also +All code must compile with GCC 2.95 and GCC 3.3. Currently, Libav also compiles with several other compilers, such as the Compaq ccc compiler or Sun Studio 9, and we would like to keep it that way unless it would be exceedingly involved. To ensure compatibility, please do not use any @@ -76,7 +76,7 @@ The TAB character is forbidden outside of Makefiles as is any form of trailing whitespace. Commits containing either will be rejected by the Subversion repository. -The main priority in FFmpeg is simplicity and small code size in order to +The main priority in Libav is simplicity and small code size in order to minimize the bug count. Comments: Use the JavaDoc/Doxygen @@ -129,7 +129,7 @@ should also be avoided if they don't make the code easier to understand. an "or any later version" clause is also acceptable, but LGPL is preferred. @item - You must not commit code which breaks FFmpeg! (Meaning unfinished but + You must not commit code which breaks Libav! (Meaning unfinished but enabled code which breaks compilation or compiles but does not work or breaks the regression tests) You can commit unfinished stuff (for testing etc), but it must be disabled @@ -168,7 +168,7 @@ should also be avoided if they don't make the code easier to understand. with functional changes, such commits will be rejected and removed. Every developer has his own indentation style, you should not change it. Of course if you (re)write something, you can use your own style, even though we would - prefer if the indentation throughout FFmpeg was consistent (Many projects + prefer if the indentation throughout Libav was consistent (Many projects force a given indentation style - we do not.). If you really need to make indentation changes (try to avoid this), separate them strictly from real changes. @@ -253,7 +253,7 @@ keeping it as a logical unit that contains an individual change, even if it spans multiple files. This makes reviewing your patches much easier for us and greatly increases your chances of getting your patch applied. -Use the patcheck tool of FFmpeg to check your patch. +Use the patcheck tool of Libav to check your patch. The tool is located in the tools directory. Run the regression tests before submitting a patch so that you can @@ -275,7 +275,7 @@ Your patch will be reviewed on the mailing list. You will likely be asked to make some changes and are expected to send in an improved version that incorporates the requests from the review. This process may go through several iterations. Once your patch is deemed good enough, some developer -will pick it up and commit it to the official FFmpeg tree. +will pick it up and commit it to the official Libav tree. Give us a few days to react. But if some time passes without reaction, send a reminder by email. Your patch should eventually be dealt with. @@ -325,7 +325,7 @@ send a reminder by email. Your patch should eventually be dealt with. @item Is the patch a unified diff? @item - Is the patch against latest FFmpeg git master branch? + Is the patch against latest Libav git master branch? @item Are you subscribed to ffmpeg-dev? (the list is subscribers only due to spam) @@ -374,7 +374,7 @@ send a reminder by email. Your patch should eventually be dealt with. patch easily? @item If you added a new file, did you insert a license header? It should be - taken from FFmpeg, not randomly copied and pasted from somewhere else. + taken from Libav, not randomly copied and pasted from somewhere else. @item You should maintain alphabetical order in alphabetically ordered lists as long as doing so does not break API/ABI compatibility. diff --git a/doc/encoders.texi b/doc/encoders.texi index cab98fb0bd..ca1c43d33b 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -1,10 +1,10 @@ @chapter Encoders @c man begin ENCODERS -Encoders are configured elements in FFmpeg which allow the encoding of +Encoders are configured elements in Libav which allow the encoding of multimedia streams. -When you configure your FFmpeg build, all the supported native encoders +When you configure your Libav build, all the supported native encoders are enabled by default. Encoders requiring an external library must be enabled manually via the corresponding @code{--enable-lib} option. You can list all available encoders using the configure option @code{--list-encoders}. diff --git a/doc/eval.texi b/doc/eval.texi index 99cd034cdf..a989a373a6 100644 --- a/doc/eval.texi +++ b/doc/eval.texi @@ -1,7 +1,7 @@ @chapter Expression Evaluation @c man begin EXPRESSION EVALUATION -When evaluating an arithemetic expression, FFmpeg uses an internal +When evaluating an arithemetic expression, Libav uses an internal formula evaluator, implemented through the @file{libavutil/eval.h} interface. diff --git a/doc/faq.texi b/doc/faq.texi index e92c0e5f26..a07254a236 100644 --- a/doc/faq.texi +++ b/doc/faq.texi @@ -1,8 +1,8 @@ \input texinfo @c -*- texinfo -*- -@settitle FFmpeg FAQ +@settitle Libav FAQ @titlepage -@center @titlefont{FFmpeg FAQ} +@center @titlefont{Libav FAQ} @end titlepage @top @@ -11,33 +11,33 @@ @chapter General Questions -@section When will the next FFmpeg version be released? / Why are FFmpeg releases so few and far between? +@section When will the next Libav version be released? / Why are Libav releases so few and far between? -Like most open source projects FFmpeg suffers from a certain lack of +Like most open source projects Libav suffers from a certain lack of manpower. For this reason the developers have to prioritize the work they do and putting out releases is not at the top of the list, fixing bugs and reviewing patches takes precedence. Please don't complain or request more timely and/or frequent releases unless you are willing to help out creating them. -@section I have a problem with an old version of FFmpeg; where should I report it? -Nowhere. We do not support old FFmpeg versions in any way, we simply lack +@section I have a problem with an old version of Libav; where should I report it? +Nowhere. We do not support old Libav versions in any way, we simply lack the time, motivation and manpower to do so. If you have a problem with an -old version of FFmpeg, upgrade to the latest Subversion snapshot. If you +old version of Libav, upgrade to the latest Subversion snapshot. If you still experience the problem, then you can report it according to the guidelines in @url{http://libav.org/bugreports.html}. -@section Why doesn't FFmpeg support feature [xyz]? +@section Why doesn't Libav support feature [xyz]? -Because no one has taken on that task yet. FFmpeg development is +Because no one has taken on that task yet. Libav development is driven by the tasks that are important to the individual developers. If there is a feature that is important to you, the best way to get it implemented is to undertake the task yourself or sponsor a developer. -@section FFmpeg does not support codec XXX. Can you include a Windows DLL loader to support it? +@section Libav does not support codec XXX. Can you include a Windows DLL loader to support it? No. Windows DLLs are not portable, bloated and often slow. -Moreover FFmpeg strives to support all codecs natively. +Moreover Libav strives to support all codecs natively. A DLL loader is not conducive to that goal. @section My bug report/mail to libav-devel/user has not received any replies. @@ -55,10 +55,10 @@ libav* from another application. @item You speak about a video having problems on playback but not what you use to play it. @item We have no faint clue what you are talking about besides -that it is related to FFmpeg. +that it is related to Libav. @end itemize -@section Is there a forum for FFmpeg? I do not like mailing lists. +@section Is there a forum for Libav? I do not like mailing lists. You may view our mailing lists with a more forum-alike look here: @url{http://dir.gmane.org/gmane.comp.video.ffmpeg.user}, @@ -272,7 +272,7 @@ material, and try '-top 0/1' if the result looks really messed-up. @section How can I read DirectShow files? -If you have built FFmpeg with @code{./configure --enable-avisynth} +If you have built Libav with @code{./configure --enable-avisynth} (only possible on MinGW/Cygwin platforms), then you may use any file that DirectShow can read as input. @@ -368,11 +368,11 @@ examining all of the vbv_delay values and making complicated computations." @chapter Development -@section Are there examples illustrating how to use the FFmpeg libraries, particularly libavcodec and libavformat? +@section Are there examples illustrating how to use the Libav libraries, particularly libavcodec and libavformat? -Yes. Read the Developers Guide of the FFmpeg documentation. Alternatively, +Yes. Read the Developers Guide of the Libav documentation. Alternatively, examine the source code for one of the many open source projects that -already incorporate FFmpeg at (@url{projects.html}). +already incorporate Libav at (@url{projects.html}). @section Can you support my C compiler XXX? @@ -383,14 +383,14 @@ with @code{#ifdef}s related to the compiler. @section Is Microsoft Visual C++ supported? No. Microsoft Visual C++ is not compliant to the C99 standard and does -not - among other things - support the inline assembly used in FFmpeg. +not - among other things - support the inline assembly used in Libav. If you wish to use MSVC++ for your project then you can link the MSVC++ code with libav* as long as you compile the latter with a working C compiler. For more information, see -the @emph{Microsoft Visual C++ compatibility} section in the FFmpeg +the @emph{Microsoft Visual C++ compatibility} section in the Libav documentation. -There have been efforts to make FFmpeg compatible with MSVC++ in the +There have been efforts to make Libav compatible with MSVC++ in the past. However, they have all been rejected as too intrusive, especially since MinGW does the job adequately. None of the core developers work with MSVC++ and thus this item is low priority. Should you find @@ -398,13 +398,13 @@ the silver bullet that solves this problem, feel free to shoot it at us. We strongly recommend you to move over from MSVC++ to MinGW tools. -@section Can I use FFmpeg or libavcodec under Windows? +@section Can I use Libav or libavcodec under Windows? -Yes, but the Cygwin or MinGW tools @emph{must} be used to compile FFmpeg. -Read the @emph{Windows} section in the FFmpeg documentation to find more +Yes, but the Cygwin or MinGW tools @emph{must} be used to compile Libav. +Read the @emph{Windows} section in the Libav documentation to find more information. -To get help and instructions for building FFmpeg under Windows, check out +To get help and instructions for building Libav under Windows, check out the FFmpeg Windows Help Forum at @url{http://ffmpeg.arrozcru.org/}. @@ -414,7 +414,7 @@ No. These tools are too bloated and they complicate the build. @section Why not rewrite ffmpeg in object-oriented C++? -FFmpeg is already organized in a highly modular manner and does not need to +Libav is already organized in a highly modular manner and does not need to be rewritten in a formal object language. Further, many of the developers favor straight C; it works for them. For more arguments on this matter, read "Programming Religion" at (@url{http://www.tux.org/lkml/#s15}). @@ -441,16 +441,16 @@ the compilation failure then you are probably not qualified for this. @section I'm using libavcodec from within my C++ application but the linker complains about missing symbols which seem to be available. -FFmpeg is a pure C project, so to use the libraries within your C++ application +Libav is a pure C project, so to use the libraries within your C++ application you need to explicitly state that you are using a C library. You can do this by -encompassing your FFmpeg includes using @code{extern "C"}. +encompassing your Libav includes using @code{extern "C"}. See @url{http://www.parashift.com/c++-faq-lite/mixing-c-and-cpp.html#faq-32.3} @section I have a file in memory / a API different from *open/*read/ libc how do I use it with libavformat? You have to implement a URLProtocol, see @file{libavformat/file.c} in -FFmpeg and @file{libmpdemux/demux_lavf.c} in MPlayer sources. +Libav and @file{libmpdemux/demux_lavf.c} in MPlayer sources. @section I get "No compatible shell script interpreter found." in MSys. diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi index f0f3b65084..bc30ba3d75 100644 --- a/doc/ffmpeg.texi +++ b/doc/ffmpeg.texi @@ -735,7 +735,7 @@ A preset file contains a sequence of @var{option}=@var{value} pairs, one for each line, specifying a sequence of options which would be awkward to specify on the command line. Lines starting with the hash ('#') character are ignored and are used to provide comments. Check -the @file{ffpresets} directory in the FFmpeg source tree for examples. +the @file{ffpresets} directory in the Libav source tree for examples. Preset files are specified with the @code{vpre}, @code{apre}, @code{spre}, and @code{fpre} options. The @code{fpre} option takes the @@ -997,11 +997,11 @@ file to which you want to add them. @settitle FFmpeg video converter @c man begin SEEALSO -ffplay(1), ffprobe(1), ffserver(1) and the FFmpeg HTML documentation +ffplay(1), ffprobe(1), ffserver(1) and the Libav HTML documentation @c man end @c man begin AUTHORS -The FFmpeg developers +The Libav developers @c man end @end ignore diff --git a/doc/ffplay.texi b/doc/ffplay.texi index e0518b859e..6199e6d269 100644 --- a/doc/ffplay.texi +++ b/doc/ffplay.texi @@ -20,9 +20,9 @@ ffplay [options] @file{input_file} @chapter Description @c man begin DESCRIPTION -FFplay is a very simple and portable media player using the FFmpeg +FFplay is a very simple and portable media player using the Libav libraries and the SDL library. It is mostly used as a testbed for the -various FFmpeg APIs. +various Libav APIs. @c man end @chapter Options @@ -169,11 +169,11 @@ Seek to percentage in file corresponding to fraction of width. @settitle FFplay media player @c man begin SEEALSO -ffmpeg(1), ffprobe(1), ffserver(1) and the FFmpeg HTML documentation +ffmpeg(1), ffprobe(1), ffserver(1) and the Libav HTML documentation @c man end @c man begin AUTHORS -The FFmpeg developers +The Libav developers @c man end @end ignore diff --git a/doc/ffprobe.texi b/doc/ffprobe.texi index de65eee664..b775f558dd 100644 --- a/doc/ffprobe.texi +++ b/doc/ffprobe.texi @@ -122,11 +122,11 @@ with name "STREAM". @settitle FFprobe media prober @c man begin SEEALSO -ffmpeg(1), ffplay(1), ffserver(1) and the FFmpeg HTML documentation +ffmpeg(1), ffplay(1), ffserver(1) and the Libav HTML documentation @c man end @c man begin AUTHORS -The FFmpeg developers +The Libav developers @c man end @end ignore diff --git a/doc/ffserver.texi b/doc/ffserver.texi index 0cab3c8a98..021b237de5 100644 --- a/doc/ffserver.texi +++ b/doc/ffserver.texi @@ -266,11 +266,11 @@ rather than as a daemon. @c man begin SEEALSO ffmpeg(1), ffplay(1), ffprobe(1), the @file{ffmpeg/doc/ffserver.conf} -example and the FFmpeg HTML documentation +example and the Libav HTML documentation @c man end @c man begin AUTHORS -The FFmpeg developers +The Libav developers @c man end @end ignore diff --git a/doc/fftools-common-opts.texi b/doc/fftools-common-opts.texi index d72ca5cc00..3a1cb3b23c 100644 --- a/doc/fftools-common-opts.texi +++ b/doc/fftools-common-opts.texi @@ -88,6 +88,6 @@ can be disabled setting the environment variable @env{FFMPEG_FORCE_NOCOLOR} or @env{NO_COLOR}, or can be forced setting the environment variable @env{FFMPEG_FORCE_COLOR}. The use of the environment variable @env{NO_COLOR} is deprecated and -will be dropped in a following FFmpeg version. +will be dropped in a following Libav version. @end table diff --git a/doc/filters.texi b/doc/filters.texi index 042ea13245..2bd7bf56ff 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -92,7 +92,7 @@ Follows a BNF description for the filtergraph syntax: @chapter Audio Filters @c man begin AUDIO FILTERS -When you configure your FFmpeg build, you can disable any of the +When you configure your Libav build, you can disable any of the existing filters using --disable-filters. The configure output will show the audio filters included in your build. @@ -155,7 +155,7 @@ tools. @chapter Video Filters @c man begin VIDEO FILTERS -When you configure your FFmpeg build, you can disable any of the +When you configure your Libav build, you can disable any of the existing filters using --disable-filters. The configure output will show the video filters included in your build. @@ -386,7 +386,7 @@ format=yuv420p:yuv444p:yuv410p Apply a frei0r effect to the input video. To enable compilation of this filter you need to install the frei0r -header and configure FFmpeg with --enable-frei0r. +header and configure Libav with --enable-frei0r. The filter supports the syntax: @example @@ -524,7 +524,7 @@ Pass the video source unchanged to the output. Apply video transform using libopencv. To enable this filter install libopencv library and headers and -configure FFmpeg with --enable-libopencv. +configure Libav with --enable-libopencv. The filter takes the parameters: @var{filter_name}@{:=@}@var{filter_params}. @@ -1164,7 +1164,7 @@ timebase. The expression can contain the constants "PI", "E", "PHI", Provide a frei0r source. To enable compilation of this filter you need to install the frei0r -header and configure FFmpeg with --enable-frei0r. +header and configure Libav with --enable-frei0r. The source supports the syntax: @example diff --git a/doc/general.texi b/doc/general.texi index 080357a39d..cd06533fad 100644 --- a/doc/general.texi +++ b/doc/general.texi @@ -11,13 +11,13 @@ @chapter external libraries -FFmpeg can be hooked up with a number of external libraries to add support +Libav can be hooked up with a number of external libraries to add support for more formats. None of them are used by default, their use has to be explicitly requested by passing the appropriate flags to @file{./configure}. @section OpenCORE AMR -FFmpeg can make use of the OpenCORE libraries for AMR-NB +Libav can make use of the OpenCORE libraries for AMR-NB decoding/encoding and AMR-WB decoding. Go to @url{http://sourceforge.net/projects/opencore-amr/} and follow the instructions for @@ -27,7 +27,7 @@ installing the libraries. Then pass @code{--enable-libopencore-amrnb} and/or Note that OpenCORE is under the Apache License 2.0 (see @url{http://www.apache.org/licenses/LICENSE-2.0} for details), which is incompatible with the LGPL version 2.1 and GPL version 2. You have to -upgrade FFmpeg's license to LGPL version 3 (or if you have enabled +upgrade Libav's license to LGPL version 3 (or if you have enabled GPL components, GPL version 3) to use it. @@ -37,7 +37,7 @@ You can use the @code{-formats} and @code{-codecs} options to have an exhaustive @section File Formats -FFmpeg supports the following file formats through the @code{libavformat} +Libav supports the following file formats through the @code{libavformat} library: @multitable @columnfractions .4 .1 .1 .4 @@ -751,18 +751,18 @@ Using a cross-compiler is preferred for various reasons. @subsection DJGPP -FFmpeg cannot be compiled because of broken system headers, add +Libav cannot be compiled because of broken system headers, add @code{--extra-cflags=-U__STRICT_ANSI__} to the configure options as a workaround. @section OS/2 -For information about compiling FFmpeg on OS/2 see +For information about compiling Libav on OS/2 see @url{http://www.edm2.com/index.php/FFmpeg}. @section Unix-like -Some parts of FFmpeg cannot be built with version 2.15 of the GNU +Some parts of Libav cannot be built with version 2.15 of the GNU assembler which is still provided by a few AMD64 distributions. To make sure your compiler really uses the required version of gas after a binutils upgrade, run: @@ -777,7 +777,7 @@ to configure. @subsection BSD -BSD make will not build FFmpeg, you need to install and use GNU Make +BSD make will not build Libav, you need to install and use GNU Make (@file{gmake}). @subsubsection FreeBSD @@ -790,7 +790,7 @@ getting the system headers fixed. @subsection (Open)Solaris -GNU Make is required to build FFmpeg, so you have to invoke (@file{gmake}), +GNU Make is required to build Libav, so you have to invoke (@file{gmake}), standard Solaris Make will not work. When building with a non-c99 front-end (gcc, generic suncc) add either @code{--extra-libs=/usr/lib/values-xpg6.o} or @code{--extra-libs=/usr/lib/64/values-xpg6.o} to the configure options @@ -808,22 +808,22 @@ bash ./configure MacOS X on PowerPC or ARM (iPhone) requires a preprocessor from @url{http://github.com/yuvi/gas-preprocessor} to build the optimized assembler functions. Just download the Perl script and put it somewhere -in your PATH, FFmpeg's configure will pick it up automatically. +in your PATH, Libav's configure will pick it up automatically. @section Windows -To get help and instructions for building FFmpeg under Windows, check out +To get help and instructions for building Libav under Windows, check out the FFmpeg Windows Help Forum at @url{http://ffmpeg.arrozcru.org/}. @subsection Native Windows compilation -FFmpeg can be built to run natively on Windows using the MinGW tools. Install +Libav can be built to run natively on Windows using the MinGW tools. Install the latest versions of MSYS and MinGW from @url{http://www.mingw.org/}. You can find detailed installation instructions in the download section and the FAQ. -FFmpeg does not build out-of-the-box with the packages the automated MinGW +Libav does not build out-of-the-box with the packages the automated MinGW installer provides. It also requires coreutils to be installed and many other packages updated to the latest version. The minimum version for some packages are listed below: @@ -835,7 +835,7 @@ are listed below: @item mingw-runtime 3.15 @end itemize -FFmpeg automatically passes @code{-fno-common} to the compiler to work around +Libav automatically passes @code{-fno-common} to the compiler to work around a GCC bug (see @url{http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37216}). Within the MSYS shell, configure and make with: @@ -866,14 +866,14 @@ Edit the @file{bin/sdl-config} script so that it points to the correct prefix where SDL was installed. Verify that @file{sdl-config} can be launched from the MSYS command line. -@item By using @code{./configure --enable-shared} when configuring FFmpeg, +@item By using @code{./configure --enable-shared} when configuring Libav, you can build libavutil, libavcodec and libavformat as DLLs. @end itemize @subsection Microsoft Visual C++ compatibility -As stated in the FAQ, FFmpeg will not compile under MSVC++. However, if you +As stated in the FAQ, Libav will not compile under MSVC++. However, if you want to use the libav* libraries in your own applications, you can still compile those applications using MSVC++. But the libav* libraries you link to @emph{must} be built with MinGW. However, you will not be able to debug @@ -881,13 +881,13 @@ inside the libav* libraries, since MSVC++ does not recognize the debug symbols generated by GCC. We strongly recommend you to move over from MSVC++ to MinGW tools. -This description of how to use the FFmpeg libraries with MSVC++ is based on +This description of how to use the Libav libraries with MSVC++ is based on Microsoft Visual C++ 2005 Express Edition. If you have a different version, you might have to modify the procedures slightly. @subsubsection Using static libraries -Assuming you have just built and installed FFmpeg in @file{/usr/local}. +Assuming you have just built and installed Libav in @file{/usr/local}. @enumerate @@ -898,13 +898,13 @@ Application Wizard, uncheck the "Precompiled headers" option. @item Write the source code for your application, or, for testing, just copy the code from an existing sample application into the source file that MSVC++ has already created for you. For example, you can copy -@file{libavformat/output-example.c} from the FFmpeg distribution. +@file{libavformat/output-example.c} from the Libav distribution. @item Open the "Project / Properties" dialog box. In the "Configuration" combo box, select "All Configurations" so that the changes you make will affect both debug and release builds. In the tree view on the left hand side, select "C/C++ / General", then edit the "Additional Include -Directories" setting to contain the path where the FFmpeg includes were +Directories" setting to contain the path where the Libav includes were installed (i.e. @file{c:\msys\1.0\local\include}). Do not add MinGW's include directory here, or the include files will conflict with MSVC's. @@ -912,7 +912,7 @@ conflict with MSVC's. @item Still in the "Project / Properties" dialog box, select "Linker / General" from the tree view and edit the "Additional Library Directories" setting to contain the @file{lib} -directory where FFmpeg was installed (i.e. @file{c:\msys\1.0\local\lib}), +directory where Libav was installed (i.e. @file{c:\msys\1.0\local\lib}), the directory where MinGW libs are installed (i.e. @file{c:\mingw\lib}), and the directory where MinGW's GCC libs are installed (i.e. @file{C:\mingw\lib\gcc\mingw32\4.2.1-sjlj}). Then select @@ -929,13 +929,13 @@ set to "Multi-threaded DLL". @item Click "OK" to close the "Project / Properties" dialog box. -@item MSVC++ lacks some C99 header files that are fundamental for FFmpeg. +@item MSVC++ lacks some C99 header files that are fundamental for Libav. Get msinttypes from @url{http://code.google.com/p/msinttypes/downloads/list} and install it in MSVC++'s include directory (i.e. @file{C:\Program Files\Microsoft Visual Studio 8\VC\include}). @item MSVC++ also does not understand the @code{inline} keyword used by -FFmpeg, so you must add this line before @code{#include}ing libav*: +Libav, so you must add this line before @code{#include}ing libav*: @example #define inline _inline @end example @@ -968,10 +968,10 @@ and run @file{c:\msys\1.0\msys.bat} from there. @item Within the MSYS shell, run @code{lib.exe}. If you get a help message from @file{Microsoft (R) Library Manager}, this means your environment variables are set up correctly, the @file{Microsoft (R) Library Manager} -is on the path and will be used by FFmpeg to create +is on the path and will be used by Libav to create MSVC++-compatible import libraries. -@item Build FFmpeg with +@item Build Libav with @example ./configure --enable-shared --enable-memalign-hack @@ -1000,7 +1000,7 @@ of DLL files, but the ones that are actually used to run your application are the ones with a major version number in their filenames (i.e. @file{avcodec-51.dll}). -FFmpeg headers do not declare global data for Windows DLLs through the usual +Libav headers do not declare global data for Windows DLLs through the usual dllexport/dllimport interface. Such data will be exported properly while building, but to use them in your MSVC++ code you will have to edit the appropriate headers and mark the data as dllimport. For example, in @@ -1014,14 +1014,14 @@ extern __declspec(dllimport) const AVPixFmtDescriptor av_pix_fmt_descriptors[]; You must use the MinGW cross compilation tools available at @url{http://www.mingw.org/}. -Then configure FFmpeg with the following options: +Then configure Libav with the following options: @example ./configure --target-os=mingw32 --cross-prefix=i386-mingw32msvc- @end example (you can change the cross-prefix according to the prefix chosen for the MinGW tools). -Then you can easily test FFmpeg with Wine +Then you can easily test Libav with Wine (@url{http://www.winehq.com/}). @subsection Compilation under Cygwin @@ -1055,7 +1055,7 @@ shared libraries: ./configure --enable-shared --disable-static --extra-cflags=-fno-reorder-functions @end example -If you want to build FFmpeg with additional libraries, download Cygwin +If you want to build Libav with additional libraries, download Cygwin "Devel" packages for Ogg and Vorbis from any Cygwin packages repository: @example libogg-devel, libvorbis-devel diff --git a/doc/git-howto.txt b/doc/git-howto.txt index c6cbc2b668..3ac21c87d9 100644 --- a/doc/git-howto.txt +++ b/doc/git-howto.txt @@ -28,9 +28,9 @@ Consult these resources whenever you have problems, they are quite exhaustive. You do not need a special username or password. All you need is to provide a ssh public key to the Git server admin. -What follows now is a basic introduction to Git and some FFmpeg-specific +What follows now is a basic introduction to Git and some Libav-specific guidelines. Read it at least once, if you are granted commit privileges to the -FFmpeg project you are expected to be familiar with these rules. +Libav project you are expected to be familiar with these rules. @@ -46,11 +46,11 @@ I. BASICS: git clone git://git.libav.org/libav.git - This will put the FFmpeg sources into the directory . + This will put the Libav sources into the directory . git clone git@git.libav.org:libav.git - This will put the FFmpeg sources into the directory and let + This will put the Libav sources into the directory and let you push back your changes to the remote repository. @@ -72,7 +72,7 @@ I. BASICS: fetches the changes from the main repository and replays your local commits over it. This is required to keep all your local changes at the top of - FFmpeg's master tree. The master tree will reject pushes with merge commits. + Libav's master tree. The master tree will reject pushes with merge commits. 3. Adding/removing files/directories: diff --git a/doc/indevs.texi b/doc/indevs.texi index 8e862ff6bc..6533284dbf 100644 --- a/doc/indevs.texi +++ b/doc/indevs.texi @@ -1,10 +1,10 @@ @chapter Input Devices @c man begin INPUT DEVICES -Input devices are configured elements in FFmpeg which allow to access +Input devices are configured elements in Libav which allow to access the data coming from a multimedia device attached to your system. -When you configure your FFmpeg build, all the supported input devices +When you configure your Libav build, all the supported input devices are enabled by default. You can list all available ones using the configure option "--list-indevs". @@ -70,7 +70,7 @@ A JACK input device creates one or more JACK writable clients, one for each audio channel, with name @var{client_name}:input_@var{N}, where @var{client_name} is the name provided by the application, and @var{N} is a number which identifies the channel. -Each writable client will send the acquired data to the FFmpeg input +Each writable client will send the acquired data to the Libav input device. Once you have created one or more JACK readable clients, you need to diff --git a/doc/issue_tracker.txt b/doc/issue_tracker.txt index e5a74db001..d92ab4221b 100644 --- a/doc/issue_tracker.txt +++ b/doc/issue_tracker.txt @@ -1,11 +1,11 @@ -FFmpeg's bug/patch/feature request tracker manual -================================================= +Libav's bug/patch/feature request tracker manual +================================================ NOTE: This is a draft. Overview: --------- -FFmpeg uses Roundup for tracking issues, new issues and changes to +Libav uses Roundup for tracking issues, new issues and changes to existing issues can be done through a web interface and through email. It is possible to subscribe to individual issues by adding yourself to the nosy list or to subscribe to the ffmpeg-issues mailing list which receives @@ -60,7 +60,7 @@ critical No feature request can be critical. important - Bugs which make FFmpeg unusable for a significant number of users, and + Bugs which make Libav unusable for a significant number of users, and patches fixing them. Examples here might be completely broken MPEG-4 decoding or a build issue on Linux. @@ -81,7 +81,7 @@ minor wish Something that is desirable to have but that there is no urgency at all to implement, e.g. something completely cosmetic like a website - restyle or a personalized doxy template or the FFmpeg logo. + restyle or a personalized doxy template or the Libav logo. This priority is not valid for bugs. diff --git a/doc/libavfilter.texi b/doc/libavfilter.texi index f7cf74717b..1c1220541c 100644 --- a/doc/libavfilter.texi +++ b/doc/libavfilter.texi @@ -11,10 +11,10 @@ @chapter Introduction -Libavfilter is the filtering API of FFmpeg. It is the substitute of the +Libavfilter is the filtering API of Libav. It is the substitute of the now deprecated 'vhooks' and started as a Google Summer of Code project. -Integrating libavfilter into the main FFmpeg repository is a work in +Integrating libavfilter into the main Libav repository is a work in progress. If you wish to try the unfinished development code of libavfilter then check it out from the libavfilter repository into some directory of your choice by: @@ -74,7 +74,7 @@ not have video output. @chapter graph2dot -The @file{graph2dot} program included in the FFmpeg @file{tools} +The @file{graph2dot} program included in the Libav @file{tools} directory can be used to parse a filter graph description and issue a corresponding textual representation in the dot language. diff --git a/doc/metadata.texi b/doc/metadata.texi index 2a285757cc..cfaf491c2d 100644 --- a/doc/metadata.texi +++ b/doc/metadata.texi @@ -1,7 +1,7 @@ @chapter Metadata @c man begin METADATA -FFmpeg is able to dump metadata from media files into a simple UTF-8-encoded +Libav is able to dump metadata from media files into a simple UTF-8-encoded INI-like text file and then load it back using the metadata muxer/demuxer. The file format is as follows: @@ -53,7 +53,7 @@ A ffmetadata file might look like this: ;FFMETADATA1 title=bike\\shed ;this is a comment -artist=FFmpeg troll team +artist=Libav troll team [CHAPTER] TIMEBASE=1/1000 diff --git a/doc/multithreading.txt b/doc/multithreading.txt index a1068425cd..b72bc16079 100644 --- a/doc/multithreading.txt +++ b/doc/multithreading.txt @@ -1,7 +1,7 @@ -FFmpeg multithreading methods +Libav multithreading methods ============================================== -FFmpeg provides two methods for multithreading codecs. +Libav provides two methods for multithreading codecs. Slice threading decodes multiple parts of a frame at the same time, using AVCodecContext execute() and execute2(). diff --git a/doc/muxers.texi b/doc/muxers.texi index e7cfc4a9bc..ead986914c 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -1,10 +1,10 @@ @chapter Muxers @c man begin MUXERS -Muxers are configured elements in FFmpeg which allow writing +Muxers are configured elements in Libav which allow writing multimedia streams to a particular type of file. -When you configure your FFmpeg build, all the supported muxers +When you configure your Libav build, all the supported muxers are enabled by default. You can list all available muxers using the configure option @code{--list-muxers}. diff --git a/doc/optimization.txt b/doc/optimization.txt index 53cd21d22d..78e0077e30 100644 --- a/doc/optimization.txt +++ b/doc/optimization.txt @@ -17,7 +17,7 @@ Understanding these overoptimized functions: As many functions tend to be a bit difficult to understand because of optimizations, it can be hard to optimize them further, or write architecture-specific versions. It is recommended to look at older -revisions of the interesting files (web frontends for the various FFmpeg +revisions of the interesting files (web frontends for the various Libav branches are listed at http://libav.org/download.html). Alternatively, look into the other architecture-specific versions in the x86/, ppc/, alpha/ subdirectories. Even if you don't exactly @@ -201,7 +201,7 @@ Inline asm vs. external asm --------------------------- Both inline asm (__asm__("..") in a .c file, handled by a compiler such as gcc) and external asm (.s or .asm files, handled by an assembler such as yasm/nasm) -are accepted in FFmpeg. Which one to use differs per specific case. +are accepted in Libav. Which one to use differs per specific case. - if your code is intended to be inlined in a C function, inline asm is always better, because external asm cannot be inlined diff --git a/doc/outdevs.texi b/doc/outdevs.texi index 3c0acee984..8658202dc6 100644 --- a/doc/outdevs.texi +++ b/doc/outdevs.texi @@ -1,10 +1,10 @@ @chapter Output Devices @c man begin OUTPUT DEVICES -Output devices are configured elements in FFmpeg which allow to write +Output devices are configured elements in Libav which allow to write multimedia data to an output device attached to your system. -When you configure your FFmpeg build, all the supported output devices +When you configure your Libav build, all the supported output devices are enabled by default. You can list all available ones using the configure option "--list-outdevs". diff --git a/doc/protocols.texi b/doc/protocols.texi index 5655b10180..6e09025728 100644 --- a/doc/protocols.texi +++ b/doc/protocols.texi @@ -1,10 +1,10 @@ @chapter Protocols @c man begin PROTOCOLS -Protocols are configured elements in FFmpeg which allow to access +Protocols are configured elements in Libav which allow to access resources which require the use of a particular protocol. -When you configure your FFmpeg build, all the supported protocols are +When you configure your Libav build, all the supported protocols are enabled by default. You can list all available ones using the configure option "--list-protocols". diff --git a/doc/soc.txt b/doc/soc.txt index 79d77d1cd7..e45bd6ce3b 100644 --- a/doc/soc.txt +++ b/doc/soc.txt @@ -8,9 +8,9 @@ it's a little late for this year's soc (2006). The Goal: Our goal in respect to soc is and must be of course exactly one thing and -that is to improve FFmpeg, to reach this goal, code must +that is to improve Libav, to reach this goal, code must * conform to the development policy and patch submission guidelines -* must improve FFmpeg somehow (faster, smaller, "better", +* must improve Libav somehow (faster, smaller, "better", more codecs supported, fewer bugs, cleaner, ...) for mentors and other developers to help students to reach that goal it is @@ -20,5 +20,5 @@ easy reviewable that again leads us to: * separation of cosmetic from non-cosmetic changes (this is almost entirely ignored by mentors and students in soc 2006 which might lead to a suprise when the code will be reviewed at the end before a possible inclusion in - FFmpeg, individual changes were generally not reviewable due to cosmetics). + Libav, individual changes were generally not reviewable due to cosmetics). * frequent commits, so that comments can be provided early From dff68563d846274cee0a2cd2430d6f1a2cb51eaa Mon Sep 17 00:00:00 2001 From: Sean McGovern Date: Wed, 16 Mar 2011 01:01:17 +0000 Subject: [PATCH 12/34] darwin: use -read_only_relocs flag only on 32-bit x86 Avoids the linker warning: ld: warning: -read_only_relocs cannot be used with x86_64 Signed-off-by: Mans Rullgard --- configure | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 27d09f66cf..15d45a825b 100755 --- a/configure +++ b/configure @@ -2386,7 +2386,8 @@ case $target_os in enable malloc_aligned gas="gas-preprocessor.pl $cc" enabled ppc && add_asflags -force_cpusubtype_ALL - SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR) -Wl,-read_only_relocs,suppress' + SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR)' + enabled x86_32 && append SHFLAGS -Wl,-read_only_relocs,suppress strip="${strip} -x" add_ldflags -Wl,-dynamic,-search_paths_first SLIBSUF=".dylib" From 381d37fda91494e312ab2938080a379c5e11998b Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Wed, 21 Apr 2010 00:09:00 +0100 Subject: [PATCH 13/34] dsputil: add bswap16_buf() There are several places where a buffer is byte-swapped in 16-bit units. This allows them to share code which can be optimised for various architectures. Signed-off-by: Mans Rullgard --- libavcodec/dsputil.c | 7 +++++++ libavcodec/dsputil.h | 1 + 2 files changed, 8 insertions(+) diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c index 1f7bd4cbc0..b293642b1d 100644 --- a/libavcodec/dsputil.c +++ b/libavcodec/dsputil.c @@ -222,6 +222,12 @@ static void bswap_buf(uint32_t *dst, const uint32_t *src, int w){ } } +static void bswap16_buf(uint16_t *dst, const uint16_t *src, int len) +{ + while (len--) + *dst++ = av_bswap16(*src++); +} + static int sse4_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h) { int s, i; @@ -4324,6 +4330,7 @@ av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx) c->add_hfyu_left_prediction = add_hfyu_left_prediction_c; c->add_hfyu_left_prediction_bgr32 = add_hfyu_left_prediction_bgr32_c; c->bswap_buf= bswap_buf; + c->bswap16_buf = bswap16_buf; #if CONFIG_PNG_DECODER c->add_png_paeth_prediction= ff_add_png_paeth_prediction; #endif diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h index b4798b3de8..a37475f24b 100644 --- a/libavcodec/dsputil.h +++ b/libavcodec/dsputil.h @@ -369,6 +369,7 @@ typedef struct DSPContext { /* this might write to dst[w] */ void (*add_png_paeth_prediction)(uint8_t *dst, uint8_t *src, uint8_t *top, int w, int bpp); void (*bswap_buf)(uint32_t *dst, const uint32_t *src, int w); + void (*bswap16_buf)(uint16_t *dst, const uint16_t *src, int len); void (*h263_v_loop_filter)(uint8_t *src, int stride, int qscale); void (*h263_h_loop_filter)(uint8_t *src, int stride, int qscale); From cbf5d22d24945e52b3c1e4c1a00d4d8179be930a Mon Sep 17 00:00:00 2001 From: Ramiro Polla Date: Wed, 16 Mar 2011 15:28:43 -0300 Subject: [PATCH 14/34] Remove occurrences of my old email address Signed-off-by: Mans Rullgard --- libavcodec/mimic.c | 2 +- libavformat/msnwc_tcp.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/mimic.c b/libavcodec/mimic.c index bcf125a262..450dd65784 100644 --- a/libavcodec/mimic.c +++ b/libavcodec/mimic.c @@ -1,6 +1,6 @@ /* * Copyright (C) 2005 Ole André Vadla Ravnås - * Copyright (C) 2008 Ramiro Polla + * Copyright (C) 2008 Ramiro Polla * * This file is part of FFmpeg. * diff --git a/libavformat/msnwc_tcp.c b/libavformat/msnwc_tcp.c index 5af1c4e0ad..692dc1fdb9 100644 --- a/libavformat/msnwc_tcp.c +++ b/libavformat/msnwc_tcp.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008 Ramiro Polla + * Copyright (C) 2008 Ramiro Polla * * This file is part of FFmpeg. * From 45a8a02a4151c9ff0d1161bf90bffcfbbb312fb8 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 15 Mar 2011 09:14:38 +0100 Subject: [PATCH 15/34] lavf: replace avio_seek(SEEK_CUR) with avio_skip where it makes sense Signed-off-by: Ronald S. Bultje --- libavformat/4xm.c | 6 ++-- libavformat/aea.c | 4 +-- libavformat/aiffdec.c | 8 +++--- libavformat/anm.c | 16 +++++------ libavformat/ape.c | 6 ++-- libavformat/asfdec.c | 36 ++++++++++++------------ libavformat/au.c | 2 +- libavformat/avidec.c | 48 ++++++++++++++++---------------- libavformat/avienc.c | 6 ++-- libavformat/avs.c | 4 +-- libavformat/bethsoftvid.c | 2 +- libavformat/bfi.c | 6 ++-- libavformat/bink.c | 8 +++--- libavformat/c93.c | 2 +- libavformat/cafdec.c | 16 +++++------ libavformat/dxa.c | 4 +-- libavformat/eacdata.c | 2 +- libavformat/electronicarts.c | 18 ++++++------ libavformat/ffmdec.c | 2 +- libavformat/filmstripdec.c | 4 +-- libavformat/flacdec.c | 2 +- libavformat/flic.c | 4 +-- libavformat/flvdec.c | 18 ++++++------ libavformat/flvenc.c | 4 +-- libavformat/gxf.c | 28 +++++++++---------- libavformat/id3v2.c | 10 +++---- libavformat/idcin.c | 2 +- libavformat/idroqdec.c | 4 +-- libavformat/iff.c | 14 +++++----- libavformat/ingenientdec.c | 6 ++-- libavformat/ipmovie.c | 24 ++++++++-------- libavformat/iv8.c | 2 +- libavformat/lmlm4.c | 2 +- libavformat/lxfdec.c | 6 ++-- libavformat/matroskadec.c | 6 ++-- libavformat/mm.c | 4 +-- libavformat/mmf.c | 4 +-- libavformat/mov.c | 36 ++++++++++++------------ libavformat/mp3dec.c | 2 +- libavformat/mpc8.c | 4 +-- libavformat/mpeg.c | 18 ++++++------ libavformat/mpegts.c | 2 +- libavformat/msnwc_tcp.c | 12 ++++---- libavformat/mtv.c | 8 +++--- libavformat/mxfdec.c | 22 +++++++-------- libavformat/ncdec.c | 2 +- libavformat/nsvdec.c | 2 +- libavformat/nutdec.c | 4 +-- libavformat/nuv.c | 28 +++++++++---------- libavformat/pva.c | 2 +- libavformat/qcp.c | 14 +++++----- libavformat/r3d.c | 6 ++-- libavformat/rdt.c | 6 ++-- libavformat/riff.c | 4 +-- libavformat/rl2.c | 2 +- libavformat/rmdec.c | 22 +++++++-------- libavformat/rtpdec_asf.c | 10 +++---- libavformat/rtpdec_qt.c | 4 +-- libavformat/sauce.c | 4 +-- libavformat/siff.c | 10 +++---- libavformat/soxdec.c | 6 ++-- libavformat/spdifdec.c | 2 +- libavformat/swfdec.c | 6 ++-- libavformat/tmv.c | 2 +- libavformat/tta.c | 6 ++-- libavformat/txd.c | 2 +- libavformat/vc1test.c | 2 +- libavformat/vocdec.c | 8 +++--- libavformat/vqf.c | 6 ++-- libavformat/wav.c | 10 +++---- libavformat/wc3movie.c | 8 +++--- libavformat/westwood.c | 6 ++-- libavformat/wtv.c | 54 ++++++++++++++++++------------------ libavformat/wv.c | 6 ++-- libavformat/xa.c | 4 +-- libavformat/yop.c | 4 +-- 76 files changed, 348 insertions(+), 348 deletions(-) diff --git a/libavformat/4xm.c b/libavformat/4xm.c index 95bd717915..ee4f54244e 100644 --- a/libavformat/4xm.c +++ b/libavformat/4xm.c @@ -106,7 +106,7 @@ static int fourxm_read_header(AVFormatContext *s, fourxm->fps = 1.0; /* skip the first 3 32-bit numbers */ - avio_seek(pb, 12, SEEK_CUR); + avio_skip(pb, 12); /* check for LIST-HEAD */ GET_LIST_HEADER(); @@ -322,12 +322,12 @@ static int fourxm_read_packet(AVFormatContext *s, fourxm->tracks[track_number].audio_pts += audio_frame_count; } else { - avio_seek(pb, size, SEEK_CUR); + avio_skip(pb, size); } break; default: - avio_seek(pb, size, SEEK_CUR); + avio_skip(pb, size); break; } } diff --git a/libavformat/aea.c b/libavformat/aea.c index 60b2d38fdc..2a1d24d7a2 100644 --- a/libavformat/aea.c +++ b/libavformat/aea.c @@ -62,9 +62,9 @@ static int aea_read_header(AVFormatContext *s, return AVERROR(ENOMEM); /* Parse the amount of channels and skip to pos 2048(0x800) */ - avio_seek(s->pb, 264, SEEK_CUR); + avio_skip(s->pb, 264); st->codec->channels = avio_r8(s->pb); - avio_seek(s->pb, 1783, SEEK_CUR); + avio_skip(s->pb, 1783); st->codec->codec_type = AVMEDIA_TYPE_AUDIO; diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c index 8506d8b5c8..2cec376e14 100644 --- a/libavformat/aiffdec.c +++ b/libavformat/aiffdec.c @@ -70,7 +70,7 @@ static void get_meta(AVFormatContext *s, const char *key, int size) int res; if (!str) { - avio_seek(s->pb, size, SEEK_CUR); + avio_skip(s->pb, size); return; } @@ -152,7 +152,7 @@ static unsigned int get_aiff_header(AVIOContext *pb, AVCodecContext *codec, /* Chunk is over */ if (size) - avio_seek(pb, size, SEEK_CUR); + avio_skip(pb, size); return num_frames; } @@ -242,7 +242,7 @@ static int aiff_read_header(AVFormatContext *s, av_log(s, AV_LOG_ERROR, "file is not seekable\n"); return -1; } - avio_seek(pb, size - 8, SEEK_CUR); + avio_skip(pb, size - 8); break; case MKTAG('w', 'a', 'v', 'e'): if ((uint64_t)size > (1<<30)) @@ -256,7 +256,7 @@ static int aiff_read_header(AVFormatContext *s, default: /* Jump */ if (size & 1) /* Always even aligned */ size++; - avio_seek(pb, size, SEEK_CUR); + avio_skip(pb, size); } } diff --git a/libavformat/anm.c b/libavformat/anm.c index 980920f52a..1f19b50d08 100644 --- a/libavformat/anm.c +++ b/libavformat/anm.c @@ -83,7 +83,7 @@ static int read_header(AVFormatContext *s, AVStream *st; int i, ret; - avio_seek(pb, 4, SEEK_CUR); /* magic number */ + avio_skip(pb, 4); /* magic number */ if (avio_rl16(pb) != MAX_PAGES) { av_log_ask_for_sample(s, "max_pages != " AV_STRINGIFY(MAX_PAGES) "\n"); return AVERROR_INVALIDDATA; @@ -91,7 +91,7 @@ static int read_header(AVFormatContext *s, anm->nb_pages = avio_rl16(pb); anm->nb_records = avio_rl32(pb); - avio_seek(pb, 2, SEEK_CUR); /* max records per page */ + avio_skip(pb, 2); /* max records per page */ anm->page_table_offset = avio_rl16(pb); if (avio_rl32(pb) != ANIM_TAG) return AVERROR_INVALIDDATA; @@ -107,13 +107,13 @@ static int read_header(AVFormatContext *s, st->codec->height = avio_rl16(pb); if (avio_r8(pb) != 0) goto invalid; - avio_seek(pb, 1, SEEK_CUR); /* frame rate multiplier info */ + avio_skip(pb, 1); /* frame rate multiplier info */ /* ignore last delta record (used for looping) */ if (avio_r8(pb)) /* has_last_delta */ anm->nb_records = FFMAX(anm->nb_records - 1, 0); - avio_seek(pb, 1, SEEK_CUR); /* last_delta_valid */ + avio_skip(pb, 1); /* last_delta_valid */ if (avio_r8(pb) != 0) goto invalid; @@ -121,15 +121,15 @@ static int read_header(AVFormatContext *s, if (avio_r8(pb) != 1) goto invalid; - avio_seek(pb, 1, SEEK_CUR); /* other recs per frame */ + avio_skip(pb, 1); /* other recs per frame */ if (avio_r8(pb) != 1) goto invalid; - avio_seek(pb, 32, SEEK_CUR); /* record_types */ + avio_skip(pb, 32); /* record_types */ st->nb_frames = avio_rl32(pb); av_set_pts_info(st, 64, 1, avio_rl16(pb)); - avio_seek(pb, 58, SEEK_CUR); + avio_skip(pb, 58); /* color cycling and palette data */ st->codec->extradata_size = 16*8 + 4*256; @@ -193,7 +193,7 @@ repeat: /* parse page header */ if (anm->record < 0) { avio_seek(pb, anm->page_table_offset + MAX_PAGES*6 + (anm->page<<16), SEEK_SET); - avio_seek(pb, 8 + 2*p->nb_records, SEEK_CUR); + avio_skip(pb, 8 + 2*p->nb_records); anm->record = 0; } diff --git a/libavformat/ape.c b/libavformat/ape.c index dd2aeb9ff3..d9c988753b 100644 --- a/libavformat/ape.c +++ b/libavformat/ape.c @@ -187,7 +187,7 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap) /* Skip any unknown bytes at the end of the descriptor. This is for future compatibility */ if (ape->descriptorlength > 52) - avio_seek(pb, ape->descriptorlength - 52, SEEK_CUR); + avio_skip(pb, ape->descriptorlength - 52); /* Read header data */ ape->compressiontype = avio_rl16(pb); @@ -212,7 +212,7 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap) ape->finalframeblocks = avio_rl32(pb); if (ape->formatflags & MAC_FORMAT_FLAG_HAS_PEAK_LEVEL) { - avio_seek(pb, 4, SEEK_CUR); /* Skip the peak level */ + avio_skip(pb, 4); /* Skip the peak level */ ape->headerlength += 4; } @@ -239,7 +239,7 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap) /* Skip any stored wav header */ if (!(ape->formatflags & MAC_FORMAT_FLAG_CREATE_WAV_HEADER)) - avio_seek(pb, ape->wavheaderlength, SEEK_CUR); + avio_skip(pb, ape->wavheaderlength); } if(!ape->totalframes){ diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index cbcd576c9f..e27c29b193 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -350,7 +350,7 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size) avio_rl16(pb); /* panes */ st->codec->bits_per_coded_sample = avio_rl16(pb); /* depth */ tag1 = avio_rl32(pb); - avio_seek(pb, 20, SEEK_CUR); + avio_skip(pb, 20); // av_log(s, AV_LOG_DEBUG, "size:%d tsize:%d sizeX:%d\n", size, total_size, sizeX); if (sizeX > 40) { st->codec->extradata_size = sizeX - 40; @@ -388,7 +388,7 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size) st->need_parsing = AVSTREAM_PARSE_FULL_ONCE; } pos2 = avio_tell(pb); - avio_seek(pb, size - (pos2 - pos1 + 24), SEEK_CUR); + avio_skip(pb, size - (pos2 - pos1 + 24)); return 0; } @@ -428,14 +428,14 @@ static int asf_read_ext_stream_properties(AVFormatContext *s, int64_t size) for (i=0; istream_languages[j], lang, sizeof(*asf->stream_languages)); } @@ -531,10 +531,10 @@ static int asf_read_metadata(AVFormatContext *s, int64_t size) value_len= avio_rl32(pb); if ((ret = avio_get_str16le(pb, name_len, name, sizeof(name))) < name_len) - avio_seek(pb, name_len - ret, SEEK_CUR); + avio_skip(pb, name_len - ret); //av_log(s, AV_LOG_ERROR, "%d %d %d %d %d <%s>\n", i, stream_num, name_len, value_type, value_len, name); value_num= avio_rl16(pb);//we should use get_value() here but it does not work 2 is le16 here but le32 elsewhere - avio_seek(pb, value_len - 2, SEEK_CUR); + avio_skip(pb, value_len - 2); if(stream_num<128){ if (!strcmp(name, "AspectRatioX")) asf->dar[stream_num].num= value_num; @@ -571,7 +571,7 @@ static int asf_read_marker(AVFormatContext *s, int64_t size) avio_rl32(pb); // flags name_len = avio_rl32(pb); // name length if ((ret = avio_get_str16le(pb, name_len * 2, name, sizeof(name))) < name_len) - avio_seek(pb, name_len - ret, SEEK_CUR); + avio_skip(pb, name_len - ret); ff_new_chapter(s, i, (AVRational){1, 10000000}, pres_time, AV_NOPTS_VALUE, name ); } @@ -826,16 +826,16 @@ static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb){ // for(i=0; ipacket_replic_size-8; i++) // av_log(s, AV_LOG_DEBUG, "%02X ",avio_r8(pb)); // av_log(s, AV_LOG_DEBUG, "\n"); - avio_seek(pb, 10, SEEK_CUR); + avio_skip(pb, 10); ts0= avio_rl64(pb); ts1= avio_rl64(pb); - avio_seek(pb, 12, SEEK_CUR); + avio_skip(pb, 12); avio_rl32(pb); - avio_seek(pb, asf->packet_replic_size - 8 - 38 - 4, SEEK_CUR); + avio_skip(pb, asf->packet_replic_size - 8 - 38 - 4); if(ts0!= -1) asf->packet_frag_timestamp= ts0/10000; else asf->packet_frag_timestamp= AV_NOPTS_VALUE; }else - avio_seek(pb, asf->packet_replic_size - 8, SEEK_CUR); + avio_skip(pb, asf->packet_replic_size - 8); rsize += asf->packet_replic_size; // FIXME - check validity } else if (asf->packet_replic_size==1){ // multipacket - frag_offset is beginning timestamp @@ -895,7 +895,7 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk //printf("PacketLeftSize:%d Pad:%d Pos:%"PRId64"\n", asf->packet_size_left, asf->packet_padsize, avio_tell(pb)); assert(ret>=0); /* fail safe */ - avio_seek(pb, ret, SEEK_CUR); + avio_skip(pb, ret); asf->packet_pos= avio_tell(pb); if (asf->data_object_size != (uint64_t)-1 && @@ -914,7 +914,7 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk ) { asf->packet_time_start = 0; /* unhandled packet (should not happen) */ - avio_seek(pb, asf->packet_frag_size, SEEK_CUR); + avio_skip(pb, asf->packet_frag_size); asf->packet_size_left -= asf->packet_frag_size; if(asf->stream_index < 0) av_log(s, AV_LOG_ERROR, "ff asf skip %d (unknown stream)\n", asf->packet_frag_size); @@ -934,7 +934,7 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk if (asf->packet_multi_size < asf->packet_obj_size) { asf->packet_time_start = 0; - avio_seek(pb, asf->packet_multi_size, SEEK_CUR); + avio_skip(pb, asf->packet_multi_size); asf->packet_size_left -= asf->packet_multi_size; continue; } @@ -1199,7 +1199,7 @@ static void asf_build_simple_index(AVFormatContext *s, int stream_index) avio_seek(s->pb, current_pos, SEEK_SET); return; } - avio_seek(s->pb, gsize-24, SEEK_CUR); + avio_skip(s->pb, gsize-24); ff_get_guid(s->pb, &g); } diff --git a/libavformat/au.c b/libavformat/au.c index 9ea4010039..3ee0e45fb6 100644 --- a/libavformat/au.c +++ b/libavformat/au.c @@ -147,7 +147,7 @@ static int au_read_header(AVFormatContext *s, if (size >= 24) { /* skip unused data */ - avio_seek(pb, size - 24, SEEK_CUR); + avio_skip(pb, size - 24); } /* now we are ready: build format streams */ diff --git a/libavformat/avidec.c b/libavformat/avidec.c index 8181298959..83b476144e 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -321,12 +321,12 @@ static void avi_read_nikon(AVFormatContext *s, uint64_t end) } if (name) av_metadata_set2(&s->metadata, name, buffer, 0); - avio_seek(s->pb, size, SEEK_CUR); + avio_skip(s->pb, size); } break; } default: - avio_seek(s->pb, size, SEEK_CUR); + avio_skip(s->pb, size); break; } } @@ -392,13 +392,13 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) unsigned char date[64] = {0}; size += (size & 1); size -= avio_read(pb, date, FFMIN(size, sizeof(date)-1)); - avio_seek(pb, size, SEEK_CUR); + avio_skip(pb, size); avi_metadata_creation_time(&s->metadata, date); break; } case MKTAG('d', 'm', 'l', 'h'): avi->is_odml = 1; - avio_seek(pb, size + (size & 1), SEEK_CUR); + avio_skip(pb, size + (size & 1)); break; case MKTAG('a', 'm', 'v', 'h'): amv_file_format=1; @@ -410,13 +410,13 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) avio_rl32(pb); avi->non_interleaved |= avio_rl32(pb) & AVIF_MUSTUSEINDEX; - avio_seek(pb, 2 * 4, SEEK_CUR); + avio_skip(pb, 2 * 4); avio_rl32(pb); avio_rl32(pb); avih_width=avio_rl32(pb); avih_height=avio_rl32(pb); - avio_seek(pb, size - 10 * 4, SEEK_CUR); + avio_skip(pb, size - 10 * 4); break; case MKTAG('s', 't', 'r', 'h'): /* stream header */ @@ -425,7 +425,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) handler = avio_rl32(pb); /* codec tag */ if(tag1 == MKTAG('p', 'a', 'd', 's')){ - avio_seek(pb, size - 8, SEEK_CUR); + avio_skip(pb, size - 8); break; }else{ stream_index++; @@ -469,10 +469,10 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) goto fail; } s->streams[0]->priv_data = ast; - avio_seek(pb, 3 * 4, SEEK_CUR); + avio_skip(pb, 3 * 4); ast->scale = avio_rl32(pb); ast->rate = avio_rl32(pb); - avio_seek(pb, 4, SEEK_CUR); /* start time */ + avio_skip(pb, 4); /* start time */ dv_dur = avio_rl32(pb); if (ast->scale > 0 && ast->rate > 0 && dv_dur > 0) { @@ -485,7 +485,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) */ stream_index = s->nb_streams - 1; - avio_seek(pb, size - 9*4, SEEK_CUR); + avio_skip(pb, size - 9*4); break; } @@ -542,12 +542,12 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) if(ast->sample_size == 0) st->duration = st->nb_frames; ast->frame_offset= ast->cum_len; - avio_seek(pb, size - 12 * 4, SEEK_CUR); + avio_skip(pb, size - 12 * 4); break; case MKTAG('s', 't', 'r', 'f'): /* stream header */ if (stream_index >= (unsigned)s->nb_streams || avi->dv_demux) { - avio_seek(pb, size, SEEK_CUR); + avio_skip(pb, size); } else { uint64_t cur_pos = avio_tell(pb); if (cur_pos < list_end) @@ -560,7 +560,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) st->codec->height=avih_height; st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = CODEC_ID_AMV; - avio_seek(pb, size, SEEK_CUR); + avio_skip(pb, size); break; } tag1 = ff_get_bmp_header(pb, st); @@ -620,7 +620,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) } st->codec->height= FFABS(st->codec->height); -// avio_seek(pb, size - 5 * 4, SEEK_CUR); +// avio_skip(pb, size - 5 * 4); break; case AVMEDIA_TYPE_AUDIO: ff_get_wav_header(pb, st->codec, size); @@ -630,7 +630,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) ast->sample_size= st->codec->block_align; } if (size&1) /* 2-aligned (fix for Stargate SG-1 - 3x18 - Shades of Grey.avi) */ - avio_seek(pb, 1, SEEK_CUR); + avio_skip(pb, 1); /* Force parsing as several audio frames can be in * one packet and timestamps refer to packet start. */ st->need_parsing = AVSTREAM_PARSE_TIMESTAMPS; @@ -658,7 +658,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) st->codec->codec_type = AVMEDIA_TYPE_DATA; st->codec->codec_id= CODEC_ID_NONE; st->codec->codec_tag= 0; - avio_seek(pb, size, SEEK_CUR); + avio_skip(pb, size); break; } } @@ -693,7 +693,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) } size -= 9*4; } - avio_seek(pb, size, SEEK_CUR); + avio_skip(pb, size); break; case MKTAG('s', 't', 'r', 'n'): if(s->nb_streams){ @@ -710,7 +710,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) } /* skip tag */ size += (size & 1); - avio_seek(pb, size, SEEK_CUR); + avio_skip(pb, size); break; } } @@ -762,7 +762,7 @@ static int read_gab2_sub(AVStream *st, AVPacket *pkt) { goto error; ret = avio_get_str16le(pb, desc_len, desc, sizeof(desc)); - avio_seek(pb, desc_len - ret, SEEK_CUR); + avio_skip(pb, desc_len - ret); if (*desc) av_metadata_set2(&st->metadata, "title", desc, 0); @@ -1008,14 +1008,14 @@ resync: //parse JUNK ||(d[0] == 'J' && d[1] == 'U' && d[2] == 'N' && d[3] == 'K') ||(d[0] == 'i' && d[1] == 'd' && d[2] == 'x' && d[3] == '1')){ - avio_seek(pb, size, SEEK_CUR); + avio_skip(pb, size); //av_log(s, AV_LOG_DEBUG, "SKIP\n"); goto resync; } //parse stray LIST if(d[0] == 'L' && d[1] == 'I' && d[2] == 'S' && d[3] == 'T'){ - avio_seek(pb, 4, SEEK_CUR); + avio_skip(pb, 4); goto resync; } @@ -1026,7 +1026,7 @@ resync: //detect ##ix chunk and skip if(d[2] == 'i' && d[3] == 'x' && n < s->nb_streams){ - avio_seek(pb, size, SEEK_CUR); + avio_skip(pb, size); goto resync; } @@ -1060,7 +1060,7 @@ resync: /*|| (st->discard >= AVDISCARD_NONKEY && !(pkt->flags & AV_PKT_FLAG_KEY))*/ //FIXME needs a little reordering || st->discard >= AVDISCARD_ALL){ ast->frame_offset += get_duration(ast, size); - avio_seek(pb, size, SEEK_CUR); + avio_skip(pb, size); goto resync; } @@ -1225,7 +1225,7 @@ static int avi_load_index(AVFormatContext *s) default: skip: size += (size & 1); - if (avio_seek(pb, size, SEEK_CUR) < 0) + if (avio_skip(pb, size) < 0) goto the_end; // something is wrong here break; } diff --git a/libavformat/avienc.c b/libavformat/avienc.c index 8d9980cf46..3604a6c399 100644 --- a/libavformat/avienc.c +++ b/libavformat/avienc.c @@ -444,9 +444,9 @@ static int avi_write_ix(AVFormatContext *s) /* Updating one entry in the AVI OpenDML master index */ avio_seek(pb, avist->indexes.indx_start - 8, SEEK_SET); ffio_wfourcc(pb, "indx"); /* enabling this entry */ - avio_seek(pb, 8, SEEK_CUR); + avio_skip(pb, 8); avio_wl32(pb, avi->riff_id); /* nEntriesInUse */ - avio_seek(pb, 16*avi->riff_id, SEEK_CUR); + avio_skip(pb, 16*avi->riff_id); avio_wl64(pb, ix); /* qwOffset */ avio_wl32(pb, pos - ix); /* dwSize */ avio_wl32(pb, avist->indexes.entry); /* dwDuration */ @@ -603,7 +603,7 @@ static int avi_write_trailer(AVFormatContext *s) file_size = avio_tell(pb); avio_seek(pb, avi->odml_list - 8, SEEK_SET); ffio_wfourcc(pb, "LIST"); /* Making this AVI OpenDML one */ - avio_seek(pb, 16, SEEK_CUR); + avio_skip(pb, 16); for (n=nb_frames=0;nnb_streams;n++) { AVCodecContext *stream = s->streams[n]->codec; diff --git a/libavformat/avs.c b/libavformat/avs.c index 0ddb0af06d..355ae31f35 100644 --- a/libavformat/avs.c +++ b/libavformat/avs.c @@ -61,7 +61,7 @@ static int avs_read_header(AVFormatContext * s, AVFormatParameters * ap) s->ctx_flags |= AVFMTCTX_NOHEADER; - avio_seek(s->pb, 4, SEEK_CUR); + avio_skip(s->pb, 4); avs->width = avio_rl16(s->pb); avs->height = avio_rl16(s->pb); avs->bits_per_sample = avio_rl16(s->pb); @@ -204,7 +204,7 @@ static int avs_read_packet(AVFormatContext * s, AVPacket * pkt) break; default: - avio_seek(s->pb, size - 4, SEEK_CUR); + avio_skip(s->pb, size - 4); } } } diff --git a/libavformat/bethsoftvid.c b/libavformat/bethsoftvid.c index 0b45115f0c..e371a2a80c 100644 --- a/libavformat/bethsoftvid.c +++ b/libavformat/bethsoftvid.c @@ -67,7 +67,7 @@ static int vid_read_header(AVFormatContext *s, * bytes: 'V' 'I' 'D' * int16s: always_512, nframes, width, height, delay, always_14 */ - avio_seek(pb, 5, SEEK_CUR); + avio_skip(pb, 5); vid->nframes = avio_rl16(pb); stream = av_new_stream(s, 0); diff --git a/libavformat/bfi.c b/libavformat/bfi.c index cec02fd646..5b72322320 100644 --- a/libavformat/bfi.c +++ b/libavformat/bfi.c @@ -65,19 +65,19 @@ static int bfi_read_header(AVFormatContext * s, AVFormatParameters * ap) return AVERROR(ENOMEM); /* Set the total number of frames. */ - avio_seek(pb, 8, SEEK_CUR); + avio_skip(pb, 8); chunk_header = avio_rl32(pb); bfi->nframes = avio_rl32(pb); avio_rl32(pb); avio_rl32(pb); avio_rl32(pb); fps = avio_rl32(pb); - avio_seek(pb, 12, SEEK_CUR); + avio_skip(pb, 12); vstream->codec->width = avio_rl32(pb); vstream->codec->height = avio_rl32(pb); /*Load the palette to extradata */ - avio_seek(pb, 8, SEEK_CUR); + avio_skip(pb, 8); vstream->codec->extradata = av_malloc(768); vstream->codec->extradata_size = 768; avio_read(pb, vstream->codec->extradata, diff --git a/libavformat/bink.c b/libavformat/bink.c index 22beb4cbbd..4622f89e5a 100644 --- a/libavformat/bink.c +++ b/libavformat/bink.c @@ -98,7 +98,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) return AVERROR(EIO); } - avio_seek(pb, 4, SEEK_CUR); + avio_skip(pb, 4); vst->codec->width = avio_rl32(pb); vst->codec->height = avio_rl32(pb); @@ -127,7 +127,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) } if (bink->num_audio_tracks) { - avio_seek(pb, 4 * bink->num_audio_tracks, SEEK_CUR); + avio_skip(pb, 4 * bink->num_audio_tracks); for (i = 0; i < bink->num_audio_tracks; i++) { ast = av_new_stream(s, 1); @@ -169,7 +169,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) keyframe ? AVINDEX_KEYFRAME : 0); } - avio_seek(pb, 4, SEEK_CUR); + avio_skip(pb, 4); bink->current_track = -1; return 0; @@ -225,7 +225,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) AV_RL32(pkt->data) / (2 * s->streams[bink->current_track]->codec->channels); return 0; } else { - avio_seek(pb, audio_size, SEEK_CUR); + avio_skip(pb, audio_size); } } diff --git a/libavformat/c93.c b/libavformat/c93.c index a4a0fe3ad0..270a09bf6b 100644 --- a/libavformat/c93.c +++ b/libavformat/c93.c @@ -122,7 +122,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) return AVERROR(ENOMEM); c93->audio->codec->codec_type = AVMEDIA_TYPE_AUDIO; } - avio_seek(pb, 26, SEEK_CUR); /* VOC header */ + avio_skip(pb, 26); /* VOC header */ ret = voc_get_packet(s, pkt, c93->audio, datasize - 26); if (ret > 0) { pkt->stream_index = 1; diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c index ec3054ff2b..82db4efef4 100644 --- a/libavformat/cafdec.c +++ b/libavformat/cafdec.c @@ -114,22 +114,22 @@ static int read_kuki_chunk(AVFormatContext *s, int64_t size) av_log(s, AV_LOG_ERROR, "invalid AAC magic cookie\n"); return AVERROR_INVALIDDATA; } - avio_seek(pb, skip, SEEK_CUR); + avio_skip(pb, skip); } else if (st->codec->codec_id == CODEC_ID_ALAC) { #define ALAC_PREAMBLE 12 #define ALAC_HEADER 36 if (size < ALAC_PREAMBLE + ALAC_HEADER) { av_log(s, AV_LOG_ERROR, "invalid ALAC magic cookie\n"); - avio_seek(pb, size, SEEK_CUR); + avio_skip(pb, size); return AVERROR_INVALIDDATA; } - avio_seek(pb, ALAC_PREAMBLE, SEEK_CUR); + avio_skip(pb, ALAC_PREAMBLE); st->codec->extradata = av_mallocz(ALAC_HEADER + FF_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) return AVERROR(ENOMEM); avio_read(pb, st->codec->extradata, ALAC_HEADER); st->codec->extradata_size = ALAC_HEADER; - avio_seek(pb, size - ALAC_PREAMBLE - ALAC_HEADER, SEEK_CUR); + avio_skip(pb, size - ALAC_PREAMBLE - ALAC_HEADER); } else { st->codec->extradata = av_mallocz(size + FF_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) @@ -201,7 +201,7 @@ static int read_header(AVFormatContext *s, int found_data, ret; int64_t size; - avio_seek(pb, 8, SEEK_CUR); /* magic, version, file flags */ + avio_skip(pb, 8); /* magic, version, file flags */ /* audio description chunk */ if (avio_rb32(pb) != MKBETAG('d','e','s','c')) { @@ -233,11 +233,11 @@ static int read_header(AVFormatContext *s, switch (tag) { case MKBETAG('d','a','t','a'): - avio_seek(pb, 4, SEEK_CUR); /* edit count */ + avio_skip(pb, 4); /* edit count */ caf->data_start = avio_tell(pb); caf->data_size = size < 0 ? -1 : size - 4; if (caf->data_size > 0 && !url_is_streamed(pb)) - avio_seek(pb, caf->data_size, SEEK_CUR); + avio_skip(pb, caf->data_size); found_data = 1; break; @@ -265,7 +265,7 @@ static int read_header(AVFormatContext *s, case MKBETAG('f','r','e','e'): if (size < 0) return AVERROR_INVALIDDATA; - avio_seek(pb, size, SEEK_CUR); + avio_skip(pb, size); break; } } diff --git a/libavformat/dxa.c b/libavformat/dxa.c index 2c599865bb..6b9a55221a 100644 --- a/libavformat/dxa.c +++ b/libavformat/dxa.c @@ -96,7 +96,7 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap) c->has_sound = 1; size = avio_rb32(pb); c->vidpos = avio_tell(pb) + size; - avio_seek(pb, 16, SEEK_CUR); + avio_skip(pb, 16); fsize = avio_rl32(pb); ast = av_new_stream(s, 0); @@ -108,7 +108,7 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap) tag = avio_rl32(pb); fsize = avio_rl32(pb); if(tag == MKTAG('d', 'a', 't', 'a')) break; - avio_seek(pb, fsize, SEEK_CUR); + avio_skip(pb, fsize); } c->bpc = (fsize + c->frames - 1) / c->frames; if(ast->codec->block_align) diff --git a/libavformat/eacdata.c b/libavformat/eacdata.c index 8fc8c4221e..7b109ff888 100644 --- a/libavformat/eacdata.c +++ b/libavformat/eacdata.c @@ -62,7 +62,7 @@ static int cdata_read_header(AVFormatContext *s, AVFormatParameters *ap) }; sample_rate = avio_rb16(pb); - avio_seek(pb, 12, SEEK_CUR); + avio_skip(pb, 12); st = av_new_stream(s, 0); if (!st) diff --git a/libavformat/electronicarts.c b/libavformat/electronicarts.c index a43cfc8d66..d4d0d553ba 100644 --- a/libavformat/electronicarts.c +++ b/libavformat/electronicarts.c @@ -222,7 +222,7 @@ static int process_audio_header_eacs(AVFormatContext *s) ea->bytes = avio_r8(pb); /* 1=8-bit, 2=16-bit */ ea->num_channels = avio_r8(pb); compression_type = avio_r8(pb); - avio_seek(pb, 13, SEEK_CUR); + avio_skip(pb, 13); switch (compression_type) { case 0: @@ -261,7 +261,7 @@ static int process_video_header_mdec(AVFormatContext *s) { EaDemuxContext *ea = s->priv_data; AVIOContext *pb = s->pb; - avio_seek(pb, 4, SEEK_CUR); + avio_skip(pb, 4); ea->width = avio_rl16(pb); ea->height = avio_rl16(pb); ea->time_base = (AVRational){1,15}; @@ -274,7 +274,7 @@ static int process_video_header_vp6(AVFormatContext *s) EaDemuxContext *ea = s->priv_data; AVIOContext *pb = s->pb; - avio_seek(pb, 16, SEEK_CUR); + avio_skip(pb, 16); ea->time_base.den = avio_rl32(pb); ea->time_base.num = avio_rl32(pb); ea->video_codec = CODEC_ID_VP6; @@ -316,7 +316,7 @@ static int process_ea_header(AVFormatContext *s) { case SHEN_TAG : blockid = avio_rl32(pb); if (blockid == GSTR_TAG) { - avio_seek(pb, 4, SEEK_CUR); + avio_skip(pb, 4); } else if ((blockid & 0xFFFF)!=PT00_TAG) { av_log (s, AV_LOG_ERROR, "unknown SCHl headerid\n"); return 0; @@ -474,19 +474,19 @@ static int ea_read_packet(AVFormatContext *s, /* audio data */ case ISNh_TAG: /* header chunk also contains data; skip over the header portion*/ - avio_seek(pb, 32, SEEK_CUR); + avio_skip(pb, 32); chunk_size -= 32; case ISNd_TAG: case SCDl_TAG: case SNDC_TAG: case SDEN_TAG: if (!ea->audio_codec) { - avio_seek(pb, chunk_size, SEEK_CUR); + avio_skip(pb, chunk_size); break; } else if (ea->audio_codec == CODEC_ID_PCM_S16LE_PLANAR || ea->audio_codec == CODEC_ID_MP3) { num_samples = avio_rl32(pb); - avio_seek(pb, 8, SEEK_CUR); + avio_skip(pb, 8); chunk_size -= 12; } ret = av_get_packet(pb, pkt, chunk_size); @@ -541,7 +541,7 @@ static int ea_read_packet(AVFormatContext *s, goto get_video_packet; case mTCD_TAG: - avio_seek(pb, 8, SEEK_CUR); // skip ea dct header + avio_skip(pb, 8); // skip ea dct header chunk_size -= 8; goto get_video_packet; @@ -560,7 +560,7 @@ get_video_packet: break; default: - avio_seek(pb, chunk_size, SEEK_CUR); + avio_skip(pb, chunk_size); break; } } diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c index 1b5be16ff7..591a83525f 100644 --- a/libavformat/ffmdec.c +++ b/libavformat/ffmdec.c @@ -187,7 +187,7 @@ static int64_t get_dts(AVFormatContext *s, int64_t pos) int64_t dts; ffm_seek1(s, pos); - avio_seek(pb, 4, SEEK_CUR); + avio_skip(pb, 4); dts = avio_rb64(pb); #ifdef DEBUG_SEEK av_log(s, AV_LOG_DEBUG, "dts=%0.6f\n", dts / 1000000.0); diff --git a/libavformat/filmstripdec.c b/libavformat/filmstripdec.c index 568bc0d17a..107f9e3622 100644 --- a/libavformat/filmstripdec.c +++ b/libavformat/filmstripdec.c @@ -59,7 +59,7 @@ static int read_header(AVFormatContext *s, return AVERROR_INVALIDDATA; } - avio_seek(pb, 2, SEEK_CUR); + avio_skip(pb, 2); st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = CODEC_ID_RAWVIDEO; st->codec->pix_fmt = PIX_FMT_RGBA; @@ -84,7 +84,7 @@ static int read_packet(AVFormatContext *s, return AVERROR(EIO); pkt->dts = avio_tell(s->pb) / (st->codec->width * (st->codec->height + film->leading) * 4); pkt->size = av_get_packet(s->pb, pkt, st->codec->width * st->codec->height * 4); - avio_seek(s->pb, st->codec->width * film->leading * 4, SEEK_CUR); + avio_skip(s->pb, st->codec->width * film->leading * 4); if (pkt->size < 0) return pkt->size; pkt->flags |= AV_PKT_FLAG_KEY; diff --git a/libavformat/flacdec.c b/libavformat/flacdec.c index e935c3f168..8ab4d9a80c 100644 --- a/libavformat/flacdec.c +++ b/libavformat/flacdec.c @@ -65,7 +65,7 @@ static int flac_read_header(AVFormatContext *s, break; /* skip metadata block for unsupported types */ default: - ret = avio_seek(s->pb, metadata_size, SEEK_CUR); + ret = avio_skip(s->pb, metadata_size); if (ret < 0) return ret; } diff --git a/libavformat/flic.c b/libavformat/flic.c index 520ba6423e..d6aadb7730 100644 --- a/libavformat/flic.c +++ b/libavformat/flic.c @@ -239,7 +239,7 @@ static int flic_read_packet(AVFormatContext *s, } /* skip useless 10B sub-header (yes, it's not accounted for in the chunk header) */ - avio_seek(pb, 10, SEEK_CUR); + avio_skip(pb, 10); pkt->stream_index = flic->audio_stream_index; pkt->pos = avio_tell(pb); @@ -253,7 +253,7 @@ static int flic_read_packet(AVFormatContext *s, packet_read = 1; } else { /* not interested in this chunk */ - avio_seek(pb, size - 6, SEEK_CUR); + avio_skip(pb, size - 6); } } diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index bb27131cfd..65d77fcc7d 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -113,7 +113,7 @@ static int flv_set_video_codec(AVFormatContext *s, AVStream *vstream, int flv_co static int amf_get_string(AVIOContext *ioc, char *buffer, int buffsize) { int length = avio_rb16(ioc); if(length >= buffsize) { - avio_seek(ioc, length, SEEK_CUR); + avio_skip(ioc, length); return -1; } @@ -149,7 +149,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst unsigned int keylen; while(avio_tell(ioc) < max_pos - 2 && (keylen = avio_rb16(ioc))) { - avio_seek(ioc, keylen, SEEK_CUR); //skip key string + avio_skip(ioc, keylen); //skip key string if(amf_parse_object(s, NULL, NULL, NULL, max_pos, depth + 1) < 0) return -1; //if we couldn't skip, bomb out. } @@ -162,7 +162,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst case AMF_DATA_TYPE_UNSUPPORTED: break; //these take up no additional space case AMF_DATA_TYPE_MIXEDARRAY: - avio_seek(ioc, 4, SEEK_CUR); //skip 32-bit max array index + avio_skip(ioc, 4); //skip 32-bit max array index while(avio_tell(ioc) < max_pos - 2 && amf_get_string(ioc, str_val, sizeof(str_val)) > 0) { //this is the only case in which we would want a nested parse to not skip over the object if(amf_parse_object(s, astream, vstream, str_val, max_pos, depth + 1) < 0) @@ -182,7 +182,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst } break; case AMF_DATA_TYPE_DATE: - avio_seek(ioc, 8 + 2, SEEK_CUR); //timestamp (double) and UTC offset (int16) + avio_skip(ioc, 8 + 2); //timestamp (double) and UTC offset (int16) break; default: //unsupported type, we couldn't skip return -1; @@ -254,7 +254,7 @@ static int flv_read_header(AVFormatContext *s, { int offset, flags; - avio_seek(s->pb, 4, SEEK_CUR); + avio_skip(s->pb, 4); flags = avio_r8(s->pb); /* old flvtool cleared this field */ /* FIXME: better fix needed */ @@ -278,7 +278,7 @@ static int flv_read_header(AVFormatContext *s, offset = avio_rb32(s->pb); avio_seek(s->pb, offset, SEEK_SET); - avio_seek(s->pb, 4, SEEK_CUR); + avio_skip(s->pb, 4); s->start_time = 0; @@ -304,7 +304,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) int64_t dts, pts = AV_NOPTS_VALUE; AVStream *st = NULL; - for(;;avio_seek(s->pb, 4, SEEK_CUR)){ /* pkt size is repeated at end. skip it */ + for(;;avio_skip(s->pb, 4)){ /* pkt size is repeated at end. skip it */ pos = avio_tell(s->pb); type = avio_r8(s->pb); size = avio_rb24(s->pb); @@ -313,7 +313,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) // av_log(s, AV_LOG_DEBUG, "type:%d, size:%d, dts:%d\n", type, size, dts); if (s->pb->eof_reached) return AVERROR_EOF; - avio_seek(s->pb, 3, SEEK_CUR); /* stream id, always 0 */ + avio_skip(s->pb, 3); /* stream id, always 0 */ flags = 0; if(size == 0) @@ -454,7 +454,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) pkt->flags |= AV_PKT_FLAG_KEY; leave: - avio_seek(s->pb, 4, SEEK_CUR); + avio_skip(s->pb, 4); return ret; } diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c index 68da7f6907..a1ed705d7b 100644 --- a/libavformat/flvenc.c +++ b/libavformat/flvenc.c @@ -291,7 +291,7 @@ static int flv_write_header(AVFormatContext *s) data_size= avio_tell(pb) - metadata_size_pos - 10; avio_seek(pb, metadata_size_pos, SEEK_SET); avio_wb24(pb, data_size); - avio_seek(pb, data_size + 10 - 3, SEEK_CUR); + avio_skip(pb, data_size + 10 - 3); avio_wb32(pb, data_size + 11); for (i = 0; i < s->nb_streams; i++) { @@ -318,7 +318,7 @@ static int flv_write_header(AVFormatContext *s) data_size = avio_tell(pb) - pos; avio_seek(pb, -data_size - 10, SEEK_CUR); avio_wb24(pb, data_size); - avio_seek(pb, data_size + 10 - 3, SEEK_CUR); + avio_skip(pb, data_size + 10 - 3); avio_wb32(pb, data_size + 11); // previous tag size } } diff --git a/libavformat/gxf.c b/libavformat/gxf.c index 9e47249152..e959bf9dc4 100644 --- a/libavformat/gxf.c +++ b/libavformat/gxf.c @@ -174,7 +174,7 @@ static void gxf_material_tags(AVIOContext *pb, int *len, struct gxf_stream_info else if (tag == MAT_LAST_FIELD) si->last_field = value; } else - avio_seek(pb, tlen, SEEK_CUR); + avio_skip(pb, tlen); } } @@ -223,7 +223,7 @@ static void gxf_track_tags(AVIOContext *pb, int *len, struct gxf_stream_info *si else if (tag == TRACK_FPF && (value == 1 || value == 2)) si->fields_per_frame = value; } else - avio_seek(pb, tlen, SEEK_CUR); + avio_skip(pb, tlen); } } @@ -238,7 +238,7 @@ static void gxf_read_index(AVFormatContext *s, int pkt_len) { int i; pkt_len -= 8; if (s->flags & AVFMT_FLAG_IGNIDX) { - avio_seek(pb, pkt_len, SEEK_CUR); + avio_skip(pb, pkt_len); return; } if (map_cnt > 1000) { @@ -247,7 +247,7 @@ static void gxf_read_index(AVFormatContext *s, int pkt_len) { } if (pkt_len < 4 * map_cnt) { av_log(s, AV_LOG_ERROR, "invalid index length\n"); - avio_seek(pb, pkt_len, SEEK_CUR); + avio_skip(pb, pkt_len); return; } pkt_len -= 4 * map_cnt; @@ -255,7 +255,7 @@ static void gxf_read_index(AVFormatContext *s, int pkt_len) { for (i = 0; i < map_cnt; i++) av_add_index_entry(st, (uint64_t)avio_rl32(pb) * 1024, i * (uint64_t)fields_per_map + 1, 0, 0, 0); - avio_seek(pb, pkt_len, SEEK_CUR); + avio_skip(pb, pkt_len); } static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) { @@ -283,7 +283,7 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) { } map_len -= len; gxf_material_tags(pb, &len, &si); - avio_seek(pb, len, SEEK_CUR); + avio_skip(pb, len); map_len -= 2; len = avio_rb16(pb); // length of track description if (len > map_len) { @@ -301,7 +301,7 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) { track_len = avio_rb16(pb); len -= track_len; gxf_track_tags(pb, &track_len, &si); - avio_seek(pb, track_len, SEEK_CUR); + avio_skip(pb, track_len); if (!(track_type & 0x80)) { av_log(s, AV_LOG_ERROR, "invalid track type %x\n", track_type); continue; @@ -326,7 +326,7 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) { if (len < 0) av_log(s, AV_LOG_ERROR, "invalid track description length specified\n"); if (map_len) - avio_seek(pb, map_len, SEEK_CUR); + avio_skip(pb, map_len); if (!parse_packet_header(pb, &pkt_type, &len)) { av_log(s, AV_LOG_ERROR, "sync lost in header\n"); return -1; @@ -342,8 +342,8 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) { if (len >= 0x39) { AVRational fps; len -= 0x39; - avio_seek(pb, 5, SEEK_CUR); // preamble - avio_seek(pb, 0x30, SEEK_CUR); // payload description + avio_skip(pb, 5); // preamble + avio_skip(pb, 0x30); // payload description fps = fps_umf2avr(avio_rl32(pb)); if (!main_timebase.num || !main_timebase.den) { // this may not always be correct, but simply the best we can get @@ -354,7 +354,7 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) { av_log(s, AV_LOG_INFO, "UMF packet too short\n"); } else av_log(s, AV_LOG_INFO, "UMF packet missing\n"); - avio_seek(pb, len, SEEK_CUR); + avio_skip(pb, len); // set a fallback value, 60000/1001 is specified for audio-only files // so use that regardless of why we do not know the video frame rate. if (!main_timebase.num || !main_timebase.den) @@ -437,7 +437,7 @@ static int gxf_packet(AVFormatContext *s, AVPacket *pkt) { continue; } if (pkt_type != PKT_MEDIA) { - avio_seek(pb, pkt_len, SEEK_CUR); + avio_skip(pb, pkt_len); continue; } if (pkt_len < 16) { @@ -462,7 +462,7 @@ static int gxf_packet(AVFormatContext *s, AVPacket *pkt) { int last = field_info & 0xffff; // last is exclusive int bps = av_get_bits_per_sample(st->codec->codec_id)>>3; if (first <= last && last*bps <= pkt_len) { - avio_seek(pb, first*bps, SEEK_CUR); + avio_skip(pb, first*bps); skip = pkt_len - last*bps; pkt_len = (last-first)*bps; } else @@ -470,7 +470,7 @@ static int gxf_packet(AVFormatContext *s, AVPacket *pkt) { } ret = av_get_packet(pb, pkt, pkt_len); if (skip) - avio_seek(pb, skip, SEEK_CUR); + avio_skip(pb, skip); pkt->stream_index = stream_index; pkt->dts = field_nr; return ret; diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c index be88d10caa..b288ec6eec 100644 --- a/libavformat/id3v2.c +++ b/libavformat/id3v2.c @@ -217,7 +217,7 @@ static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t unsync = flags & 0x80; if (isv34 && flags & 0x40) /* Extended header present, just skip over it */ - avio_seek(s->pb, get_size(s->pb, 4), SEEK_CUR); + avio_skip(s->pb, get_size(s->pb, 4)); while (len >= taghdrlen) { unsigned int tflags; @@ -251,7 +251,7 @@ static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t if (tflags & (ID3v2_FLAG_ENCRYPTION | ID3v2_FLAG_COMPRESSION)) { av_log(s, AV_LOG_WARNING, "Skipping encrypted/compressed ID3v2 frame %s.\n", tag); - avio_seek(s->pb, tlen, SEEK_CUR); + avio_skip(s->pb, tlen); } else if (tag[0] == 'T') { if (unsync || tunsync) { int i, j; @@ -272,7 +272,7 @@ static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t else if (!tag[0]) { if (tag[1]) av_log(s, AV_LOG_WARNING, "invalid frame id, assuming padding"); - avio_seek(s->pb, tlen, SEEK_CUR); + avio_skip(s->pb, tlen); break; } /* Skip to end of tag */ @@ -281,10 +281,10 @@ static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t if (len > 0) { /* Skip padding */ - avio_seek(s->pb, len, SEEK_CUR); + avio_skip(s->pb, len); } if (version == 4 && flags & 0x10) /* Footer preset, always 10 bytes, skip over it */ - avio_seek(s->pb, 10, SEEK_CUR); + avio_skip(s->pb, 10); av_free(buffer); return; diff --git a/libavformat/idcin.c b/libavformat/idcin.c index 78e6caf1ca..5c1d48df4c 100644 --- a/libavformat/idcin.c +++ b/libavformat/idcin.c @@ -257,7 +257,7 @@ static int idcin_read_packet(AVFormatContext *s, chunk_size = avio_rl32(pb); /* skip the number of decoded bytes (always equal to width * height) */ - avio_seek(pb, 4, SEEK_CUR); + avio_skip(pb, 4); chunk_size -= 4; ret= av_get_packet(pb, pkt, chunk_size); if (ret < 0) diff --git a/libavformat/idroqdec.c b/libavformat/idroqdec.c index 1feb236188..92c48d42fe 100644 --- a/libavformat/idroqdec.c +++ b/libavformat/idroqdec.c @@ -136,14 +136,14 @@ static int roq_read_packet(AVFormatContext *s, break; } /* don't care about this chunk anymore */ - avio_seek(pb, RoQ_CHUNK_PREAMBLE_SIZE, SEEK_CUR); + avio_skip(pb, RoQ_CHUNK_PREAMBLE_SIZE); break; case RoQ_QUAD_CODEBOOK: /* packet needs to contain both this codebook and next VQ chunk */ codebook_offset = avio_tell(pb) - RoQ_CHUNK_PREAMBLE_SIZE; codebook_size = chunk_size; - avio_seek(pb, codebook_size, SEEK_CUR); + avio_skip(pb, codebook_size); if (avio_read(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) != RoQ_CHUNK_PREAMBLE_SIZE) return AVERROR(EIO); diff --git a/libavformat/iff.c b/libavformat/iff.c index 3e329343a4..900d823d2b 100644 --- a/libavformat/iff.c +++ b/libavformat/iff.c @@ -134,7 +134,7 @@ static int iff_read_header(AVFormatContext *s, return AVERROR(ENOMEM); st->codec->channels = 1; - avio_seek(pb, 8, SEEK_CUR); + avio_skip(pb, 8); // codec_tag used by ByteRun1 decoder to distinguish progressive (PBM) and interlaced (ILBM) content st->codec->codec_tag = avio_rl32(pb); @@ -152,10 +152,10 @@ static int iff_read_header(AVFormatContext *s, if (data_size < 14) return AVERROR_INVALIDDATA; - avio_seek(pb, 12, SEEK_CUR); + avio_skip(pb, 12); st->codec->sample_rate = avio_rb16(pb); if (data_size >= 16) { - avio_seek(pb, 1, SEEK_CUR); + avio_skip(pb, 1); compression = avio_r8(pb); } break; @@ -186,14 +186,14 @@ static int iff_read_header(AVFormatContext *s, return AVERROR_INVALIDDATA; st->codec->width = avio_rb16(pb); st->codec->height = avio_rb16(pb); - avio_seek(pb, 4, SEEK_CUR); // x, y offset + avio_skip(pb, 4); // x, y offset st->codec->bits_per_coded_sample = avio_r8(pb); if (data_size >= 11) { - avio_seek(pb, 1, SEEK_CUR); // masking + avio_skip(pb, 1); // masking compression = avio_r8(pb); } if (data_size >= 16) { - avio_seek(pb, 3, SEEK_CUR); // paddding, transparent + avio_skip(pb, 3); // paddding, transparent st->sample_aspect_ratio.num = avio_r8(pb); st->sample_aspect_ratio.den = avio_r8(pb); } @@ -223,7 +223,7 @@ static int iff_read_header(AVFormatContext *s, return res; } } - avio_seek(pb, data_size - (avio_tell(pb) - orig_pos) + (data_size & 1), SEEK_CUR); + avio_skip(pb, data_size - (avio_tell(pb) - orig_pos) + (data_size & 1)); } avio_seek(pb, iff->body_pos, SEEK_SET); diff --git a/libavformat/ingenientdec.c b/libavformat/ingenientdec.c index eb24da9cac..eb1e6f6521 100644 --- a/libavformat/ingenientdec.c +++ b/libavformat/ingenientdec.c @@ -35,11 +35,11 @@ static int ingenient_read_packet(AVFormatContext *s, AVPacket *pkt) w = avio_rl16(s->pb); h = avio_rl16(s->pb); - avio_seek(s->pb, 8, SEEK_CUR); // zero + size (padded?) - avio_seek(s->pb, 2, SEEK_CUR); + avio_skip(s->pb, 8); // zero + size (padded?) + avio_skip(s->pb, 2); unk1 = avio_rl16(s->pb); unk2 = avio_rl16(s->pb); - avio_seek(s->pb, 22, SEEK_CUR); // ASCII timestamp + avio_skip(s->pb, 22); // ASCII timestamp av_log(s, AV_LOG_DEBUG, "Ingenient packet: size=%d, width=%d, height=%d, unk1=%d unk2=%d\n", size, w, h, unk1, unk2); diff --git a/libavformat/ipmovie.c b/libavformat/ipmovie.c index 508a82b6be..97f225618d 100644 --- a/libavformat/ipmovie.c +++ b/libavformat/ipmovie.c @@ -299,12 +299,12 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, case OPCODE_END_OF_STREAM: debug_ipmovie("end of stream\n"); - avio_seek(pb, opcode_size, SEEK_CUR); + avio_skip(pb, opcode_size); break; case OPCODE_END_OF_CHUNK: debug_ipmovie("end of chunk\n"); - avio_seek(pb, opcode_size, SEEK_CUR); + avio_skip(pb, opcode_size); break; case OPCODE_CREATE_TIMER: @@ -359,7 +359,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, case OPCODE_START_STOP_AUDIO: debug_ipmovie("start/stop audio\n"); - avio_seek(pb, opcode_size, SEEK_CUR); + avio_skip(pb, opcode_size); break; case OPCODE_INIT_VIDEO_BUFFERS: @@ -393,12 +393,12 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, case OPCODE_UNKNOWN_14: case OPCODE_UNKNOWN_15: debug_ipmovie("unknown (but documented) opcode %02X\n", opcode_type); - avio_seek(pb, opcode_size, SEEK_CUR); + avio_skip(pb, opcode_size); break; case OPCODE_SEND_BUFFER: debug_ipmovie("send buffer\n"); - avio_seek(pb, opcode_size, SEEK_CUR); + avio_skip(pb, opcode_size); break; case OPCODE_AUDIO_FRAME: @@ -407,22 +407,22 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, /* log position and move on for now */ s->audio_chunk_offset = avio_tell(pb); s->audio_chunk_size = opcode_size; - avio_seek(pb, opcode_size, SEEK_CUR); + avio_skip(pb, opcode_size); break; case OPCODE_SILENCE_FRAME: debug_ipmovie("silence frame\n"); - avio_seek(pb, opcode_size, SEEK_CUR); + avio_skip(pb, opcode_size); break; case OPCODE_INIT_VIDEO_MODE: debug_ipmovie("initialize video mode\n"); - avio_seek(pb, opcode_size, SEEK_CUR); + avio_skip(pb, opcode_size); break; case OPCODE_CREATE_GRADIENT: debug_ipmovie("create gradient\n"); - avio_seek(pb, opcode_size, SEEK_CUR); + avio_skip(pb, opcode_size); break; case OPCODE_SET_PALETTE: @@ -464,7 +464,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, case OPCODE_SET_PALETTE_COMPRESSED: debug_ipmovie("set palette compressed\n"); - avio_seek(pb, opcode_size, SEEK_CUR); + avio_skip(pb, opcode_size); break; case OPCODE_SET_DECODING_MAP: @@ -473,7 +473,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, /* log position and move on for now */ s->decode_map_chunk_offset = avio_tell(pb); s->decode_map_chunk_size = opcode_size; - avio_seek(pb, opcode_size, SEEK_CUR); + avio_skip(pb, opcode_size); break; case OPCODE_VIDEO_DATA: @@ -482,7 +482,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, /* log position and move on for now */ s->video_chunk_offset = avio_tell(pb); s->video_chunk_size = opcode_size; - avio_seek(pb, opcode_size, SEEK_CUR); + avio_skip(pb, opcode_size); break; default: diff --git a/libavformat/iv8.c b/libavformat/iv8.c index 4671a18eac..df5eb116c1 100644 --- a/libavformat/iv8.c +++ b/libavformat/iv8.c @@ -70,7 +70,7 @@ retry: return -1; if(type==258){ - avio_seek(s->pb, size, SEEK_CUR); + avio_skip(s->pb, size); goto retry; } diff --git a/libavformat/lmlm4.c b/libavformat/lmlm4.c index 97ece0153c..d68e6608ea 100644 --- a/libavformat/lmlm4.c +++ b/libavformat/lmlm4.c @@ -100,7 +100,7 @@ static int lmlm4_read_packet(AVFormatContext *s, AVPacket *pkt) { if ((ret = av_get_packet(pb, pkt, frame_size)) <= 0) return AVERROR(EIO); - avio_seek(pb, padding, SEEK_CUR); + avio_skip(pb, padding); switch (frame_type) { case LMLM4_I_FRAME: diff --git a/libavformat/lxfdec.c b/libavformat/lxfdec.c index 0d5d8e8f91..c4aea3d44f 100644 --- a/libavformat/lxfdec.c +++ b/libavformat/lxfdec.c @@ -137,8 +137,8 @@ static int get_packet_header(AVFormatContext *s, uint8_t *header, uint32_t *form case 0: //video //skip VBI data and metadata - avio_seek(pb, (int64_t)(uint32_t)AV_RL32(&header[44]) + - (int64_t)(uint32_t)AV_RL32(&header[52]), SEEK_CUR); + avio_skip(pb, (int64_t)(uint32_t)AV_RL32(&header[44]) + + (int64_t)(uint32_t)AV_RL32(&header[52])); break; case 1: //audio @@ -255,7 +255,7 @@ static int lxf_read_header(AVFormatContext *s, AVFormatParameters *ap) if (format == 1) { //skip extended field data - avio_seek(s->pb, (uint32_t)AV_RL32(&header[40]), SEEK_CUR); + avio_skip(s->pb, (uint32_t)AV_RL32(&header[40])); } return 0; diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index a356611930..dff97b2cc8 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -831,7 +831,7 @@ static int ebml_parse_elem(MatroskaDemuxContext *matroska, return ebml_parse_nest(matroska, syntax->def.n, data); case EBML_PASS: return ebml_parse_id(matroska, syntax->def.n, id, data); case EBML_STOP: return 1; - default: return avio_seek(pb,length,SEEK_CUR)<0 ? AVERROR(EIO) : 0; + default: return avio_skip(pb,length)<0 ? AVERROR(EIO) : 0; } if (res == AVERROR_INVALIDDATA) av_log(matroska->ctx, AV_LOG_ERROR, "Invalid element\n"); @@ -1393,10 +1393,10 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap) int flavor; ffio_init_context(&b, track->codec_priv.data,track->codec_priv.size, 0, NULL, NULL, NULL, NULL); - avio_seek(&b, 22, SEEK_CUR); + avio_skip(&b, 22); flavor = avio_rb16(&b); track->audio.coded_framesize = avio_rb32(&b); - avio_seek(&b, 12, SEEK_CUR); + avio_skip(&b, 12); track->audio.sub_packet_h = avio_rb16(&b); track->audio.frame_size = avio_rb16(&b); track->audio.sub_packet_size = avio_rb16(&b); diff --git a/libavformat/mm.c b/libavformat/mm.c index 699daac5e9..c6264f1cb7 100644 --- a/libavformat/mm.c +++ b/libavformat/mm.c @@ -102,7 +102,7 @@ static int read_header(AVFormatContext *s, avio_rl16(pb); /* ibm-pc video bios mode */ width = avio_rl16(pb); height = avio_rl16(pb); - avio_seek(pb, length - 10, SEEK_CUR); /* unknown data */ + avio_skip(pb, length - 10); /* unknown data */ /* video stream */ st = av_new_stream(s, 0); @@ -181,7 +181,7 @@ static int read_packet(AVFormatContext *s, default : av_log(s, AV_LOG_INFO, "unknown chunk type 0x%x\n", type); - avio_seek(pb, length, SEEK_CUR); + avio_skip(pb, length); } } diff --git a/libavformat/mmf.c b/libavformat/mmf.c index be3f649b41..a3e8b99cb4 100644 --- a/libavformat/mmf.c +++ b/libavformat/mmf.c @@ -195,7 +195,7 @@ static int mmf_read_header(AVFormatContext *s, file_size = avio_rb32(pb); /* Skip some unused chunks that may or may not be present */ - for(;; avio_seek(pb, size, SEEK_CUR)) { + for(;; avio_skip(pb, size)) { tag = avio_rl32(pb); size = avio_rb32(pb); if(tag == MKTAG('C','N','T','I')) continue; @@ -226,7 +226,7 @@ static int mmf_read_header(AVFormatContext *s, avio_r8(pb); /* time base g */ /* Skip some unused chunks that may or may not be present */ - for(;; avio_seek(pb, size, SEEK_CUR)) { + for(;; avio_skip(pb, size)) { tag = avio_rl32(pb); size = avio_rb32(pb); if(tag == MKTAG('A','t','s','q')) continue; diff --git a/libavformat/mov.c b/libavformat/mov.c index db798154a0..746939d781 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -296,7 +296,7 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom) parse = mov_read_udta_string; if (!parse) { /* skip leaf atoms data */ - avio_seek(pb, a.size, SEEK_CUR); + avio_skip(pb, a.size); } else { int64_t start_pos = avio_tell(pb); int64_t left; @@ -308,14 +308,14 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom) return 0; left = a.size - avio_tell(pb) + start_pos; if (left > 0) /* skip garbage at atom end */ - avio_seek(pb, left, SEEK_CUR); + avio_skip(pb, left); } total_size += a.size; } if (total_size < atom.size && atom.size < 0x7ffff) - avio_seek(pb, atom.size - total_size, SEEK_CUR); + avio_skip(pb, atom.size - total_size); return 0; } @@ -357,7 +357,7 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom) uint16_t volume_len, len; int16_t type; - avio_seek(pb, 10, SEEK_CUR); + avio_skip(pb, 10); volume_len = avio_r8(pb); volume_len = FFMIN(volume_len, 27); @@ -365,7 +365,7 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom) dref->volume[volume_len] = 0; av_log(c->fc, AV_LOG_DEBUG, "volume %s, len %d\n", dref->volume, volume_len); - avio_seek(pb, 12, SEEK_CUR); + avio_skip(pb, 12); len = avio_r8(pb); len = FFMIN(len, 63); @@ -373,7 +373,7 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom) dref->filename[len] = 0; av_log(c->fc, AV_LOG_DEBUG, "filename %s, len %d\n", dref->filename, len); - avio_seek(pb, 16, SEEK_CUR); + avio_skip(pb, 16); /* read next level up_from_alias/down_to_target */ dref->nlvl_from = avio_rb16(pb); @@ -381,7 +381,7 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom) av_log(c->fc, AV_LOG_DEBUG, "nlvl from %d, nlvl to %d\n", dref->nlvl_from, dref->nlvl_to); - avio_seek(pb, 16, SEEK_CUR); + avio_skip(pb, 16); for (type = 0; type != -1 && avio_tell(pb) < next; ) { type = avio_rb16(pb); @@ -416,7 +416,7 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom) dref->dir[j] = '/'; av_log(c->fc, AV_LOG_DEBUG, "dir %s\n", dref->dir); } else - avio_seek(pb, len, SEEK_CUR); + avio_skip(pb, len); } } avio_seek(pb, next, SEEK_SET); @@ -663,9 +663,9 @@ static int mov_read_mvhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) avio_rb16(pb); /* preferred volume */ - avio_seek(pb, 10, SEEK_CUR); /* reserved */ + avio_skip(pb, 10); /* reserved */ - avio_seek(pb, 36, SEEK_CUR); /* display matrix */ + avio_skip(pb, 36); /* display matrix */ avio_rb32(pb); /* preview time */ avio_rb32(pb); /* preview duration */ @@ -782,7 +782,7 @@ static int mov_read_wave(MOVContext *c, AVIOContext *pb, MOVAtom atom) if (mov_read_default(c, pb, atom) < 0) return -1; } else - avio_seek(pb, atom.size, SEEK_CUR); + avio_skip(pb, atom.size); return 0; } @@ -833,7 +833,7 @@ static int mov_read_strf(MOVContext *c, AVIOContext *pb, MOVAtom atom) if (!st->codec->extradata) return AVERROR(ENOMEM); st->codec->extradata_size = atom.size - 40; - avio_seek(pb, 40, SEEK_CUR); + avio_skip(pb, 40); avio_read(pb, st->codec->extradata, atom.size - 40); return 0; } @@ -945,7 +945,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) * in the MOV demuxer, patch welcome. */ multiple_stsd: av_log(c->fc, AV_LOG_WARNING, "multiple fourcc not supported\n"); - avio_seek(pb, size - (avio_tell(pb) - start_pos), SEEK_CUR); + avio_skip(pb, size - (avio_tell(pb) - start_pos)); continue; } /* we cannot demux concatenated h264 streams because of different extradata */ @@ -1003,7 +1003,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) len = 31; mov_read_mac_string(c, pb, len, st->codec->codec_name, 32); if (len < 31) - avio_seek(pb, 31 - len, SEEK_CUR); + avio_skip(pb, 31 - len); /* codec_tag YV12 triggers an UV swap in rawdec.c */ if (!memcmp(st->codec->codec_name, "Planar Y'CbCr 8-bit 4:2:0", 25)) st->codec->codec_tag=MKTAG('I', '4', '2', '0'); @@ -1174,7 +1174,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) st->codec->height = sc->height; } else { /* other codec type, just skip (rtp, mp4s, tmcd ...) */ - avio_seek(pb, size - (avio_tell(pb) - start_pos), SEEK_CUR); + avio_skip(pb, size - (avio_tell(pb) - start_pos)); } /* this will read extra atoms at the end (wave, alac, damr, avcC, SMI ...) */ a.size = size - (avio_tell(pb) - start_pos); @@ -1182,7 +1182,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) if (mov_read_default(c, pb, a) < 0) return -1; } else if (a.size > 0) - avio_seek(pb, a.size, SEEK_CUR); + avio_skip(pb, a.size); } if(st->codec->codec_type==AVMEDIA_TYPE_AUDIO && st->codec->sample_rate==0 && sc->time_scale>1) @@ -2078,13 +2078,13 @@ static int mov_read_wide(MOVContext *c, AVIOContext *pb, MOVAtom atom) if (atom.size < 8) return 0; /* continue */ if (avio_rb32(pb) != 0) { /* 0 sized mdat atom... use the 'wide' atom size */ - avio_seek(pb, atom.size - 4, SEEK_CUR); + avio_skip(pb, atom.size - 4); return 0; } atom.type = avio_rl32(pb); atom.size -= 8; if (atom.type != MKTAG('m','d','a','t')) { - avio_seek(pb, atom.size, SEEK_CUR); + avio_skip(pb, atom.size); return 0; } err = mov_read_mdat(c, pb, atom); diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c index 98dde547c8..b7386fb78f 100644 --- a/libavformat/mp3dec.c +++ b/libavformat/mp3dec.c @@ -107,7 +107,7 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base) /* Check tag version */ if(avio_rb16(s->pb) == 1) { /* skip delay and quality */ - avio_seek(s->pb, 4, SEEK_CUR); + avio_skip(s->pb, 4); frames = avio_rb32(s->pb); size = avio_rb32(s->pb); } diff --git a/libavformat/mpc8.c b/libavformat/mpc8.c index a1615a835b..00217fa2ab 100644 --- a/libavformat/mpc8.c +++ b/libavformat/mpc8.c @@ -182,7 +182,7 @@ static void mpc8_handle_chunk(AVFormatContext *s, int tag, int64_t chunk_pos, in avio_seek(pb, pos, SEEK_SET); break; default: - avio_seek(pb, size, SEEK_CUR); + avio_skip(pb, size); } } @@ -212,7 +212,7 @@ static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap) return -1; } pos = avio_tell(pb); - avio_seek(pb, 4, SEEK_CUR); //CRC + avio_skip(pb, 4); //CRC c->ver = avio_r8(pb); if(c->ver != 8){ av_log(s, AV_LOG_ERROR, "Unknown stream version %d\n", c->ver); diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c index 7a93c637f7..821cd6c763 100644 --- a/libavformat/mpeg.c +++ b/libavformat/mpeg.c @@ -212,7 +212,7 @@ static long mpegps_psm_parse(MpegDemuxContext *m, AVIOContext *pb) ps_info_length = avio_rb16(pb); /* skip program_stream_info */ - avio_seek(pb, ps_info_length, SEEK_CUR); + avio_skip(pb, ps_info_length); es_map_length = avio_rb16(pb); /* at least one es available? */ @@ -223,7 +223,7 @@ static long mpegps_psm_parse(MpegDemuxContext *m, AVIOContext *pb) /* remember mapping from stream id to stream type */ m->psm_es_type[es_id] = type; /* skip program_stream_info */ - avio_seek(pb, es_info_length, SEEK_CUR); + avio_skip(pb, es_info_length); es_map_length -= 4 + es_info_length; } avio_rb32(pb); /* crc32 */ @@ -264,7 +264,7 @@ static int mpegps_read_pes_header(AVFormatContext *s, if (startcode == SYSTEM_HEADER_START_CODE) goto redo; if (startcode == PADDING_STREAM) { - avio_seek(s->pb, avio_rb16(s->pb), SEEK_CUR); + avio_skip(s->pb, avio_rb16(s->pb)); goto redo; } if (startcode == PRIVATE_STREAM_2) { @@ -281,7 +281,7 @@ static int mpegps_read_pes_header(AVFormatContext *s, } m->sofdec -= !m->sofdec; } - avio_seek(s->pb, len, SEEK_CUR); + avio_skip(s->pb, len); goto redo; } if (startcode == PROGRAM_STREAM_MAP) { @@ -359,7 +359,7 @@ static int mpegps_read_pes_header(AVFormatContext *s, av_log(s, AV_LOG_WARNING, "pes_ext %X is invalid\n", pes_ext); pes_ext=skip=0; } - avio_seek(s->pb, skip, SEEK_CUR); + avio_skip(s->pb, skip); header_len -= skip; if (pes_ext & 0x01) { /* PES extension 2 */ @@ -375,7 +375,7 @@ static int mpegps_read_pes_header(AVFormatContext *s, } if(header_len < 0) goto error_redo; - avio_seek(s->pb, header_len, SEEK_CUR); + avio_skip(s->pb, header_len); } else if( c!= 0xf ) goto redo; @@ -433,7 +433,7 @@ static int mpegps_read_packet(AVFormatContext *s, if(startcode == 0x1bd) { dvdaudio_substream_type = avio_r8(s->pb); - avio_seek(s->pb, 3, SEEK_CUR); + avio_skip(s->pb, 3); len -= 4; } @@ -525,7 +525,7 @@ static int mpegps_read_packet(AVFormatContext *s, } else { skip: /* skip packet */ - avio_seek(s->pb, len, SEEK_CUR); + avio_skip(s->pb, len); goto redo; } /* no stream found: add a new stream */ @@ -602,7 +602,7 @@ static int64_t mpegps_read_dts(AVFormatContext *s, int stream_index, dts != AV_NOPTS_VALUE) { break; } - avio_seek(s->pb, len, SEEK_CUR); + avio_skip(s->pb, len); } #ifdef DEBUG_SEEK printf("pos=0x%"PRIx64" dts=0x%"PRIx64" %0.3f\n", pos, dts, dts / 90000.0); diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index ea41d81c11..2ef80c088c 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -1362,7 +1362,7 @@ static int read_packet(AVFormatContext *s, uint8_t *buf, int raw_packet_size) } else { skip = raw_packet_size - TS_PACKET_SIZE; if (skip > 0) - avio_seek(pb, skip, SEEK_CUR); + avio_skip(pb, skip); break; } } diff --git a/libavformat/msnwc_tcp.c b/libavformat/msnwc_tcp.c index 692dc1fdb9..a5dab2013f 100644 --- a/libavformat/msnwc_tcp.c +++ b/libavformat/msnwc_tcp.c @@ -104,19 +104,19 @@ static int msnwc_tcp_read_packet(AVFormatContext *ctx, AVPacket *pkt) uint16_t keyframe; uint32_t size, timestamp; - avio_seek(pb, 1, SEEK_CUR); /* one byte has been read ahead */ - avio_seek(pb, 2, SEEK_CUR); - avio_seek(pb, 2, SEEK_CUR); + avio_skip(pb, 1); /* one byte has been read ahead */ + avio_skip(pb, 2); + avio_skip(pb, 2); keyframe = avio_rl16(pb); size = avio_rl32(pb); - avio_seek(pb, 4, SEEK_CUR); - avio_seek(pb, 4, SEEK_CUR); + avio_skip(pb, 4); + avio_skip(pb, 4); timestamp = avio_rl32(pb); if(!size || av_get_packet(pb, pkt, size) != size) return -1; - avio_seek(pb, 1, SEEK_CUR); /* Read ahead one byte of struct size like read_header */ + avio_skip(pb, 1); /* Read ahead one byte of struct size like read_header */ pkt->pts = timestamp; pkt->dts = timestamp; diff --git a/libavformat/mtv.c b/libavformat/mtv.c index 462ae202fc..76e0862cf4 100644 --- a/libavformat/mtv.c +++ b/libavformat/mtv.c @@ -83,10 +83,10 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap) AVStream *st; unsigned int audio_subsegments; - avio_seek(pb, 3, SEEK_CUR); + avio_skip(pb, 3); mtv->file_size = avio_rl32(pb); mtv->segments = avio_rl32(pb); - avio_seek(pb, 32, SEEK_CUR); + avio_skip(pb, 32); mtv->audio_identifier = avio_rl24(pb); mtv->audio_br = avio_rl16(pb); mtv->img_colorfmt = avio_rl24(pb); @@ -105,7 +105,7 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap) mtv->img_height=mtv->img_segment_size / (mtv->img_bpp>>3) / mtv->img_width; - avio_seek(pb, 4, SEEK_CUR); + avio_skip(pb, 4); audio_subsegments = avio_rl16(pb); mtv->full_segment_size = audio_subsegments * (MTV_AUDIO_PADDING_SIZE + MTV_ASUBCHUNK_DATA_SIZE) + @@ -164,7 +164,7 @@ static int mtv_read_packet(AVFormatContext *s, AVPacket *pkt) if((avio_tell(pb) - s->data_offset + mtv->img_segment_size) % mtv->full_segment_size) { - avio_seek(pb, MTV_AUDIO_PADDING_SIZE, SEEK_CUR); + avio_skip(pb, MTV_AUDIO_PADDING_SIZE); ret = av_get_packet(pb, pkt, MTV_ASUBCHUNK_DATA_SIZE); if(ret < 0) diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index de91fce755..fa0b734853 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -262,7 +262,7 @@ static int mxf_decrypt_triplet(AVFormatContext *s, AVPacket *pkt, KLVPacket *klv av_aes_init(mxf->aesc, s->key, 128, 1); } // crypto context - avio_seek(pb, klv_decode_ber_length(pb), SEEK_CUR); + avio_skip(pb, klv_decode_ber_length(pb)); // plaintext offset klv_decode_ber_length(pb); plaintext_size = avio_rb64(pb); @@ -297,7 +297,7 @@ static int mxf_decrypt_triplet(AVFormatContext *s, AVPacket *pkt, KLVPacket *klv &pkt->data[plaintext_size], size >> 4, ivec, 1); pkt->size = orig_size; pkt->stream_index = index; - avio_seek(pb, end - avio_tell(pb), SEEK_CUR); + avio_skip(pb, end - avio_tell(pb)); return 0; } @@ -339,7 +339,7 @@ static int mxf_read_packet(AVFormatContext *s, AVPacket *pkt) return 0; } else skip: - avio_seek(s->pb, klv.length, SEEK_CUR); + avio_skip(s->pb, klv.length); } return AVERROR_EOF; } @@ -397,7 +397,7 @@ static int mxf_read_content_storage(void *arg, AVIOContext *pb, int tag, int siz mxf->packages_refs = av_malloc(mxf->packages_count * sizeof(UID)); if (!mxf->packages_refs) return -1; - avio_seek(pb, 4, SEEK_CUR); /* useless size of objects, always 16 according to specs */ + avio_skip(pb, 4); /* useless size of objects, always 16 according to specs */ avio_read(pb, (uint8_t *)mxf->packages_refs, mxf->packages_count * sizeof(UID)); break; } @@ -416,7 +416,7 @@ static int mxf_read_source_clip(void *arg, AVIOContext *pb, int tag, int size, U break; case 0x1101: /* UMID, only get last 16 bytes */ - avio_seek(pb, 16, SEEK_CUR); + avio_skip(pb, 16); avio_read(pb, source_clip->source_package_uid, 16); break; case 0x1102: @@ -437,7 +437,7 @@ static int mxf_read_material_package(void *arg, AVIOContext *pb, int tag, int si package->tracks_refs = av_malloc(package->tracks_count * sizeof(UID)); if (!package->tracks_refs) return -1; - avio_seek(pb, 4, SEEK_CUR); /* useless size of objects, always 16 according to specs */ + avio_skip(pb, 4); /* useless size of objects, always 16 according to specs */ avio_read(pb, (uint8_t *)package->tracks_refs, package->tracks_count * sizeof(UID)); break; } @@ -482,7 +482,7 @@ static int mxf_read_sequence(void *arg, AVIOContext *pb, int tag, int size, UID sequence->structural_components_refs = av_malloc(sequence->structural_components_count * sizeof(UID)); if (!sequence->structural_components_refs) return -1; - avio_seek(pb, 4, SEEK_CUR); /* useless size of objects, always 16 according to specs */ + avio_skip(pb, 4); /* useless size of objects, always 16 according to specs */ avio_read(pb, (uint8_t *)sequence->structural_components_refs, sequence->structural_components_count * sizeof(UID)); break; } @@ -500,12 +500,12 @@ static int mxf_read_source_package(void *arg, AVIOContext *pb, int tag, int size package->tracks_refs = av_malloc(package->tracks_count * sizeof(UID)); if (!package->tracks_refs) return -1; - avio_seek(pb, 4, SEEK_CUR); /* useless size of objects, always 16 according to specs */ + avio_skip(pb, 4); /* useless size of objects, always 16 according to specs */ avio_read(pb, (uint8_t *)package->tracks_refs, package->tracks_count * sizeof(UID)); break; case 0x4401: /* UMID, only get last 16 bytes */ - avio_seek(pb, 16, SEEK_CUR); + avio_skip(pb, 16); avio_read(pb, package->package_uid, 16); break; case 0x4701: @@ -558,7 +558,7 @@ static int mxf_read_generic_descriptor(void *arg, AVIOContext *pb, int tag, int descriptor->sub_descriptors_refs = av_malloc(descriptor->sub_descriptors_count * sizeof(UID)); if (!descriptor->sub_descriptors_refs) return -1; - avio_seek(pb, 4, SEEK_CUR); /* useless size of objects, always 16 according to specs */ + avio_skip(pb, 4); /* useless size of objects, always 16 according to specs */ avio_read(pb, (uint8_t *)descriptor->sub_descriptors_refs, descriptor->sub_descriptors_count * sizeof(UID)); break; case 0x3004: @@ -943,7 +943,7 @@ static int mxf_read_header(AVFormatContext *s, AVFormatParameters *ap) } } if (!metadata->read) - avio_seek(s->pb, klv.length, SEEK_CUR); + avio_skip(s->pb, klv.length); } return mxf_parse_structural_metadata(mxf); } diff --git a/libavformat/ncdec.c b/libavformat/ncdec.c index 0c44aaa5be..142fd37ad1 100644 --- a/libavformat/ncdec.c +++ b/libavformat/ncdec.c @@ -73,7 +73,7 @@ static int nc_read_packet(AVFormatContext *s, AVPacket *pkt) avio_r8(s->pb); size = avio_rl16(s->pb); - avio_seek(s->pb, 9, SEEK_CUR); + avio_skip(s->pb, 9); if (size == 0) { av_log(s, AV_LOG_DEBUG, "Next packet size is zero\n"); diff --git a/libavformat/nsvdec.c b/libavformat/nsvdec.c index 1dc7cb0869..06565cdb43 100644 --- a/libavformat/nsvdec.c +++ b/libavformat/nsvdec.c @@ -584,7 +584,7 @@ null_chunk_retry: ((auxtag >> 16) & 0x0ff), ((auxtag >> 24) & 0x0ff), auxsize); - avio_seek(pb, auxsize, SEEK_CUR); + avio_skip(pb, auxsize); vsize -= auxsize + sizeof(uint16_t) + sizeof(uint32_t); /* that's becoming braindead */ } diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c index d31040efb8..f010ad1e4b 100644 --- a/libavformat/nutdec.c +++ b/libavformat/nutdec.c @@ -757,7 +757,7 @@ static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code){ ||(discard >= AVDISCARD_BIDIR && last_IP_pts != AV_NOPTS_VALUE && last_IP_pts > pts) || discard >= AVDISCARD_ALL || stc->skip_until_key_frame){ - avio_seek(bc, size, SEEK_CUR); + avio_skip(bc, size); return 1; } @@ -803,7 +803,7 @@ static int nut_read_packet(AVFormatContext *s, AVPacket *pkt) case STREAM_STARTCODE: case INDEX_STARTCODE: skip= get_packetheader(nut, bc, 0, tmp); - avio_seek(bc, skip, SEEK_CUR); + avio_skip(bc, skip); break; case INFO_STARTCODE: if(decode_info_header(nut)<0) diff --git a/libavformat/nuv.c b/libavformat/nuv.c index bd2e28145e..5d63291868 100644 --- a/libavformat/nuv.c +++ b/libavformat/nuv.c @@ -66,7 +66,7 @@ static int get_codec_data(AVIOContext *pb, AVStream *vst, switch (frametype) { case NUV_EXTRADATA: subtype = avio_r8(pb); - avio_seek(pb, 6, SEEK_CUR); + avio_skip(pb, 6); size = PKTSIZE(avio_rl32(pb)); if (vst && subtype == 'R') { vst->codec->extradata_size = size; @@ -78,7 +78,7 @@ static int get_codec_data(AVIOContext *pb, AVStream *vst, } break; case NUV_MYTHEXT: - avio_seek(pb, 7, SEEK_CUR); + avio_skip(pb, 7); size = PKTSIZE(avio_rl32(pb)); if (size != 128 * 4) break; @@ -90,7 +90,7 @@ static int get_codec_data(AVIOContext *pb, AVStream *vst, if (vst->codec->codec_tag == MKTAG('R', 'J', 'P', 'G')) vst->codec->codec_id = CODEC_ID_NUV; } else - avio_seek(pb, 4, SEEK_CUR); + avio_skip(pb, 4); if (ast) { ast->codec->codec_tag = avio_rl32(pb); @@ -102,20 +102,20 @@ static int get_codec_data(AVIOContext *pb, AVStream *vst, ast->codec->bits_per_coded_sample); ast->need_parsing = AVSTREAM_PARSE_FULL; } else - avio_seek(pb, 4 * 4, SEEK_CUR); + avio_skip(pb, 4 * 4); size -= 6 * 4; - avio_seek(pb, size, SEEK_CUR); + avio_skip(pb, size); return 1; case NUV_SEEKP: size = 11; break; default: - avio_seek(pb, 7, SEEK_CUR); + avio_skip(pb, 7); size = PKTSIZE(avio_rl32(pb)); break; } - avio_seek(pb, size, SEEK_CUR); + avio_skip(pb, size); } return 0; } @@ -130,14 +130,14 @@ static int nuv_header(AVFormatContext *s, AVFormatParameters *ap) { AVStream *vst = NULL, *ast = NULL; avio_read(pb, id_string, 12); is_mythtv = !memcmp(id_string, "MythTVVideo", 12); - avio_seek(pb, 5, SEEK_CUR); // version string - avio_seek(pb, 3, SEEK_CUR); // padding + avio_skip(pb, 5); // version string + avio_skip(pb, 3); // padding width = avio_rl32(pb); height = avio_rl32(pb); avio_rl32(pb); // unused, "desiredwidth" avio_rl32(pb); // unused, "desiredheight" avio_r8(pb); // 'P' == progressive, 'I' == interlaced - avio_seek(pb, 3, SEEK_CUR); // padding + avio_skip(pb, 3); // padding aspect = av_int2dbl(avio_rl64(pb)); if (aspect > 0.9999 && aspect < 1.0001) aspect = 4.0 / 3.0; @@ -206,13 +206,13 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt) { switch (frametype) { case NUV_EXTRADATA: if (!ctx->rtjpg_video) { - avio_seek(pb, size, SEEK_CUR); + avio_skip(pb, size); break; } case NUV_VIDEO: if (ctx->v_id < 0) { av_log(s, AV_LOG_ERROR, "Video packet in file without video stream!\n"); - avio_seek(pb, size, SEEK_CUR); + avio_skip(pb, size); break; } ret = av_new_packet(pkt, copyhdrsize + size); @@ -236,7 +236,7 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt) { case NUV_AUDIO: if (ctx->a_id < 0) { av_log(s, AV_LOG_ERROR, "Audio packet in file without audio stream!\n"); - avio_seek(pb, size, SEEK_CUR); + avio_skip(pb, size); break; } ret = av_get_packet(pb, pkt, size); @@ -250,7 +250,7 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt) { // contains no data, size value is invalid break; default: - avio_seek(pb, size, SEEK_CUR); + avio_skip(pb, size); break; } } diff --git a/libavformat/pva.c b/libavformat/pva.c index a3b350e316..8e8c060a65 100644 --- a/libavformat/pva.c +++ b/libavformat/pva.c @@ -122,7 +122,7 @@ recover: if (pes_signal != 1) { pva_log(s, AV_LOG_WARNING, "expected signaled PES packet, " "trying to recover\n"); - avio_seek(pb, length - 9, SEEK_CUR); + avio_skip(pb, length - 9); if (!read_packet) return AVERROR(EIO); goto recover; diff --git a/libavformat/qcp.c b/libavformat/qcp.c index b58ae33579..46eb0a9685 100644 --- a/libavformat/qcp.c +++ b/libavformat/qcp.c @@ -93,7 +93,7 @@ static int qcp_read_header(AVFormatContext *s, AVFormatParameters *ap) avio_rb32(pb); // "RIFF" s->file_size = avio_rl32(pb) + 8; - avio_seek(pb, 8 + 4 + 1 + 1, SEEK_CUR); // "QLCMfmt " + chunk-size + major-version + minor-version + avio_skip(pb, 8 + 4 + 1 + 1); // "QLCMfmt " + chunk-size + major-version + minor-version st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->channels = 1; @@ -110,13 +110,13 @@ static int qcp_read_header(AVFormatContext *s, AVFormatParameters *ap) av_log(s, AV_LOG_ERROR, "Unknown codec GUID.\n"); return AVERROR_INVALIDDATA; } - avio_seek(pb, 2 + 80, SEEK_CUR); // codec-version + codec-name + avio_skip(pb, 2 + 80); // codec-version + codec-name st->codec->bit_rate = avio_rl16(pb); s->packet_size = avio_rl16(pb); - avio_seek(pb, 2, SEEK_CUR); // block-size + avio_skip(pb, 2); // block-size st->codec->sample_rate = avio_rl16(pb); - avio_seek(pb, 2, SEEK_CUR); // sample-size + avio_skip(pb, 2); // sample-size memset(c->rates_per_mode, -1, sizeof(c->rates_per_mode)); nb_rates = avio_rl32(pb); @@ -129,7 +129,7 @@ static int qcp_read_header(AVFormatContext *s, AVFormatParameters *ap) } else c->rates_per_mode[mode] = size; } - avio_seek(pb, 16 - 2*nb_rates + 20, SEEK_CUR); // empty entries of rate-map-table + reserved + avio_skip(pb, 16 - 2*nb_rates + 20); // empty entries of rate-map-table + reserved return 0; } @@ -174,14 +174,14 @@ static int qcp_read_packet(AVFormatContext *s, AVPacket *pkt) case MKTAG('v', 'r', 'a', 't'): if (avio_rl32(pb)) // var-rate-flag s->packet_size = 0; - avio_seek(pb, 4, SEEK_CUR); // size-in-packets + avio_skip(pb, 4); // size-in-packets break; case MKTAG('d', 'a', 't', 'a'): c->data_size = chunk_size; break; default: - avio_seek(pb, chunk_size, SEEK_CUR); + avio_skip(pb, chunk_size); } } return AVERROR_EOF; diff --git a/libavformat/r3d.c b/libavformat/r3d.c index 39f97ff9aa..aad88ee9c7 100644 --- a/libavformat/r3d.c +++ b/libavformat/r3d.c @@ -72,7 +72,7 @@ static int r3d_read_red1(AVFormatContext *s) tmp = avio_rb32(s->pb); // filenum av_dlog(s, "filenum %d\n", tmp); - avio_seek(s->pb, 32, SEEK_CUR); // unknown + avio_skip(s->pb, 32); // unknown st->codec->width = avio_rb32(s->pb); st->codec->height = avio_rb32(s->pb); @@ -152,7 +152,7 @@ static void r3d_read_reos(AVFormatContext *s) tmp = avio_rb32(s->pb); av_dlog(s, "num audio chunks %d\n", tmp); - avio_seek(s->pb, 6*4, SEEK_CUR); + avio_skip(s->pb, 6*4); } static int r3d_read_header(AVFormatContext *s, AVFormatParameters *ap) @@ -332,7 +332,7 @@ static int r3d_read_packet(AVFormatContext *s, AVPacket *pkt) break; default: skip: - avio_seek(s->pb, atom.size-8, SEEK_CUR); + avio_skip(s->pb, atom.size-8); } } return err; diff --git a/libavformat/rdt.c b/libavformat/rdt.c index 36e61c02ed..d6a96de5c1 100644 --- a/libavformat/rdt.c +++ b/libavformat/rdt.c @@ -161,16 +161,16 @@ rdt_load_mdpr (PayloadContext *rdt, AVStream *st, int rule_nr) num = avio_rb16(&pb); if (rule_nr < 0 || rule_nr >= num) return -1; - avio_seek(&pb, rule_nr * 2, SEEK_CUR); + avio_skip(&pb, rule_nr * 2); chunk_nr = avio_rb16(&pb); - avio_seek(&pb, (num - 1 - rule_nr) * 2, SEEK_CUR); + avio_skip(&pb, (num - 1 - rule_nr) * 2); /* read MDPR chunks */ num = avio_rb16(&pb); if (chunk_nr >= num) return -1; while (chunk_nr--) - avio_seek(&pb, avio_rb32(&pb), SEEK_CUR); + avio_skip(&pb, avio_rb32(&pb)); size = avio_rb32(&pb); } else { size = rdt->mlti_data_size; diff --git a/libavformat/riff.c b/libavformat/riff.c index 920cd96e37..fb8ab1c075 100644 --- a/libavformat/riff.c +++ b/libavformat/riff.c @@ -502,7 +502,7 @@ void ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size) codec->bits_per_coded_sample = avio_rl16(pb); codec->channel_layout = avio_rl32(pb); /* dwChannelMask */ id = avio_rl32(pb); /* 4 first bytes of GUID */ - avio_seek(pb, 12, SEEK_CUR); /* skip end of GUID */ + avio_skip(pb, 12); /* skip end of GUID */ cbSize -= 22; size -= 22; } @@ -515,7 +515,7 @@ void ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size) /* It is possible for the chunk to contain garbage at the end */ if (size > 0) - avio_seek(pb, size, SEEK_CUR); + avio_skip(pb, size); } codec->codec_id = ff_wav_codec_get_id(id, codec->bits_per_coded_sample); if (codec->codec_id == CODEC_ID_AAC_LATM) { diff --git a/libavformat/rl2.c b/libavformat/rl2.c index 4538d5c5cd..93d4c34459 100644 --- a/libavformat/rl2.c +++ b/libavformat/rl2.c @@ -95,7 +95,7 @@ static av_cold int rl2_read_header(AVFormatContext *s, int i; int ret = 0; - avio_seek(pb,4, SEEK_CUR); /* skip FORM tag */ + avio_skip(pb,4); /* skip FORM tag */ back_size = avio_rl32(pb); /**< get size of the background frame */ signature = avio_rb32(pb); data_size = avio_rb32(pb); diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c index 4fd2e86759..c29905db58 100644 --- a/libavformat/rmdec.c +++ b/libavformat/rmdec.c @@ -132,7 +132,7 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb, if (version == 3) { int header_size = avio_rb16(pb); int64_t startpos = avio_tell(pb); - avio_seek(pb, 14, SEEK_CUR); + avio_skip(pb, 14); rm_read_metadata(s, 0); if ((startpos + header_size) >= avio_tell(pb) + 2) { // fourcc (should always be "lpcJ") @@ -141,7 +141,7 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb, } // Skip extra header crap (this should never happen) if ((startpos + header_size) > avio_tell(pb)) - avio_seek(pb, header_size + startpos - avio_tell(pb), SEEK_CUR); + avio_skip(pb, header_size + startpos - avio_tell(pb)); st->codec->sample_rate = 8000; st->codec->channels = 1; st->codec->codec_type = AVMEDIA_TYPE_AUDIO; @@ -150,7 +150,7 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb, int flavor, sub_packet_h, coded_framesize, sub_packet_size; int codecdata_length; /* old version (4) */ - avio_seek(pb, 2, SEEK_CUR); /* unused */ + avio_skip(pb, 2); /* unused */ avio_rb32(pb); /* .ra4 */ avio_rb32(pb); /* data size */ avio_rb16(pb); /* version2 */ @@ -321,7 +321,7 @@ ff_rm_read_mdpr_codecdata (AVFormatContext *s, AVIOContext *pb, skip: /* skip codec info */ size = avio_tell(pb) - codec_pos; - avio_seek(pb, codec_data_size - size, SEEK_CUR); + avio_skip(pb, codec_data_size - size); return 0; } @@ -340,7 +340,7 @@ static int rm_read_index(AVFormatContext *s) size = avio_rb32(pb); if (size < 20) return -1; - avio_seek(pb, 2, SEEK_CUR); + avio_skip(pb, 2); n_pkts = avio_rb32(pb); str_id = avio_rb16(pb); next_off = avio_rb32(pb); @@ -353,10 +353,10 @@ static int rm_read_index(AVFormatContext *s) goto skip; for (n = 0; n < n_pkts; n++) { - avio_seek(pb, 2, SEEK_CUR); + avio_skip(pb, 2); pts = avio_rb32(pb); pos = avio_rb32(pb); - avio_seek(pb, 4, SEEK_CUR); /* packet no. */ + avio_skip(pb, 4); /* packet no. */ av_add_index_entry(st, pos, pts, 0, 0, AVINDEX_KEYFRAME); } @@ -469,7 +469,7 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap) goto header_end; default: /* unknown tag: skip it */ - avio_seek(pb, tag_size - 10, SEEK_CUR); + avio_skip(pb, tag_size - 10); break; } } @@ -529,7 +529,7 @@ static int sync(AVFormatContext *s, int64_t *timestamp, int *flags, int *stream_ if(state == MKBETAG('I', 'N', 'D', 'X')){ int n_pkts, expected_len; len = avio_rb32(pb); - avio_seek(pb, 2, SEEK_CUR); + avio_skip(pb, 2); n_pkts = avio_rb32(pb); expected_len = 20 + n_pkts * 14; if (len == 20) @@ -566,7 +566,7 @@ static int sync(AVFormatContext *s, int64_t *timestamp, int *flags, int *stream_ if (i == s->nb_streams) { skip: /* skip packet if unknown number */ - avio_seek(pb, len, SEEK_CUR); + avio_skip(pb, len); rm->remaining_len = 0; continue; } @@ -929,7 +929,7 @@ static int64_t rm_read_dts(AVFormatContext *s, int stream_index, break; } - avio_seek(s->pb, len, SEEK_CUR); + avio_skip(s->pb, len); } *ppos = pos; return dts; diff --git a/libavformat/rtpdec_asf.c b/libavformat/rtpdec_asf.c index 8c4969111c..3c19ad6e5b 100644 --- a/libavformat/rtpdec_asf.c +++ b/libavformat/rtpdec_asf.c @@ -187,11 +187,11 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf, flags |= RTP_FLAG_KEY; len_off = avio_rb24(pb); if (mflags & 0x20) /**< relative timestamp */ - avio_seek(pb, 4, SEEK_CUR); + avio_skip(pb, 4); if (mflags & 0x10) /**< has duration */ - avio_seek(pb, 4, SEEK_CUR); + avio_skip(pb, 4); if (mflags & 0x8) /**< has location ID */ - avio_seek(pb, 4, SEEK_CUR); + avio_skip(pb, 4); off = avio_tell(pb); if (!(mflags & 0x40)) { @@ -214,7 +214,7 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf, return AVERROR(EIO); avio_write(asf->pktbuf, buf + off, len - off); - avio_seek(pb, len - off, SEEK_CUR); + avio_skip(pb, len - off); if (!(flags & RTP_FLAG_MARKER)) return -1; out_len = url_close_dyn_buf(asf->pktbuf, &asf->buf); @@ -234,7 +234,7 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf, asf->buf = av_realloc(asf->buf, out_len); memcpy(asf->buf + prev_len, buf + off, FFMIN(cur_len, len - off)); - avio_seek(pb, cur_len, SEEK_CUR); + avio_skip(pb, cur_len); } } diff --git a/libavformat/rtpdec_qt.c b/libavformat/rtpdec_qt.c index 4041a0fca5..206ed347b4 100644 --- a/libavformat/rtpdec_qt.c +++ b/libavformat/rtpdec_qt.c @@ -149,13 +149,13 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt, break; } default: - avio_seek(&pb, tlv_len, SEEK_CUR); + avio_skip(&pb, tlv_len); break; } } /* 32-bit alignment */ - avio_seek(&pb, ((avio_tell(&pb) + 3) & ~3) - avio_tell(&pb), SEEK_CUR); + avio_skip(&pb, ((avio_tell(&pb) + 3) & ~3) - avio_tell(&pb)); } else avio_seek(&pb, 4, SEEK_SET); diff --git a/libavformat/sauce.c b/libavformat/sauce.c index 8f1acb4a77..41e991e3e7 100644 --- a/libavformat/sauce.c +++ b/libavformat/sauce.c @@ -51,14 +51,14 @@ int ff_sauce_read(AVFormatContext *avctx, uint64_t *fsize, int *got_width, int g GET_SAUCE_META("artist", 20) GET_SAUCE_META("publisher", 20) GET_SAUCE_META("date", 8) - avio_seek(pb, 4, SEEK_CUR); + avio_skip(pb, 4); datatype = avio_r8(pb); filetype = avio_r8(pb); t1 = avio_rl16(pb); t2 = avio_rl16(pb); nb_comments = avio_r8(pb); flags = avio_r8(pb); - avio_seek(pb, 4, SEEK_CUR); + avio_skip(pb, 4); GET_SAUCE_META("encoder", 22); if (got_width && datatype && filetype) { diff --git a/libavformat/siff.c b/libavformat/siff.c index 880132ff67..d0f682b0cf 100644 --- a/libavformat/siff.c +++ b/libavformat/siff.c @@ -103,7 +103,7 @@ static int siff_parse_vbv1(AVFormatContext *s, SIFFContext *c, AVIOContext *pb) } width = avio_rl16(pb); height = avio_rl16(pb); - avio_seek(pb, 4, SEEK_CUR); + avio_skip(pb, 4); c->frames = avio_rl16(pb); if(!c->frames){ av_log(s, AV_LOG_ERROR, "File contains no frames ???\n"); @@ -113,7 +113,7 @@ static int siff_parse_vbv1(AVFormatContext *s, SIFFContext *c, AVIOContext *pb) c->rate = avio_rl16(pb); c->block_align = c->rate * (c->bits >> 3); - avio_seek(pb, 16, SEEK_CUR); //zeroes + avio_skip(pb, 16); //zeroes st = av_new_stream(s, 0); if (!st) @@ -145,7 +145,7 @@ static int siff_parse_soun(AVFormatContext *s, SIFFContext *c, AVIOContext *pb) av_log(s, AV_LOG_ERROR, "Header chunk size is incorrect\n"); return -1; } - avio_seek(pb, 4, SEEK_CUR); //unknown value + avio_skip(pb, 4); //unknown value c->rate = avio_rl16(pb); c->bits = avio_rl16(pb); c->block_align = c->rate * (c->bits >> 3); @@ -160,7 +160,7 @@ static int siff_read_header(AVFormatContext *s, AVFormatParameters *ap) if (avio_rl32(pb) != TAG_SIFF) return -1; - avio_seek(pb, 4, SEEK_CUR); //ignore size + avio_skip(pb, 4); //ignore size tag = avio_rl32(pb); if (tag != TAG_VBV1 && tag != TAG_SOUN){ @@ -176,7 +176,7 @@ static int siff_read_header(AVFormatContext *s, AVFormatParameters *ap) av_log(s, AV_LOG_ERROR, "'BODY' chunk is missing\n"); return -1; } - avio_seek(pb, 4, SEEK_CUR); //ignore size + avio_skip(pb, 4); //ignore size return 0; } diff --git a/libavformat/soxdec.c b/libavformat/soxdec.c index 293e8463a3..4f0984dde4 100644 --- a/libavformat/soxdec.c +++ b/libavformat/soxdec.c @@ -58,14 +58,14 @@ static int sox_read_header(AVFormatContext *s, if (avio_rl32(pb) == SOX_TAG) { st->codec->codec_id = CODEC_ID_PCM_S32LE; header_size = avio_rl32(pb); - avio_seek(pb, 8, SEEK_CUR); /* sample count */ + avio_skip(pb, 8); /* sample count */ sample_rate = av_int2dbl(avio_rl64(pb)); st->codec->channels = avio_rl32(pb); comment_size = avio_rl32(pb); } else { st->codec->codec_id = CODEC_ID_PCM_S32BE; header_size = avio_rb32(pb); - avio_seek(pb, 8, SEEK_CUR); /* sample count */ + avio_skip(pb, 8); /* sample count */ sample_rate = av_int2dbl(avio_rb64(pb)); st->codec->channels = avio_rb32(pb); comment_size = avio_rb32(pb); @@ -105,7 +105,7 @@ static int sox_read_header(AVFormatContext *s, AV_METADATA_DONT_STRDUP_VAL); } - avio_seek(pb, header_size - SOX_FIXED_HDR - comment_size, SEEK_CUR); + avio_skip(pb, header_size - SOX_FIXED_HDR - comment_size); st->codec->sample_rate = sample_rate; st->codec->bits_per_coded_sample = 32; diff --git a/libavformat/spdifdec.c b/libavformat/spdifdec.c index 0ca66118f0..1d198ca2c4 100644 --- a/libavformat/spdifdec.c +++ b/libavformat/spdifdec.c @@ -201,7 +201,7 @@ static int spdif_read_packet(AVFormatContext *s, AVPacket *pkt) } /* skip over the padding to the beginning of the next frame */ - avio_seek(pb, offset - pkt->size - BURST_HEADER_SIZE, SEEK_CUR); + avio_skip(pb, offset - pkt->size - BURST_HEADER_SIZE); if (!s->nb_streams) { /* first packet, create a stream */ diff --git a/libavformat/swfdec.c b/libavformat/swfdec.c index 57eb233b35..bf70fc5250 100644 --- a/libavformat/swfdec.c +++ b/libavformat/swfdec.c @@ -70,7 +70,7 @@ static int swf_read_header(AVFormatContext *s, AVFormatParameters *ap) /* skip rectangle size */ nbits = avio_r8(pb) >> 3; len = (4 * nbits - 3 + 7) / 8; - avio_seek(pb, len, SEEK_CUR); + avio_skip(pb, len); swf->frame_rate = avio_rl16(pb); /* 8.8 fixed */ avio_rl16(pb); /* frame count */ @@ -159,7 +159,7 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) st = s->streams[i]; if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO && st->id == -1) { if (st->codec->codec_id == CODEC_ID_MP3) { - avio_seek(pb, 4, SEEK_CUR); + avio_skip(pb, 4); av_get_packet(pb, pkt, len-4); } else { // ADPCM, PCM av_get_packet(pb, pkt, len); @@ -202,7 +202,7 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) return pkt->size; } skip: - avio_seek(pb, len, SEEK_CUR); + avio_skip(pb, len); } return 0; } diff --git a/libavformat/tmv.c b/libavformat/tmv.c index 1116ca0369..828a556720 100644 --- a/libavformat/tmv.c +++ b/libavformat/tmv.c @@ -152,7 +152,7 @@ static int tmv_read_packet(AVFormatContext *s, AVPacket *pkt) ret = av_get_packet(pb, pkt, pkt_size); if (tmv->stream_index) - avio_seek(pb, tmv->padding, SEEK_CUR); + avio_skip(pb, tmv->padding); pkt->stream_index = tmv->stream_index; tmv->stream_index ^= 1; diff --git a/libavformat/tta.c b/libavformat/tta.c index 8669057fbd..d5f8e1ed61 100644 --- a/libavformat/tta.c +++ b/libavformat/tta.c @@ -50,7 +50,7 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap) if (avio_rl32(s->pb) != AV_RL32("TTA1")) return -1; // not tta file - avio_seek(s->pb, 2, SEEK_CUR); // FIXME: flags + avio_skip(s->pb, 2); // FIXME: flags channels = avio_rl16(s->pb); bps = avio_rl16(s->pb); samplerate = avio_rl32(s->pb); @@ -65,7 +65,7 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap) return -1; } - avio_seek(s->pb, 4, SEEK_CUR); // header crc + avio_skip(s->pb, 4); // header crc framelen = samplerate*256/245; c->totalframes = datalen / framelen + ((datalen % framelen) ? 1 : 0); @@ -91,7 +91,7 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap) av_add_index_entry(st, framepos, i*framelen, size, 0, AVINDEX_KEYFRAME); framepos += size; } - avio_seek(s->pb, 4, SEEK_CUR); // seektable crc + avio_skip(s->pb, 4); // seektable crc st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_id = CODEC_ID_TTA; diff --git a/libavformat/txd.c b/libavformat/txd.c index b62a7dcbf6..dd95366795 100644 --- a/libavformat/txd.c +++ b/libavformat/txd.c @@ -73,7 +73,7 @@ next_chunk: if (chunk_size > 100) break; case TXD_EXTRA: - avio_seek(s->pb, chunk_size, SEEK_CUR); + avio_skip(s->pb, chunk_size); case TXD_FILE: case TXD_TEXTURE: goto next_chunk; diff --git a/libavformat/vc1test.c b/libavformat/vc1test.c index 54d96f57d7..783ab88ebf 100644 --- a/libavformat/vc1test.c +++ b/libavformat/vc1test.c @@ -68,7 +68,7 @@ static int vc1t_read_header(AVFormatContext *s, st->codec->width = avio_rl32(pb); if(avio_rl32(pb) != 0xC) return -1; - avio_seek(pb, 8, SEEK_CUR); + avio_skip(pb, 8); fps = avio_rl32(pb); if(fps == 0xFFFFFFFF) av_set_pts_info(st, 32, 1, 1000); diff --git a/libavformat/vocdec.c b/libavformat/vocdec.c index f4fb8cc37b..d11e68c49f 100644 --- a/libavformat/vocdec.c +++ b/libavformat/vocdec.c @@ -45,13 +45,13 @@ static int voc_read_header(AVFormatContext *s, AVFormatParameters *ap) int header_size; AVStream *st; - avio_seek(pb, 20, SEEK_CUR); + avio_skip(pb, 20); header_size = avio_rl16(pb) - 22; if (header_size != 4) { av_log(s, AV_LOG_ERROR, "unknown header size: %d\n", header_size); return AVERROR(ENOSYS); } - avio_seek(pb, header_size, SEEK_CUR); + avio_skip(pb, header_size); st = av_new_stream(s, 0); if (!st) return AVERROR(ENOMEM); @@ -114,13 +114,13 @@ voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size) dec->bits_per_coded_sample = avio_r8(pb); dec->channels = avio_r8(pb); tmp_codec = avio_rl16(pb); - avio_seek(pb, 4, SEEK_CUR); + avio_skip(pb, 4); voc->remaining_size -= 12; max_size -= 12; break; default: - avio_seek(pb, voc->remaining_size, SEEK_CUR); + avio_skip(pb, voc->remaining_size); max_size -= voc->remaining_size; voc->remaining_size = 0; break; diff --git a/libavformat/vqf.c b/libavformat/vqf.c index 49ed8b4e95..94ba543ba5 100644 --- a/libavformat/vqf.c +++ b/libavformat/vqf.c @@ -72,7 +72,7 @@ static int vqf_read_header(AVFormatContext *s, AVFormatParameters *ap) if (!st) return AVERROR(ENOMEM); - avio_seek(s->pb, 12, SEEK_CUR); + avio_skip(s->pb, 12); header_size = avio_rb32(s->pb); @@ -101,7 +101,7 @@ static int vqf_read_header(AVFormatContext *s, AVFormatParameters *ap) st->codec->channels = avio_rb32(s->pb) + 1; read_bitrate = avio_rb32(s->pb); rate_flag = avio_rb32(s->pb); - avio_seek(s->pb, len-12, SEEK_CUR); + avio_skip(s->pb, len-12); st->codec->bit_rate = read_bitrate*1000; st->codec->bits_per_coded_sample = 16; @@ -140,7 +140,7 @@ static int vqf_read_header(AVFormatContext *s, AVFormatParameters *ap) av_log(s, AV_LOG_ERROR, "Unknown chunk: %c%c%c%c\n", ((char*)&chunk_tag)[0], ((char*)&chunk_tag)[1], ((char*)&chunk_tag)[2], ((char*)&chunk_tag)[3]); - avio_seek(s->pb, FFMIN(len, header_size), SEEK_CUR); + avio_skip(s->pb, FFMIN(len, header_size)); break; } diff --git a/libavformat/wav.c b/libavformat/wav.c index d51c01208e..d96b379b2c 100644 --- a/libavformat/wav.c +++ b/libavformat/wav.c @@ -160,7 +160,7 @@ static int64_t find_tag(AVIOContext *pb, uint32_t tag1) size = next_tag(pb, &tag); if (tag == tag1) break; - avio_seek(pb, size, SEEK_CUR); + avio_skip(pb, size); } return size; } @@ -217,7 +217,7 @@ static int wav_read_header(AVFormatContext *s, avio_rl64(pb); /* RIFF size */ data_size = avio_rl64(pb); sample_count = avio_rl64(pb); - avio_seek(pb, size - 16, SEEK_CUR); /* skip rest of ds64 chunk */ + avio_skip(pb, size - 16); /* skip rest of ds64 chunk */ } /* parse fmt header */ @@ -243,7 +243,7 @@ static int wav_read_header(AVFormatContext *s, sample_count = avio_rl32(pb); size -= 4; } - avio_seek(pb, size, SEEK_CUR); + avio_skip(pb, size); } if (rf64) size = data_size; @@ -276,7 +276,7 @@ static int64_t find_guid(AVIOContext *pb, const uint8_t guid1[16]) return -1; if (!memcmp(guid, guid1, 16)) return size; - avio_seek(pb, FFALIGN(size, INT64_C(8)) - 24, SEEK_CUR); + avio_skip(pb, FFALIGN(size, INT64_C(8)) - 24); } return -1; } @@ -410,7 +410,7 @@ static int w64_read_header(AVFormatContext *s, AVFormatParameters *ap) /* subtract chunk header size - normal wav file doesn't count it */ ff_get_wav_header(pb, st->codec, size - 24); - avio_seek(pb, FFALIGN(size, INT64_C(8)) - size, SEEK_CUR); + avio_skip(pb, FFALIGN(size, INT64_C(8)) - size); st->need_parsing = AVSTREAM_PARSE_FULL; diff --git a/libavformat/wc3movie.c b/libavformat/wc3movie.c index e4c871ca09..01bed4f714 100644 --- a/libavformat/wc3movie.c +++ b/libavformat/wc3movie.c @@ -101,7 +101,7 @@ static int wc3_read_header(AVFormatContext *s, wc3->vpkt.data = NULL; wc3->vpkt.size = 0; /* skip the first 3 32-bit numbers */ - avio_seek(pb, 12, SEEK_CUR); + avio_skip(pb, 12); /* traverse through the chunks and load the header information before * the first BRCH tag */ @@ -114,12 +114,12 @@ static int wc3_read_header(AVFormatContext *s, case SOND_TAG: case INDX_TAG: /* SOND unknown, INDX unnecessary; ignore both */ - avio_seek(pb, size, SEEK_CUR); + avio_skip(pb, size); break; case PC__TAG: /* number of palettes, unneeded */ - avio_seek(pb, 12, SEEK_CUR); + avio_skip(pb, 12); break; case BNAM_TAG: @@ -240,7 +240,7 @@ static int wc3_read_packet(AVFormatContext *s, case TEXT_TAG: /* subtitle chunk */ #if 0 - avio_seek(pb, size, SEEK_CUR); + avio_skip(pb, size); #else if ((unsigned)size > sizeof(text) || (ret = avio_read(pb, text, size)) != size) ret = AVERROR(EIO); diff --git a/libavformat/westwood.c b/libavformat/westwood.c index adb35319e2..818fe2d8d3 100644 --- a/libavformat/westwood.c +++ b/libavformat/westwood.c @@ -303,7 +303,7 @@ static int wsvqa_read_header(AVFormatContext *s, break; } - avio_seek(pb, chunk_size, SEEK_CUR); + avio_skip(pb, chunk_size); } while (chunk_tag != FINF_TAG); return 0; @@ -348,7 +348,7 @@ static int wsvqa_read_packet(AVFormatContext *s, } /* stay on 16-bit alignment */ if (skip_byte) - avio_seek(pb, 1, SEEK_CUR); + avio_skip(pb, 1); return ret; } else { @@ -359,7 +359,7 @@ static int wsvqa_read_packet(AVFormatContext *s, default: av_log(s, AV_LOG_INFO, "Skipping unknown chunk 0x%08X\n", chunk_type); } - avio_seek(pb, chunk_size + skip_byte, SEEK_CUR); + avio_skip(pb, chunk_size + skip_byte); } } diff --git a/libavformat/wtv.c b/libavformat/wtv.c index 191c1c1d67..6337502209 100644 --- a/libavformat/wtv.c +++ b/libavformat/wtv.c @@ -539,7 +539,7 @@ static void get_tag(AVFormatContext *s, AVIOContext *pb, const char *key, int ty } else { av_freep(&buf); av_log(s, AV_LOG_WARNING, "unsupported metadata entry; key:%s, type:%d, length:0x%x\n", key, type, length); - avio_seek(pb, length, SEEK_CUR); + avio_skip(pb, length); return; } @@ -582,7 +582,7 @@ static int parse_videoinfoheader2(AVFormatContext *s, AVStream *st) WtvContext *wtv = s->priv_data; AVIOContext *pb = wtv->pb; - avio_seek(pb, 72, SEEK_CUR); // picture aspect ratio is unreliable + avio_skip(pb, 72); // picture aspect ratio is unreliable ff_get_bmp_header(pb, st); return 72 + 40; @@ -658,17 +658,17 @@ static AVStream * parse_media_type(AVFormatContext *s, AVStream *st, int sid, if (size < 32) { av_log(s, AV_LOG_WARNING, "format buffer size underflow\n"); - avio_seek(pb, size, SEEK_CUR); + avio_skip(pb, size); return NULL; } - avio_seek(pb, size - 32, SEEK_CUR); + avio_skip(pb, size - 32); ff_get_guid(pb, &actual_subtype); ff_get_guid(pb, &actual_formattype); avio_seek(pb, -size, SEEK_CUR); st = parse_media_type(s, st, sid, mediatype, actual_subtype, actual_formattype, size - 32); - avio_seek(pb, 32, SEEK_CUR); + avio_skip(pb, 32); return st; } else if (!ff_guidcmp(mediatype, mediatype_audio)) { st = new_stream(s, st, sid, AVMEDIA_TYPE_AUDIO); @@ -679,7 +679,7 @@ static AVStream * parse_media_type(AVFormatContext *s, AVStream *st, int sid, } else { if (ff_guidcmp(formattype, format_none)) av_log(s, AV_LOG_WARNING, "unknown formattype:"PRI_GUID"\n", ARG_GUID(formattype)); - avio_seek(pb, size, SEEK_CUR); + avio_skip(pb, size); } if (!memcmp(subtype + 4, (const uint8_t[]){MEDIASUBTYPE_BASE_GUID}, 12)) { @@ -708,7 +708,7 @@ static AVStream * parse_media_type(AVFormatContext *s, AVStream *st, int sid, } else { if (ff_guidcmp(formattype, format_none)) av_log(s, AV_LOG_WARNING, "unknown formattype:"PRI_GUID"\n", ARG_GUID(formattype)); - avio_seek(pb, size, SEEK_CUR); + avio_skip(pb, size); } if (!memcmp(subtype + 4, (const uint8_t[]){MEDIASUBTYPE_BASE_GUID}, 12)) { @@ -726,7 +726,7 @@ static AVStream * parse_media_type(AVFormatContext *s, AVStream *st, int sid, return NULL; if (ff_guidcmp(formattype, format_none)) av_log(s, AV_LOG_WARNING, "unknown formattype:"PRI_GUID"\n", ARG_GUID(formattype)); - avio_seek(pb, size, SEEK_CUR); + avio_skip(pb, size); st->codec->codec_id = CODEC_ID_DVB_SUBTITLE; return st; } else if (!ff_guidcmp(mediatype, mediatype_mstvcaption) && @@ -736,21 +736,21 @@ static AVStream * parse_media_type(AVFormatContext *s, AVStream *st, int sid, return NULL; if (ff_guidcmp(formattype, format_none)) av_log(s, AV_LOG_WARNING, "unknown formattype:"PRI_GUID"\n", ARG_GUID(formattype)); - avio_seek(pb, size, SEEK_CUR); + avio_skip(pb, size); st->codec->codec_id = CODEC_ID_DVB_TELETEXT; return st; } else if (!ff_guidcmp(mediatype, mediatype_mpeg2_sections) && !ff_guidcmp(subtype, mediasubtype_mpeg2_sections)) { if (ff_guidcmp(formattype, format_none)) av_log(s, AV_LOG_WARNING, "unknown formattype:"PRI_GUID"\n", ARG_GUID(formattype)); - avio_seek(pb, size, SEEK_CUR); + avio_skip(pb, size); return NULL; } av_log(s, AV_LOG_WARNING, "unknown media type, mediatype:"PRI_GUID ", subtype:"PRI_GUID", formattype:"PRI_GUID"\n", ARG_GUID(mediatype), ARG_GUID(subtype), ARG_GUID(formattype)); - avio_seek(pb, size, SEEK_CUR); + avio_skip(pb, size); return NULL; } @@ -779,17 +779,17 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p if (len < 32) break; sid = avio_rl32(pb) & 0x7FFF; - avio_seek(pb, 8, SEEK_CUR); + avio_skip(pb, 8); consumed = 32; if (!ff_guidcmp(g, stream_guid)) { if (ff_find_stream_index(s, sid) < 0) { ff_asf_guid mediatype, subtype, formattype; int size; - avio_seek(pb, 28, SEEK_CUR); + avio_skip(pb, 28); ff_get_guid(pb, &mediatype); ff_get_guid(pb, &subtype); - avio_seek(pb, 12, SEEK_CUR); + avio_skip(pb, 12); ff_get_guid(pb, &formattype); size = avio_rl32(pb); parse_media_type(s, 0, sid, mediatype, subtype, formattype, size); @@ -800,10 +800,10 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p if (stream_index >= 0 && !((WtvStream*)s->streams[stream_index]->priv_data)->seen_data) { ff_asf_guid mediatype, subtype, formattype; int size; - avio_seek(pb, 12, SEEK_CUR); + avio_skip(pb, 12); ff_get_guid(pb, &mediatype); ff_get_guid(pb, &subtype); - avio_seek(pb, 12, SEEK_CUR); + avio_skip(pb, 12); ff_get_guid(pb, &formattype); size = avio_rl32(pb); parse_media_type(s, s->streams[stream_index], sid, mediatype, subtype, formattype, size); @@ -822,11 +822,11 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p const uint8_t *pbuf = buf; int buf_size; - avio_seek(pb, 8, SEEK_CUR); + avio_skip(pb, 8); consumed += 8; if (!ff_guidcmp(g, EVENTID_CtxADescriptorSpanningEvent) || !ff_guidcmp(g, EVENTID_CSDescriptorSpanningEvent)) { - avio_seek(pb, 6, SEEK_CUR); + avio_skip(pb, 6); consumed += 6; } @@ -840,7 +840,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p if (stream_index >= 0) { AVStream *st = s->streams[stream_index]; int audio_type; - avio_seek(pb, 8, SEEK_CUR); + avio_skip(pb, 8); audio_type = avio_r8(pb); if (audio_type == 2) st->disposition |= AV_DISPOSITION_HEARING_IMPAIRED; @@ -851,7 +851,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p } else if (!ff_guidcmp(g, EVENTID_DVBScramblingControlSpanningEvent)) { int stream_index = ff_find_stream_index(s, sid); if (stream_index >= 0) { - avio_seek(pb, 12, SEEK_CUR); + avio_skip(pb, 12); if (avio_rl32(pb)) av_log(s, AV_LOG_WARNING, "DVB scrambled stream detected (st:%d), decoding will likely fail\n", stream_index); consumed += 16; @@ -861,7 +861,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p if (stream_index >= 0) { AVStream *st = s->streams[stream_index]; uint8_t language[4]; - avio_seek(pb, 12, SEEK_CUR); + avio_skip(pb, 12); avio_read(pb, language, 3); if (language[0]) { language[3] = 0; @@ -874,7 +874,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p } else if (!ff_guidcmp(g, timestamp_guid)) { int stream_index = ff_find_stream_index(s, sid); if (stream_index >= 0) { - avio_seek(pb, 8, SEEK_CUR); + avio_skip(pb, 8); wtv->pts = avio_rl64(pb); consumed += 16; if (wtv->pts == -1) @@ -885,7 +885,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p wtv->epoch = wtv->pts; if (mode == SEEK_TO_PTS && wtv->pts >= seekts) { #define WTV_PAD8(x) (((x) + 7) & ~7) - avio_seek(pb, WTV_PAD8(len) - consumed, SEEK_CUR); + avio_skip(pb, WTV_PAD8(len) - consumed); return 0; } } @@ -923,7 +923,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p } else av_log(s, AV_LOG_WARNING, "unsupported chunk:"PRI_GUID"\n", ARG_GUID(g)); - avio_seek(pb, WTV_PAD8(len) - consumed, SEEK_CUR); + avio_skip(pb, WTV_PAD8(len) - consumed); } return AVERROR_EOF; } @@ -954,13 +954,13 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) wtv->last_valid_pts = AV_NOPTS_VALUE; /* read root directory sector */ - avio_seek(s->pb, 0x30, SEEK_CUR); + avio_skip(s->pb, 0x30); root_size = avio_rl32(s->pb); if (root_size > sizeof(root)) { av_log(s, AV_LOG_ERROR, "root directory size exceeds sector size\n"); return AVERROR_INVALIDDATA; } - avio_seek(s->pb, 4, SEEK_CUR); + avio_skip(s->pb, 4); root_sector = avio_rl32(s->pb); avio_seek(s->pb, root_sector << WTV_SECTOR_BITS, SEEK_SET); @@ -1047,7 +1047,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) return ret; pkt->stream_index = stream_index; pkt->pts = wtv->pts; - avio_seek(pb, WTV_PAD8(len) - len, SEEK_CUR); + avio_skip(pb, WTV_PAD8(len) - len); return 0; } diff --git a/libavformat/wv.c b/libavformat/wv.c index 12aaef991b..9a8f857968 100644 --- a/libavformat/wv.c +++ b/libavformat/wv.c @@ -153,7 +153,7 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int appen chmask = avio_rl32(pb); break; case 5: - avio_seek(pb, 1, SEEK_CUR); + avio_skip(pb, 1); chan |= (avio_r8(pb) & 0xF) << 8; chmask = avio_rl24(pb); break; @@ -166,10 +166,10 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int appen rate = avio_rl24(pb); break; default: - avio_seek(pb, size, SEEK_CUR); + avio_skip(pb, size); } if(id&0x40) - avio_seek(pb, 1, SEEK_CUR); + avio_skip(pb, 1); } if(rate == -1){ av_log(ctx, AV_LOG_ERROR, "Cannot determine custom sampling rate\n"); diff --git a/libavformat/xa.c b/libavformat/xa.c index 17cf237a9d..3b6a77f4af 100644 --- a/libavformat/xa.c +++ b/libavformat/xa.c @@ -76,9 +76,9 @@ static int xa_read_header(AVFormatContext *s, st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_id = CODEC_ID_ADPCM_EA_MAXIS_XA; - avio_seek(pb, 4, SEEK_CUR); /* Skip the XA ID */ + avio_skip(pb, 4); /* Skip the XA ID */ xa->out_size = avio_rl32(pb); - avio_seek(pb, 2, SEEK_CUR); /* Skip the tag */ + avio_skip(pb, 2); /* Skip the tag */ st->codec->channels = avio_rl16(pb); st->codec->sample_rate = avio_rl32(pb); /* Value in file is average byte rate*/ diff --git a/libavformat/yop.c b/libavformat/yop.c index 20de06ca85..486fdc5616 100644 --- a/libavformat/yop.c +++ b/libavformat/yop.c @@ -81,7 +81,7 @@ static int yop_read_header(AVFormatContext *s, AVFormatParameters *ap) video_dec->codec_type = AVMEDIA_TYPE_VIDEO; video_dec->codec_id = CODEC_ID_YOP; - avio_seek(pb, 6, SEEK_CUR); + avio_skip(pb, 6); frame_rate = avio_r8(pb); yop->frame_size = avio_r8(pb) * 2048; @@ -153,7 +153,7 @@ static int yop_read_packet(AVFormatContext *s, AVPacket *pkt) // Set position to the start of the frame pkt->pos = yop->video_packet.pos; - avio_seek(pb, yop->audio_block_length - ret, SEEK_CUR); + avio_skip(pb, yop->audio_block_length - ret); ret = avio_read(pb, yop->video_packet.data + yop->palette_size, actual_video_data_size); From 4af9c1a56f70418cb0256179f8200a8e37996035 Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Sun, 13 Mar 2011 19:50:37 +0100 Subject: [PATCH 16/34] doc: update applehttp documentation Integrate more comments from Stefano. --- doc/protocols.texi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/protocols.texi b/doc/protocols.texi index 6e09025728..a17d66362a 100644 --- a/doc/protocols.texi +++ b/doc/protocols.texi @@ -25,8 +25,9 @@ Read Apple HTTP Live Streaming compliant segmented stream as a uniform one. The M3U8 playlists describing the segments can be remote HTTP resources or local files, accessed using the standard file protocol. -HTTP is default, specific protocol can be declared using the "+" -specifier. +HTTP is default, specific protocol can be declared by specifying +"+@var{proto}" after the applehttp URI scheme name, where @var{proto} +is either "file" or "http". @example applehttp://host/path/to/remote/resource.m3u8 @@ -34,7 +35,6 @@ applehttp+http://host/path/to/remote/resource.m3u8 applehttp+file://path/to/local/resource.m3u8 @end example - @section concat Physical concatenation protocol. From 073f8b10d8d7638fcee33aba04ca2a7b90bdb2c3 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 16 Mar 2011 06:42:43 +0100 Subject: [PATCH 17/34] nutenc: mux chapters. Signed-off-by: Luca Barbato --- libavformat/nut.h | 5 ++++ libavformat/nutenc.c | 66 +++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 67 insertions(+), 4 deletions(-) diff --git a/libavformat/nut.h b/libavformat/nut.h index 7013fb126a..033bc0898e 100644 --- a/libavformat/nut.h +++ b/libavformat/nut.h @@ -81,6 +81,10 @@ typedef struct { int decode_delay; //FIXME duplicate of has_b_frames } StreamContext; +typedef struct { + AVRational *time_base; +} ChapterContext; + typedef struct { AVFormatContext *avf; // int written_packet_size; @@ -90,6 +94,7 @@ typedef struct { const uint8_t *header[128]; uint64_t next_startcode; ///< stores the next startcode if it has already been parsed but the stream is not seekable StreamContext *stream; + ChapterContext *chapter; unsigned int max_distance; unsigned int time_base_count; int64_t last_syncpoint_pos; diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c index 8ecefb012e..05ec576ad4 100644 --- a/libavformat/nutenc.c +++ b/libavformat/nutenc.c @@ -241,9 +241,9 @@ static void build_frame_code(AVFormatContext *s){ nut->frame_code['N'].flags= FLAG_INVALID; } -static void put_tt(NUTContext *nut, StreamContext *nus, AVIOContext *bc, uint64_t val){ +static void put_tt(NUTContext *nut, AVRational *time_base, AVIOContext *bc, uint64_t val){ val *= nut->time_base_count; - val += nus->time_base - nut->time_base; + val += time_base - nut->time_base; ff_put_v(bc, val); } @@ -486,6 +486,34 @@ static int write_streaminfo(NUTContext *nut, AVIOContext *bc, int stream_id){ return count; } +static int write_chapter(NUTContext *nut, AVIOContext *bc, int id) +{ + AVIOContext *dyn_bc; + uint8_t *dyn_buf = NULL; + AVMetadataTag *t = NULL; + AVChapter *ch = nut->avf->chapters[id]; + int ret, dyn_size, count = 0; + + ret = url_open_dyn_buf(&dyn_bc); + if (ret < 0) + return ret; + + ff_put_v(bc, 0); // stream_id_plus1 + put_s(bc, id + 1); // chapter_id + put_tt(nut, nut->chapter[id].time_base, bc, ch->start); // chapter_start + ff_put_v(bc, ch->end - ch->start); // chapter_len + + while ((t = av_metadata_get(ch->metadata, "", t, AV_METADATA_IGNORE_SUFFIX))) + count += add_info(dyn_bc, t->key, t->value); + + ff_put_v(bc, count); + + dyn_size = url_close_dyn_buf(dyn_bc, &dyn_buf); + avio_write(bc, dyn_buf, dyn_size); + av_freep(&dyn_buf); + return 0; +} + static int write_headers(AVFormatContext *avctx, AVIOContext *bc){ NUTContext *nut = avctx->priv_data; AVIOContext *dyn_bc; @@ -530,6 +558,20 @@ static int write_headers(AVFormatContext *avctx, AVIOContext *bc){ } } + for (i = 0; i < nut->avf->nb_chapters; i++) { + ret = url_open_dyn_buf(&dyn_bc); + if (ret < 0) + return ret; + ret = write_chapter(nut, dyn_bc, i); + if (ret < 0) { + uint8_t *buf; + url_close_dyn_buf(dyn_bc, &buf); + av_freep(&buf); + return ret; + } + put_packet(nut, bc, dyn_bc, 1, INFO_STARTCODE); + } + nut->last_syncpoint_pos= INT_MIN; nut->header_count++; return 0; @@ -543,7 +585,9 @@ static int write_header(AVFormatContext *s){ nut->avf= s; nut->stream = av_mallocz(sizeof(StreamContext)*s->nb_streams); - nut->time_base= av_mallocz(sizeof(AVRational )*s->nb_streams); + nut->chapter = av_mallocz(sizeof(ChapterContext)*s->nb_chapters); + nut->time_base= av_mallocz(sizeof(AVRational )*(s->nb_streams + + s->nb_chapters)); for(i=0; inb_streams; i++){ AVStream *st= s->streams[i]; @@ -570,6 +614,20 @@ static int write_header(AVFormatContext *s){ nut->stream[i].max_pts_distance= FFMAX(time_base.den, time_base.num) / time_base.num; } + for (i = 0; i < s->nb_chapters; i++) { + AVChapter *ch = s->chapters[i]; + + for (j = 0; j < nut->time_base_count; j++) { + if (!memcmp(&ch->time_base, &nut->time_base[j], sizeof(AVRational))) + break; + } + + nut->time_base[j] = ch->time_base; + nut->chapter[i].time_base = &nut->time_base[j]; + if(j == nut->time_base_count) + nut->time_base_count++; + } + nut->max_distance = MAX_DISTANCE; build_elision_headers(s); build_frame_code(s); @@ -672,7 +730,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt){ ret = url_open_dyn_buf(&dyn_bc); if(ret < 0) return ret; - put_tt(nut, nus, dyn_bc, pkt->dts); + put_tt(nut, nus->time_base, dyn_bc, pkt->dts); ff_put_v(dyn_bc, sp ? (nut->last_syncpoint_pos - sp->pos)>>4 : 0); put_packet(nut, bc, dyn_bc, 1, SYNCPOINT_STARTCODE); From 4839c192de7782605e1b7c9cc84aaf692cf67284 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 14 Mar 2011 20:38:57 +0100 Subject: [PATCH 18/34] lavf: move ff_get_v from avio.h to avio_internal.h And rename it to ffio_read_varlen. Signed-off-by: Ronald S. Bultje --- libavformat/avio.h | 2 - libavformat/avio_internal.h | 2 + libavformat/aviobuf.c | 2 +- libavformat/mpc8.c | 9 ++-- libavformat/nutdec.c | 85 +++++++++++++++++++------------------ 5 files changed, 51 insertions(+), 49 deletions(-) diff --git a/libavformat/avio.h b/libavformat/avio.h index 761ced6aa1..8b404d067d 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -568,8 +568,6 @@ unsigned int avio_rb24(AVIOContext *s); unsigned int avio_rb32(AVIOContext *s); uint64_t avio_rb64(AVIOContext *s); -uint64_t ff_get_v(AVIOContext *bc); - static inline int url_is_streamed(AVIOContext *s) { return s->is_streamed; diff --git a/libavformat/avio_internal.h b/libavformat/avio_internal.h index 3abb619b8a..2e0b94c9ea 100644 --- a/libavformat/avio_internal.h +++ b/libavformat/avio_internal.h @@ -61,4 +61,6 @@ static av_always_inline void ffio_wfourcc(AVIOContext *pb, const uint8_t *s) */ int ffio_rewind_with_probe_data(AVIOContext *s, unsigned char *buf, int buf_size); +uint64_t ffio_read_varlen(AVIOContext *bc); + #endif // AVFORMAT_AVIO_INTERNAL_H diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index 4f39fe3529..86f4928d43 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -753,7 +753,7 @@ uint64_t avio_rb64(AVIOContext *s) return val; } -uint64_t ff_get_v(AVIOContext *bc){ +uint64_t ffio_read_varlen(AVIOContext *bc){ uint64_t val = 0; int tmp; diff --git a/libavformat/mpc8.c b/libavformat/mpc8.c index 00217fa2ab..8b2d395621 100644 --- a/libavformat/mpc8.c +++ b/libavformat/mpc8.c @@ -22,6 +22,7 @@ #include "libavcodec/get_bits.h" #include "libavcodec/unary.h" #include "avformat.h" +#include "avio_internal.h" /// Two-byte MPC tag #define MKMPCTAG(a, b) (a | (b << 8)) @@ -122,7 +123,7 @@ static void mpc8_get_chunk_header(AVIOContext *pb, int *tag, int64_t *size) int64_t pos; pos = avio_tell(pb); *tag = avio_rl16(pb); - *size = ff_get_v(pb); + *size = ffio_read_varlen(pb); *size -= avio_tell(pb) - pos; } @@ -177,7 +178,7 @@ static void mpc8_handle_chunk(AVFormatContext *s, int tag, int64_t chunk_pos, in switch(tag){ case TAG_SEEKTBLOFF: pos = avio_tell(pb) + size; - off = ff_get_v(pb); + off = ffio_read_varlen(pb); mpc8_parse_seektable(s, chunk_pos + off); avio_seek(pb, pos, SEEK_SET); break; @@ -218,8 +219,8 @@ static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap) av_log(s, AV_LOG_ERROR, "Unknown stream version %d\n", c->ver); return -1; } - c->samples = ff_get_v(pb); - ff_get_v(pb); //silence samples at the beginning + c->samples = ffio_read_varlen(pb); + ffio_read_varlen(pb); //silence samples at the beginning st = av_new_stream(s, 0); if (!st) diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c index f010ad1e4b..d9bb76904f 100644 --- a/libavformat/nutdec.c +++ b/libavformat/nutdec.c @@ -24,6 +24,7 @@ #include "libavutil/avstring.h" #include "libavutil/bswap.h" #include "libavutil/tree.h" +#include "avio_internal.h" #include "nut.h" #undef NDEBUG @@ -36,7 +37,7 @@ #endif static int get_str(AVIOContext *bc, char *string, unsigned int maxlen){ - unsigned int len= ff_get_v(bc); + unsigned int len= ffio_read_varlen(bc); if(len && maxlen) avio_read(bc, string, FFMIN(len, maxlen)); @@ -55,14 +56,14 @@ static int get_str(AVIOContext *bc, char *string, unsigned int maxlen){ } static int64_t get_s(AVIOContext *bc){ - int64_t v = ff_get_v(bc) + 1; + int64_t v = ffio_read_varlen(bc) + 1; if (v&1) return -(v>>1); else return (v>>1); } static uint64_t get_fourcc(AVIOContext *bc){ - unsigned int len= ff_get_v(bc); + unsigned int len= ffio_read_varlen(bc); if (len==2) return avio_rl16(bc); else if(len==4) return avio_rl32(bc); @@ -71,7 +72,7 @@ static uint64_t get_fourcc(AVIOContext *bc){ #ifdef TRACE static inline uint64_t get_v_trace(AVIOContext *bc, char *file, char *func, int line){ - uint64_t v= ff_get_v(bc); + uint64_t v= ffio_read_varlen(bc); av_log(NULL, AV_LOG_DEBUG, "get_v %5"PRId64" / %"PRIX64" in %s %s:%d\n", v, v, file, func, line); return v; @@ -90,7 +91,7 @@ static inline uint64_t get_vb_trace(AVIOContext *bc, char *file, char *func, int av_log(NULL, AV_LOG_DEBUG, "get_vb %5"PRId64" / %"PRIX64" in %s %s:%d\n", v, v, file, func, line); return v; } -#define ff_get_v(bc) get_v_trace(bc, __FILE__, __PRETTY_FUNCTION__, __LINE__) +#define ffio_read_varlen(bc) get_v_trace(bc, __FILE__, __PRETTY_FUNCTION__, __LINE__) #define get_s(bc) get_s_trace(bc, __FILE__, __PRETTY_FUNCTION__, __LINE__) #define get_vb(bc) get_vb_trace(bc, __FILE__, __PRETTY_FUNCTION__, __LINE__) #endif @@ -104,7 +105,7 @@ static int get_packetheader(NUTContext *nut, AVIOContext *bc, int calculate_chec startcode= ff_crc04C11DB7_update(0, (uint8_t*)&startcode, 8); init_checksum(bc, ff_crc04C11DB7_update, startcode); - size= ff_get_v(bc); + size= ffio_read_varlen(bc); if(size > 4096) avio_rb32(bc); if(get_checksum(bc) && size > 4096) @@ -168,7 +169,7 @@ static int nut_probe(AVProbeData *p){ } #define GET_V(dst, check) \ - tmp= ff_get_v(bc);\ + tmp= ffio_read_varlen(bc);\ if(!(check)){\ av_log(s, AV_LOG_ERROR, "Error " #dst " is (%"PRId64")\n", tmp);\ return -1;\ @@ -201,7 +202,7 @@ static int decode_main_header(NUTContext *nut){ GET_V(tmp , tmp >=2 && tmp <= 3) GET_V(stream_count , tmp > 0 && tmp <= NUT_MAX_STREAMS) - nut->max_distance = ff_get_v(bc); + nut->max_distance = ffio_read_varlen(bc); if(nut->max_distance > 65536){ av_log(s, AV_LOG_DEBUG, "max_distance %d\n", nut->max_distance); nut->max_distance= 65536; @@ -224,22 +225,22 @@ static int decode_main_header(NUTContext *nut){ tmp_match= 1-(1LL<<62); tmp_head_idx= 0; for(i=0; i<256;){ - int tmp_flags = ff_get_v(bc); - int tmp_fields= ff_get_v(bc); + int tmp_flags = ffio_read_varlen(bc); + int tmp_fields= ffio_read_varlen(bc); if(tmp_fields>0) tmp_pts = get_s(bc); - if(tmp_fields>1) tmp_mul = ff_get_v(bc); - if(tmp_fields>2) tmp_stream= ff_get_v(bc); - if(tmp_fields>3) tmp_size = ff_get_v(bc); + if(tmp_fields>1) tmp_mul = ffio_read_varlen(bc); + if(tmp_fields>2) tmp_stream= ffio_read_varlen(bc); + if(tmp_fields>3) tmp_size = ffio_read_varlen(bc); else tmp_size = 0; - if(tmp_fields>4) tmp_res = ff_get_v(bc); + if(tmp_fields>4) tmp_res = ffio_read_varlen(bc); else tmp_res = 0; - if(tmp_fields>5) count = ff_get_v(bc); + if(tmp_fields>5) count = ffio_read_varlen(bc); else count = tmp_mul - tmp_size; if(tmp_fields>6) tmp_match = get_s(bc); - if(tmp_fields>7) tmp_head_idx= ff_get_v(bc); + if(tmp_fields>7) tmp_head_idx= ffio_read_varlen(bc); while(tmp_fields-- > 8) - ff_get_v(bc); + ffio_read_varlen(bc); if(count == 0 || i+count > 256){ av_log(s, AV_LOG_ERROR, "illegal count %d at %d\n", count, i); @@ -315,7 +316,7 @@ static int decode_stream_header(NUTContext *nut){ if (!st) return AVERROR(ENOMEM); - class = ff_get_v(bc); + class = ffio_read_varlen(bc); tmp = get_fourcc(bc); st->codec->codec_tag= tmp; switch(class) @@ -347,10 +348,10 @@ static int decode_stream_header(NUTContext *nut){ GET_V(stc->time_base_id , tmp < nut->time_base_count); GET_V(stc->msb_pts_shift , tmp < 16); - stc->max_pts_distance= ff_get_v(bc); + stc->max_pts_distance= ffio_read_varlen(bc); GET_V(stc->decode_delay , tmp < 1000); //sanity limit, raise this if Moore's law is true st->codec->has_b_frames= stc->decode_delay; - ff_get_v(bc); //stream flags + ffio_read_varlen(bc); //stream flags GET_V(st->codec->extradata_size, tmp < (1<<30)); if(st->codec->extradata_size){ @@ -361,16 +362,16 @@ static int decode_stream_header(NUTContext *nut){ if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO){ GET_V(st->codec->width , tmp > 0) GET_V(st->codec->height, tmp > 0) - st->sample_aspect_ratio.num= ff_get_v(bc); - st->sample_aspect_ratio.den= ff_get_v(bc); + st->sample_aspect_ratio.num= ffio_read_varlen(bc); + st->sample_aspect_ratio.den= ffio_read_varlen(bc); if((!st->sample_aspect_ratio.num) != (!st->sample_aspect_ratio.den)){ av_log(s, AV_LOG_ERROR, "invalid aspect ratio %d/%d\n", st->sample_aspect_ratio.num, st->sample_aspect_ratio.den); return -1; } - ff_get_v(bc); /* csp type */ + ffio_read_varlen(bc); /* csp type */ }else if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO){ GET_V(st->codec->sample_rate , tmp > 0) - ff_get_v(bc); // samplerate_den + ffio_read_varlen(bc); // samplerate_den GET_V(st->codec->channels, tmp > 0) } if(skip_reserved(bc, end) || get_checksum(bc)){ @@ -413,9 +414,9 @@ static int decode_info_header(NUTContext *nut){ GET_V(stream_id_plus1, tmp <= s->nb_streams) chapter_id = get_s(bc); - chapter_start= ff_get_v(bc); - chapter_len = ff_get_v(bc); - count = ff_get_v(bc); + chapter_start= ffio_read_varlen(bc); + chapter_len = ffio_read_varlen(bc); + count = ffio_read_varlen(bc); if(chapter_id && !stream_id_plus1){ int64_t start= chapter_start / nut->time_base_count; @@ -444,7 +445,7 @@ static int decode_info_header(NUTContext *nut){ value= get_s(bc); }else if(value == -4){ type= "t"; - value= ff_get_v(bc); + value= ffio_read_varlen(bc); }else if(value < -4){ type= "r"; get_s(bc); @@ -485,8 +486,8 @@ static int decode_syncpoint(NUTContext *nut, int64_t *ts, int64_t *back_ptr){ end= get_packetheader(nut, bc, 1, SYNCPOINT_STARTCODE); end += avio_tell(bc); - tmp= ff_get_v(bc); - *back_ptr= nut->last_syncpoint_pos - 16*ff_get_v(bc); + tmp= ffio_read_varlen(bc); + *back_ptr= nut->last_syncpoint_pos - 16*ffio_read_varlen(bc); if(*back_ptr < 0) return -1; @@ -523,12 +524,12 @@ static int find_and_decode_index(NUTContext *nut){ end= get_packetheader(nut, bc, 1, INDEX_STARTCODE); end += avio_tell(bc); - ff_get_v(bc); //max_pts + ffio_read_varlen(bc); //max_pts GET_V(syncpoint_count, tmp < INT_MAX/8 && tmp > 0) syncpoints= av_malloc(sizeof(int64_t)*syncpoint_count); has_keyframe= av_malloc(sizeof(int8_t)*(syncpoint_count+1)); for(i=0; inb_streams; i++){ int64_t last_pts= -1; for(j=0; j>=1; @@ -569,10 +570,10 @@ static int find_and_decode_index(NUTContext *nut){ assert(n<=syncpoint_count+1); for(; jnb_streams) } stc= &nut->stream[*stream_id]; if(flags&FLAG_CODED_PTS){ - int coded_pts= ff_get_v(bc); + int coded_pts= ffio_read_varlen(bc); //FIXME check last_pts validity? if(coded_pts < (1<msb_pts_shift)){ *pts=ff_lsb2full(stc, coded_pts); @@ -702,16 +703,16 @@ static int decode_frame_header(NUTContext *nut, int64_t *pts, int *stream_id, ui }else *pts= stc->last_pts + pts_delta; if(flags&FLAG_SIZE_MSB){ - size += size_mul*ff_get_v(bc); + size += size_mul*ffio_read_varlen(bc); } if(flags&FLAG_MATCH_TIME) get_s(bc); if(flags&FLAG_HEADER_IDX) - *header_idx= ff_get_v(bc); + *header_idx= ffio_read_varlen(bc); if(flags&FLAG_RESERVED) - reserved_count= ff_get_v(bc); + reserved_count= ffio_read_varlen(bc); for(i=0; i= (unsigned)nut->header_count){ av_log(s, AV_LOG_ERROR, "header_idx invalid\n"); From 59f65d9579262651731e9a22845957d78b4c4f57 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 14 Mar 2011 20:38:58 +0100 Subject: [PATCH 19/34] avio: make url_setbufsize internal. Signed-off-by: Ronald S. Bultje --- libavformat/avio.h | 3 +-- libavformat/avio_internal.h | 3 +++ libavformat/aviobuf.c | 8 ++++++-- libavformat/utils.c | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/libavformat/avio.h b/libavformat/avio.h index 8b404d067d..36be9fe4dd 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -429,6 +429,7 @@ attribute_deprecated int64_t url_ftell(AVIOContext *s); attribute_deprecated int64_t url_fsize(AVIOContext *s); #define URL_EOF (-1) attribute_deprecated int url_fgetc(AVIOContext *s); +attribute_deprecated int url_setbufsize(AVIOContext *s, int buf_size); /** * @} */ @@ -586,8 +587,6 @@ static inline int url_is_streamed(AVIOContext *s) */ int url_fdopen(AVIOContext **s, URLContext *h); -/** @warning must be called before any I/O */ -int url_setbufsize(AVIOContext *s, int buf_size); #if FF_API_URL_RESETBUF /** Reset the buffer for reading or writing. * @note Will drop any data currently in the buffer without transmitting it. diff --git a/libavformat/avio_internal.h b/libavformat/avio_internal.h index 2e0b94c9ea..12578fac6c 100644 --- a/libavformat/avio_internal.h +++ b/libavformat/avio_internal.h @@ -63,4 +63,7 @@ int ffio_rewind_with_probe_data(AVIOContext *s, unsigned char *buf, int buf_size uint64_t ffio_read_varlen(AVIOContext *bc); +/** @warning must be called before any I/O */ +int ffio_set_buf_size(AVIOContext *s, int buf_size); + #endif // AVFORMAT_AVIO_INTERNAL_H diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index 86f4928d43..7d84b2b293 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -377,6 +377,10 @@ int64_t url_fsize(AVIOContext *s) { return avio_size(s); } +int url_setbufsize(AVIOContext *s, int buf_size) +{ + return ffio_set_buf_size(s, buf_size); +} #endif int avio_put_str(AVIOContext *s, const char *str) @@ -490,7 +494,7 @@ static void fill_buffer(AVIOContext *s) /* make buffer smaller in case it ended up large after probing */ if (s->buffer_size > max_buffer_size) { - url_setbufsize(s, max_buffer_size); + ffio_set_buf_size(s, max_buffer_size); s->checksum_ptr = dst = s->buffer; len = s->buffer_size; @@ -801,7 +805,7 @@ int url_fdopen(AVIOContext **s, URLContext *h) return 0; } -int url_setbufsize(AVIOContext *s, int buf_size) +int ffio_set_buf_size(AVIOContext *s, int buf_size) { uint8_t *buffer; buffer = av_malloc(buf_size); diff --git a/libavformat/utils.c b/libavformat/utils.c index b1c9755646..113728f389 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -621,7 +621,7 @@ int av_open_input_file(AVFormatContext **ic_ptr, const char *filename, goto fail; } if (buf_size > 0) { - url_setbufsize(pb, buf_size); + ffio_set_buf_size(pb, buf_size); } if (!fmt && (err = av_probe_input_buffer(pb, &fmt, filename, logctx, 0, logctx ? (*ic_ptr)->probesize : 0)) < 0) { goto fail; From af02073225e5b34a8ea72bd3ff531868ed0b5061 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 14 Mar 2011 20:39:01 +0100 Subject: [PATCH 20/34] avio: change avio_tell/skip from macros to inline functions Signed-off-by: Ronald S. Bultje --- libavformat/avio.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libavformat/avio.h b/libavformat/avio.h index 36be9fe4dd..9f45a6bd87 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -487,13 +487,19 @@ int64_t avio_seek(AVIOContext *s, int64_t offset, int whence); * Skip given number of bytes forward * @return new position or AVERROR. */ -#define avio_skip(s, offset) avio_seek(s, offset, SEEK_CUR) +static av_always_inline int64_t avio_skip(AVIOContext *s, int64_t offset) +{ + return avio_seek(s, offset, SEEK_CUR); +} /** * ftell() equivalent for AVIOContext. * @return position or AVERROR. */ -#define avio_tell(s) avio_seek((s), 0, SEEK_CUR) +static av_always_inline int64_t avio_tell(AVIOContext *s) +{ + return avio_seek(s, 0, SEEK_CUR); +} /** * Get the filesize. From d9d86e00b2891a2651fd41f0d2d220a67f7968c3 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 14 Mar 2011 20:39:02 +0100 Subject: [PATCH 21/34] avio: avio_ prefix for url_fprintf Signed-off-by: Ronald S. Bultje --- ffserver.c | 126 ++++++++++++++++++++-------------------- libavformat/avio.h | 9 ++- libavformat/aviobuf.c | 14 ++++- libavformat/ffmetaenc.c | 6 +- 4 files changed, 86 insertions(+), 69 deletions(-) diff --git a/ffserver.c b/ffserver.c index e5c4ac23d8..0dccbd1388 100644 --- a/ffserver.c +++ b/ffserver.c @@ -1861,7 +1861,7 @@ static void fmt_bytecount(AVIOContext *pb, int64_t count) for (s = suffix; count >= 100000 && s[1]; count /= 1000, s++); - url_fprintf(pb, "%"PRId64"%c", count, *s); + avio_printf(pb, "%"PRId64"%c", count, *s); } static void compute_status(HTTPContext *c) @@ -1880,20 +1880,20 @@ static void compute_status(HTTPContext *c) return; } - url_fprintf(pb, "HTTP/1.0 200 OK\r\n"); - url_fprintf(pb, "Content-type: %s\r\n", "text/html"); - url_fprintf(pb, "Pragma: no-cache\r\n"); - url_fprintf(pb, "\r\n"); + avio_printf(pb, "HTTP/1.0 200 OK\r\n"); + avio_printf(pb, "Content-type: %s\r\n", "text/html"); + avio_printf(pb, "Pragma: no-cache\r\n"); + avio_printf(pb, "\r\n"); - url_fprintf(pb, "%s Status\n", program_name); + avio_printf(pb, "%s Status\n", program_name); if (c->stream->feed_filename[0]) - url_fprintf(pb, "\n", c->stream->feed_filename); - url_fprintf(pb, "\n"); - url_fprintf(pb, "

%s Status

\n", program_name); + avio_printf(pb, "\n", c->stream->feed_filename); + avio_printf(pb, "\n"); + avio_printf(pb, "

%s Status

\n", program_name); /* format status */ - url_fprintf(pb, "

Available Streams

\n"); - url_fprintf(pb, "\n"); - url_fprintf(pb, "
PathServed
Conns

bytes
FormatBit rate
kbits/s
Video
kbits/s

Codec
Audio
kbits/s

Codec
Feed\n"); + avio_printf(pb, "

Available Streams

\n"); + avio_printf(pb, "\n"); + avio_printf(pb, "
PathServed
Conns

bytes
FormatBit rate
kbits/s
Video
kbits/s

Codec
Audio
kbits/s

Codec
Feed\n"); stream = first_stream; while (stream != NULL) { char sfilename[1024]; @@ -1921,9 +1921,9 @@ static void compute_status(HTTPContext *c) } } - url_fprintf(pb, "
%s ", + avio_printf(pb, "
%s ", sfilename, stream->filename); - url_fprintf(pb, " %d ", + avio_printf(pb, " %d ", stream->conns_served); fmt_bytecount(pb, stream->bytes_served); switch(stream->stream_type) { @@ -1962,33 +1962,33 @@ static void compute_status(HTTPContext *c) abort(); } } - url_fprintf(pb, " %s %d %d %s %s %d %s %s", + avio_printf(pb, " %s %d %d %s %s %d %s %s", stream->fmt->name, stream->bandwidth, video_bit_rate / 1000, video_codec_name, video_codec_name_extra, audio_bit_rate / 1000, audio_codec_name, audio_codec_name_extra); if (stream->feed) - url_fprintf(pb, "%s", stream->feed->filename); + avio_printf(pb, "%s", stream->feed->filename); else - url_fprintf(pb, "%s", stream->feed_filename); - url_fprintf(pb, "\n"); + avio_printf(pb, "%s", stream->feed_filename); + avio_printf(pb, "\n"); } break; default: - url_fprintf(pb, " - - - - \n"); + avio_printf(pb, " - - - - \n"); break; } } stream = stream->next; } - url_fprintf(pb, "
\n"); + avio_printf(pb, "
\n"); stream = first_stream; while (stream != NULL) { if (stream->feed == stream) { - url_fprintf(pb, "

Feed %s

", stream->filename); + avio_printf(pb, "

Feed %s

", stream->filename); if (stream->pid) { - url_fprintf(pb, "Running as pid %d.\n", stream->pid); + avio_printf(pb, "Running as pid %d.\n", stream->pid); #if defined(linux) && !defined(CONFIG_NOCUTILS) { @@ -2007,7 +2007,7 @@ static void compute_status(HTTPContext *c) if (fscanf(pid_stat, "%10s %64s", cpuperc, cpuused) == 2) { - url_fprintf(pb, "Currently using %s%% of the cpu. Total time used %s.\n", + avio_printf(pb, "Currently using %s%% of the cpu. Total time used %s.\n", cpuperc, cpuused); } fclose(pid_stat); @@ -2015,9 +2015,9 @@ static void compute_status(HTTPContext *c) } #endif - url_fprintf(pb, "

"); + avio_printf(pb, "

"); } - url_fprintf(pb, "
Streamtypekbits/scodecParameters\n"); + avio_printf(pb, "
Streamtypekbits/scodecParameters\n"); for (i = 0; i < stream->nb_streams; i++) { AVStream *st = stream->streams[i]; @@ -2040,26 +2040,26 @@ static void compute_status(HTTPContext *c) default: abort(); } - url_fprintf(pb, "
%d%s%d%s%s\n", + avio_printf(pb, "
%d%s%d%s%s\n", i, type, st->codec->bit_rate/1000, codec ? codec->name : "", parameters); } - url_fprintf(pb, "
\n"); + avio_printf(pb, "
\n"); } stream = stream->next; } /* connection status */ - url_fprintf(pb, "

Connection Status

\n"); + avio_printf(pb, "

Connection Status

\n"); - url_fprintf(pb, "Number of connections: %d / %d
\n", + avio_printf(pb, "Number of connections: %d / %d
\n", nb_connections, nb_max_connections); - url_fprintf(pb, "Bandwidth in use: %"PRIu64"k / %"PRIu64"k
\n", + avio_printf(pb, "Bandwidth in use: %"PRIu64"k / %"PRIu64"k
\n", current_bandwidth, max_bandwidth); - url_fprintf(pb, "\n"); - url_fprintf(pb, "
#FileIPProtoStateTarget bits/secActual bits/secBytes transferred\n"); + avio_printf(pb, "\n"); + avio_printf(pb, "
#FileIPProtoStateTarget bits/secActual bits/secBytes transferred\n"); c1 = first_http_ctx; i = 0; while (c1 != NULL) { @@ -2078,7 +2078,7 @@ static void compute_status(HTTPContext *c) i++; p = inet_ntoa(c1->from_addr.sin_addr); - url_fprintf(pb, "
%d%s%s%s%s%s", + avio_printf(pb, "
%d%s%s%s%s%s", i, c1->stream ? c1->stream->filename : "", c1->state == HTTPSTATE_RECEIVE_DATA ? "(input)" : "", @@ -2086,20 +2086,20 @@ static void compute_status(HTTPContext *c) c1->protocol, http_state[c1->state]); fmt_bytecount(pb, bitrate); - url_fprintf(pb, ""); + avio_printf(pb, ""); fmt_bytecount(pb, compute_datarate(&c1->datarate, c1->data_count) * 8); - url_fprintf(pb, ""); + avio_printf(pb, ""); fmt_bytecount(pb, c1->data_count); - url_fprintf(pb, "\n"); + avio_printf(pb, "\n"); c1 = c1->next; } - url_fprintf(pb, "
\n"); + avio_printf(pb, "
\n"); /* date */ ti = time(NULL); p = ctime(&ti); - url_fprintf(pb, "
Generated at %s", p); - url_fprintf(pb, "\n\n"); + avio_printf(pb, "
Generated at %s", p); + avio_printf(pb, "\n\n"); len = url_close_dyn_buf(pb, &c->pb_buffer); c->buffer_ptr = c->pb_buffer; @@ -2812,20 +2812,20 @@ static void rtsp_reply_header(HTTPContext *c, enum RTSPStatusCode error_number) break; } - url_fprintf(c->pb, "RTSP/1.0 %d %s\r\n", error_number, str); - url_fprintf(c->pb, "CSeq: %d\r\n", c->seq); + avio_printf(c->pb, "RTSP/1.0 %d %s\r\n", error_number, str); + avio_printf(c->pb, "CSeq: %d\r\n", c->seq); /* output GMT time */ ti = time(NULL); tm = gmtime(&ti); strftime(buf2, sizeof(buf2), "%a, %d %b %Y %H:%M:%S", tm); - url_fprintf(c->pb, "Date: %s GMT\r\n", buf2); + avio_printf(c->pb, "Date: %s GMT\r\n", buf2); } static void rtsp_reply_error(HTTPContext *c, enum RTSPStatusCode error_number) { rtsp_reply_header(c, error_number); - url_fprintf(c->pb, "\r\n"); + avio_printf(c->pb, "\r\n"); } static int rtsp_parse_request(HTTPContext *c) @@ -2970,10 +2970,10 @@ static int prepare_sdp_description(FFStream *stream, uint8_t **pbuffer, static void rtsp_cmd_options(HTTPContext *c, const char *url) { // rtsp_reply_header(c, RTSP_STATUS_OK); - url_fprintf(c->pb, "RTSP/1.0 %d %s\r\n", RTSP_STATUS_OK, "OK"); - url_fprintf(c->pb, "CSeq: %d\r\n", c->seq); - url_fprintf(c->pb, "Public: %s\r\n", "OPTIONS, DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE"); - url_fprintf(c->pb, "\r\n"); + avio_printf(c->pb, "RTSP/1.0 %d %s\r\n", RTSP_STATUS_OK, "OK"); + avio_printf(c->pb, "CSeq: %d\r\n", c->seq); + avio_printf(c->pb, "Public: %s\r\n", "OPTIONS, DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE"); + avio_printf(c->pb, "\r\n"); } static void rtsp_cmd_describe(HTTPContext *c, const char *url) @@ -3014,10 +3014,10 @@ static void rtsp_cmd_describe(HTTPContext *c, const char *url) return; } rtsp_reply_header(c, RTSP_STATUS_OK); - url_fprintf(c->pb, "Content-Base: %s/\r\n", url); - url_fprintf(c->pb, "Content-Type: application/sdp\r\n"); - url_fprintf(c->pb, "Content-Length: %d\r\n", content_length); - url_fprintf(c->pb, "\r\n"); + avio_printf(c->pb, "Content-Base: %s/\r\n", url); + avio_printf(c->pb, "Content-Type: application/sdp\r\n"); + avio_printf(c->pb, "Content-Length: %d\r\n", content_length); + avio_printf(c->pb, "\r\n"); avio_write(c->pb, content, content_length); av_free(content); } @@ -3163,30 +3163,30 @@ static void rtsp_cmd_setup(HTTPContext *c, const char *url, /* now everything is OK, so we can send the connection parameters */ rtsp_reply_header(c, RTSP_STATUS_OK); /* session ID */ - url_fprintf(c->pb, "Session: %s\r\n", rtp_c->session_id); + avio_printf(c->pb, "Session: %s\r\n", rtp_c->session_id); switch(rtp_c->rtp_protocol) { case RTSP_LOWER_TRANSPORT_UDP: rtp_port = rtp_get_local_rtp_port(rtp_c->rtp_handles[stream_index]); rtcp_port = rtp_get_local_rtcp_port(rtp_c->rtp_handles[stream_index]); - url_fprintf(c->pb, "Transport: RTP/AVP/UDP;unicast;" + avio_printf(c->pb, "Transport: RTP/AVP/UDP;unicast;" "client_port=%d-%d;server_port=%d-%d", th->client_port_min, th->client_port_max, rtp_port, rtcp_port); break; case RTSP_LOWER_TRANSPORT_TCP: - url_fprintf(c->pb, "Transport: RTP/AVP/TCP;interleaved=%d-%d", + avio_printf(c->pb, "Transport: RTP/AVP/TCP;interleaved=%d-%d", stream_index * 2, stream_index * 2 + 1); break; default: break; } if (setup.transport_option[0] != '\0') - url_fprintf(c->pb, ";%s", setup.transport_option); - url_fprintf(c->pb, "\r\n"); + avio_printf(c->pb, ";%s", setup.transport_option); + avio_printf(c->pb, "\r\n"); - url_fprintf(c->pb, "\r\n"); + avio_printf(c->pb, "\r\n"); } @@ -3248,8 +3248,8 @@ static void rtsp_cmd_play(HTTPContext *c, const char *url, RTSPMessageHeader *h) /* now everything is OK, so we can send the connection parameters */ rtsp_reply_header(c, RTSP_STATUS_OK); /* session ID */ - url_fprintf(c->pb, "Session: %s\r\n", rtp_c->session_id); - url_fprintf(c->pb, "\r\n"); + avio_printf(c->pb, "Session: %s\r\n", rtp_c->session_id); + avio_printf(c->pb, "\r\n"); } static void rtsp_cmd_pause(HTTPContext *c, const char *url, RTSPMessageHeader *h) @@ -3273,8 +3273,8 @@ static void rtsp_cmd_pause(HTTPContext *c, const char *url, RTSPMessageHeader *h /* now everything is OK, so we can send the connection parameters */ rtsp_reply_header(c, RTSP_STATUS_OK); /* session ID */ - url_fprintf(c->pb, "Session: %s\r\n", rtp_c->session_id); - url_fprintf(c->pb, "\r\n"); + avio_printf(c->pb, "Session: %s\r\n", rtp_c->session_id); + avio_printf(c->pb, "\r\n"); } static void rtsp_cmd_teardown(HTTPContext *c, const char *url, RTSPMessageHeader *h) @@ -3296,8 +3296,8 @@ static void rtsp_cmd_teardown(HTTPContext *c, const char *url, RTSPMessageHeader /* now everything is OK, so we can send the connection parameters */ rtsp_reply_header(c, RTSP_STATUS_OK); /* session ID */ - url_fprintf(c->pb, "Session: %s\r\n", session_id); - url_fprintf(c->pb, "\r\n"); + avio_printf(c->pb, "Session: %s\r\n", session_id); + avio_printf(c->pb, "\r\n"); } diff --git a/libavformat/avio.h b/libavformat/avio.h index 9f45a6bd87..5388c39c1e 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -430,6 +430,11 @@ attribute_deprecated int64_t url_fsize(AVIOContext *s); #define URL_EOF (-1) attribute_deprecated int url_fgetc(AVIOContext *s); attribute_deprecated int url_setbufsize(AVIOContext *s, int buf_size); +#ifdef __GNUC__ +attribute_deprecated int url_fprintf(AVIOContext *s, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3))); +#else +attribute_deprecated int url_fprintf(AVIOContext *s, const char *fmt, ...); +#endif /** * @} */ @@ -513,9 +518,9 @@ int64_t av_url_read_fseek(AVIOContext *h, int stream_index, /** @warning currently size is limited */ #ifdef __GNUC__ -int url_fprintf(AVIOContext *s, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3))); +int avio_printf(AVIOContext *s, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3))); #else -int url_fprintf(AVIOContext *s, const char *fmt, ...); +int avio_printf(AVIOContext *s, const char *fmt, ...); #endif #if FF_API_OLD_AVIO diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index 7d84b2b293..7fbe4ce76c 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -381,6 +381,18 @@ int url_setbufsize(AVIOContext *s, int buf_size) { return ffio_set_buf_size(s, buf_size); } +int url_fprintf(AVIOContext *s, const char *fmt, ...) +{ + va_list ap; + char buf[4096]; + int ret; + + va_start(ap, fmt); + ret = vsnprintf(buf, sizeof(buf), fmt, ap); + va_end(ap); + avio_write(s, buf, strlen(buf)); + return ret; +} #endif int avio_put_str(AVIOContext *s, const char *str) @@ -913,7 +925,7 @@ URLContext *url_fileno(AVIOContext *s) } #if CONFIG_MUXERS -int url_fprintf(AVIOContext *s, const char *fmt, ...) +int avio_printf(AVIOContext *s, const char *fmt, ...) { va_list ap; char buf[4096]; diff --git a/libavformat/ffmetaenc.c b/libavformat/ffmetaenc.c index 77db0b9bf8..70940c0e09 100644 --- a/libavformat/ffmetaenc.c +++ b/libavformat/ffmetaenc.c @@ -73,9 +73,9 @@ static int write_trailer(AVFormatContext *s) AVChapter *ch = s->chapters[i]; avio_write(s->pb, ID_CHAPTER, sizeof(ID_CHAPTER) - 1); avio_w8(s->pb, '\n'); - url_fprintf(s->pb, "TIMEBASE=%d/%d\n", ch->time_base.num, ch->time_base.den); - url_fprintf(s->pb, "START=%"PRId64"\n", ch->start); - url_fprintf(s->pb, "END=%"PRId64"\n", ch->end); + avio_printf(s->pb, "TIMEBASE=%d/%d\n", ch->time_base.num, ch->time_base.den); + avio_printf(s->pb, "START=%"PRId64"\n", ch->start); + avio_printf(s->pb, "END=%"PRId64"\n", ch->end); write_tags(s->pb, ch->metadata); } From eda4cf92d795ae7e233e83f5ad37209d475b7805 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 14 Mar 2011 20:39:03 +0100 Subject: [PATCH 22/34] avio: always compile avio_printf, rather than on CONFIG_MUXERS Signed-off-by: Ronald S. Bultje --- libavformat/aviobuf.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index 7fbe4ce76c..3a398210f6 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -924,7 +924,6 @@ URLContext *url_fileno(AVIOContext *s) return s->opaque; } -#if CONFIG_MUXERS int avio_printf(AVIOContext *s, const char *fmt, ...) { va_list ap; @@ -937,7 +936,6 @@ int avio_printf(AVIOContext *s, const char *fmt, ...) avio_write(s, buf, strlen(buf)); return ret; } -#endif //CONFIG_MUXERS #if FF_API_OLD_AVIO char *url_fgets(AVIOContext *s, char *buf, int buf_size) From 83fddaeb81f782e06281730a809ae2bf4c86a229 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 14 Mar 2011 20:39:04 +0100 Subject: [PATCH 23/34] avio: deprecate url_open_buf It's only used in one place and does the same thing as avio_alloc_context. Signed-off-by: Ronald S. Bultje --- ffserver.c | 3 ++- libavformat/avio.h | 4 ++-- libavformat/aviobuf.c | 2 ++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ffserver.c b/ffserver.c index 0dccbd1388..db0cd127e2 100644 --- a/ffserver.c +++ b/ffserver.c @@ -2721,7 +2721,8 @@ static int http_receive_data(HTTPContext *c) if (!fmt_in) goto fail; - url_open_buf(&pb, c->buffer, c->buffer_end - c->buffer, URL_RDONLY); + pb = avio_alloc_context(c->buffer, c->buffer_end - c->buffer, + 0, NULL, NULL, NULL, NULL); pb->is_streamed = 1; if (av_open_input_stream(&s, pb, c->stream->feed_filename, fmt_in, NULL) < 0) { diff --git a/libavformat/avio.h b/libavformat/avio.h index 5388c39c1e..74f4d55d0a 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -629,9 +629,9 @@ URLContext *url_fileno(AVIOContext *s); * @deprecated use AVIOContext.max_packet_size directly. */ attribute_deprecated int url_fget_max_packet_size(AVIOContext *s); -#endif -int url_open_buf(AVIOContext **s, uint8_t *buf, int buf_size, int flags); +attribute_deprecated int url_open_buf(AVIOContext **s, uint8_t *buf, int buf_size, int flags); +#endif /** return the written or read size */ int url_close_buf(AVIOContext *s); diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index 3a398210f6..b2683ca602 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -996,6 +996,7 @@ int64_t av_url_read_fseek(AVIOContext *s, int stream_index, * back to the server even if CONFIG_MUXERS is false. */ #if CONFIG_MUXERS || CONFIG_NETWORK /* buffer handling */ +#if FF_API_OLD_AVIO int url_open_buf(AVIOContext **s, uint8_t *buf, int buf_size, int flags) { int ret; @@ -1009,6 +1010,7 @@ int url_open_buf(AVIOContext **s, uint8_t *buf, int buf_size, int flags) av_freep(s); return ret; } +#endif int url_close_buf(AVIOContext *s) { From 35f1023592b46e608a4de1566b12268e3e9e72f0 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 14 Mar 2011 20:39:05 +0100 Subject: [PATCH 24/34] avio: deprecate url_close_buf It's not used anywhere and its return value looks broken. Signed-off-by: Ronald S. Bultje --- libavformat/avio.h | 4 ++-- libavformat/aviobuf.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libavformat/avio.h b/libavformat/avio.h index 74f4d55d0a..01ec9daf69 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -631,10 +631,10 @@ URLContext *url_fileno(AVIOContext *s); attribute_deprecated int url_fget_max_packet_size(AVIOContext *s); attribute_deprecated int url_open_buf(AVIOContext **s, uint8_t *buf, int buf_size, int flags); -#endif /** return the written or read size */ -int url_close_buf(AVIOContext *s); +attribute_deprecated int url_close_buf(AVIOContext *s); +#endif /** * Open a write only memory stream. diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index b2683ca602..2bbcf940d9 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -1010,13 +1010,13 @@ int url_open_buf(AVIOContext **s, uint8_t *buf, int buf_size, int flags) av_freep(s); return ret; } -#endif int url_close_buf(AVIOContext *s) { put_flush_packet(s); return s->buf_ptr - s->buffer; } +#endif /* output in a dynamic buffer */ From b7f2fdde74608d848f943377c40d3df804c5f955 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 14 Mar 2011 20:39:06 +0100 Subject: [PATCH 25/34] avio: rename put_flush_packet -> avio_flush Signed-off-by: Ronald S. Bultje --- libavformat/a64.c | 2 +- libavformat/adtsenc.c | 2 +- libavformat/aiffenc.c | 4 ++-- libavformat/amr.c | 4 ++-- libavformat/asfenc.c | 8 ++++---- libavformat/assenc.c | 6 +++--- libavformat/au.c | 4 ++-- libavformat/avienc.c | 8 ++++---- libavformat/avio.h | 3 ++- libavformat/aviobuf.c | 10 +++++++--- libavformat/crcenc.c | 2 +- libavformat/daud.c | 2 +- libavformat/dvenc.c | 2 +- libavformat/ffmenc.c | 6 +++--- libavformat/ffmetaenc.c | 4 ++-- libavformat/filmstripenc.c | 2 +- libavformat/flacenc.c | 4 ++-- libavformat/flvenc.c | 2 +- libavformat/framecrcenc.c | 2 +- libavformat/gif.c | 6 +++--- libavformat/gxfenc.c | 8 ++++---- libavformat/idroqenc.c | 2 +- libavformat/img2.c | 6 +++--- libavformat/ivfenc.c | 2 +- libavformat/libnut.c | 4 ++-- libavformat/matroskaenc.c | 4 ++-- libavformat/md5enc.c | 2 +- libavformat/mmf.c | 4 ++-- libavformat/movenc.c | 6 +++--- libavformat/mp3enc.c | 2 +- libavformat/mpegenc.c | 6 +++--- libavformat/mpegtsenc.c | 6 +++--- libavformat/mpjpeg.c | 4 ++-- libavformat/mxfenc.c | 6 +++--- libavformat/nutenc.c | 4 ++-- libavformat/oggenc.c | 4 ++-- libavformat/rawenc.c | 2 +- libavformat/rmenc.c | 8 ++++---- libavformat/rsoenc.c | 4 ++-- libavformat/rtpdec.c | 6 +++--- libavformat/rtpenc.c | 4 ++-- libavformat/soxenc.c | 4 ++-- libavformat/spdifenc.c | 2 +- libavformat/swfenc.c | 6 +++--- libavformat/vc1testenc.c | 4 ++-- libavformat/wav.c | 8 ++++---- libavformat/yuv4mpeg.c | 2 +- 47 files changed, 104 insertions(+), 99 deletions(-) diff --git a/libavformat/a64.c b/libavformat/a64.c index 17dcd96b5b..3481ee7d03 100644 --- a/libavformat/a64.c +++ b/libavformat/a64.c @@ -149,7 +149,7 @@ static int a64_write_packet(struct AVFormatContext *s, AVPacket *pkt) break; } - put_flush_packet(s->pb); + avio_flush(s->pb); return 0; } diff --git a/libavformat/adtsenc.c b/libavformat/adtsenc.c index 1f5453dbaf..a03e128d96 100644 --- a/libavformat/adtsenc.c +++ b/libavformat/adtsenc.c @@ -132,7 +132,7 @@ static int adts_write_packet(AVFormatContext *s, AVPacket *pkt) } } avio_write(pb, pkt->data, pkt->size); - put_flush_packet(pb); + avio_flush(pb); return 0; } diff --git a/libavformat/aiffenc.c b/libavformat/aiffenc.c index 3e5936248c..6fc09aeb63 100644 --- a/libavformat/aiffenc.c +++ b/libavformat/aiffenc.c @@ -98,7 +98,7 @@ static int aiff_write_header(AVFormatContext *s) av_set_pts_info(s->streams[0], 64, 1, s->streams[0]->codec->sample_rate); /* Data is starting here */ - put_flush_packet(pb); + avio_flush(pb); return 0; } @@ -140,7 +140,7 @@ static int aiff_write_trailer(AVFormatContext *s) /* return to the end */ avio_seek(pb, end_size, SEEK_SET); - put_flush_packet(pb); + avio_flush(pb); } return 0; diff --git a/libavformat/amr.c b/libavformat/amr.c index 522d83ea8b..e7a6758986 100644 --- a/libavformat/amr.c +++ b/libavformat/amr.c @@ -50,14 +50,14 @@ static int amr_write_header(AVFormatContext *s) { return -1; } - put_flush_packet(pb); + avio_flush(pb); return 0; } static int amr_write_packet(AVFormatContext *s, AVPacket *pkt) { avio_write(s->pb, pkt->data, pkt->size); - put_flush_packet(s->pb); + avio_flush(s->pb); return 0; } #endif /* CONFIG_AMR_MUXER */ diff --git a/libavformat/asfenc.c b/libavformat/asfenc.c index 3a06044036..36b9472018 100644 --- a/libavformat/asfenc.c +++ b/libavformat/asfenc.c @@ -574,7 +574,7 @@ static int asf_write_header(AVFormatContext *s) return -1; } - put_flush_packet(s->pb); + avio_flush(s->pb); asf->packet_nb_payloads = 0; asf->packet_timestamp_start = -1; @@ -672,7 +672,7 @@ static void flush_packet(AVFormatContext *s) avio_write(s->pb, asf->packet_buf, s->packet_size - packet_hdr_size); - put_flush_packet(s->pb); + avio_flush(s->pb); asf->nb_packets++; asf->packet_nb_payloads = 0; asf->packet_timestamp_start = -1; @@ -864,7 +864,7 @@ static int asf_write_trailer(AVFormatContext *s) if ((!asf->is_streamed) && (asf->nb_index_count != 0)) { asf_write_index(s, asf->index_ptr, asf->maximum_packet, asf->nb_index_count); } - put_flush_packet(s->pb); + avio_flush(s->pb); if (asf->is_streamed || url_is_streamed(s->pb)) { put_chunk(s, 0x4524, 0, 0); /* end of stream */ @@ -875,7 +875,7 @@ static int asf_write_trailer(AVFormatContext *s) asf_write_header1(s, file_size, data_size - asf->data_offset); } - put_flush_packet(s->pb); + avio_flush(s->pb); av_free(asf->index_ptr); return 0; } diff --git a/libavformat/assenc.c b/libavformat/assenc.c index 9abe302744..b367668d2d 100644 --- a/libavformat/assenc.c +++ b/libavformat/assenc.c @@ -50,7 +50,7 @@ static int write_header(AVFormatContext *s) last=p; } - put_flush_packet(s->pb); + avio_flush(s->pb); return 0; } @@ -59,7 +59,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) { avio_write(s->pb, pkt->data, pkt->size); - put_flush_packet(s->pb); + avio_flush(s->pb); return 0; } @@ -72,7 +72,7 @@ static int write_trailer(AVFormatContext *s) avio_write(s->pb, avctx->extradata + ass->extra_index, avctx->extradata_size - ass->extra_index); - put_flush_packet(s->pb); + avio_flush(s->pb); return 0; } diff --git a/libavformat/au.c b/libavformat/au.c index 3ee0e45fb6..9c674ac6f6 100644 --- a/libavformat/au.c +++ b/libavformat/au.c @@ -74,7 +74,7 @@ static int au_write_header(AVFormatContext *s) return -1; } - put_flush_packet(pb); + avio_flush(pb); return 0; } @@ -99,7 +99,7 @@ static int au_write_trailer(AVFormatContext *s) avio_wb32(pb, (uint32_t)(file_size - 24)); avio_seek(pb, file_size, SEEK_SET); - put_flush_packet(pb); + avio_flush(pb); } return 0; diff --git a/libavformat/avienc.c b/libavformat/avienc.c index 3604a6c399..3743abb8d7 100644 --- a/libavformat/avienc.c +++ b/libavformat/avienc.c @@ -393,7 +393,7 @@ static int avi_write_header(AVFormatContext *s) avi->movi_list = ff_start_tag(pb, "LIST"); ffio_wfourcc(pb, "movi"); - put_flush_packet(pb); + avio_flush(pb); return 0; } @@ -438,7 +438,7 @@ static int avi_write_ix(AVFormatContext *s) avio_wl32(pb, ((uint32_t)ie->len & ~0x80000000) | (ie->flags & 0x10 ? 0 : 0x80000000)); } - put_flush_packet(pb); + avio_flush(pb); pos = avio_tell(pb); /* Updating one entry in the AVI OpenDML master index */ @@ -578,7 +578,7 @@ static int avi_write_packet(AVFormatContext *s, AVPacket *pkt) if (size & 1) avio_w8(pb, 0); - put_flush_packet(pb); + avio_flush(pb); return 0; } @@ -624,7 +624,7 @@ static int avi_write_trailer(AVFormatContext *s) avi_write_counters(s, avi->riff_id); } } - put_flush_packet(pb); + avio_flush(pb); for (i=0; inb_streams; i++) { AVIStream *avist= s->streams[i]->priv_data; diff --git a/libavformat/avio.h b/libavformat/avio.h index 01ec9daf69..a8e98cb529 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -435,6 +435,7 @@ attribute_deprecated int url_fprintf(AVIOContext *s, const char *fmt, ...) __att #else attribute_deprecated int url_fprintf(AVIOContext *s, const char *fmt, ...); #endif +attribute_deprecated void put_flush_packet(AVIOContext *s); /** * @} */ @@ -529,7 +530,7 @@ int avio_printf(AVIOContext *s, const char *fmt, ...); attribute_deprecated char *url_fgets(AVIOContext *s, char *buf, int buf_size); #endif -void put_flush_packet(AVIOContext *s); +void avio_flush(AVIOContext *s); /** diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index 2bbcf940d9..a0cb9a8921 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -170,7 +170,7 @@ void avio_write(AVIOContext *s, const unsigned char *buf, int size) } } -void put_flush_packet(AVIOContext *s) +void avio_flush(AVIOContext *s) { flush_buffer(s); s->must_flush = 0; @@ -393,6 +393,10 @@ int url_fprintf(AVIOContext *s, const char *fmt, ...) avio_write(s, buf, strlen(buf)); return ret; } +void put_flush_packet(AVIOContext *s) +{ + avio_flush(s); +} #endif int avio_put_str(AVIOContext *s, const char *str) @@ -1013,7 +1017,7 @@ int url_open_buf(AVIOContext **s, uint8_t *buf, int buf_size, int flags) int url_close_buf(AVIOContext *s) { - put_flush_packet(s); + avio_flush(s); return s->buf_ptr - s->buffer; } #endif @@ -1141,7 +1145,7 @@ int url_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer) padding = FF_INPUT_BUFFER_PADDING_SIZE; } - put_flush_packet(s); + avio_flush(s); *pbuffer = d->buffer; size = d->size; diff --git a/libavformat/crcenc.c b/libavformat/crcenc.c index ec106b0b38..b5fed3918d 100644 --- a/libavformat/crcenc.c +++ b/libavformat/crcenc.c @@ -50,7 +50,7 @@ static int crc_write_trailer(struct AVFormatContext *s) snprintf(buf, sizeof(buf), "CRC=0x%08x\n", crc->crcval); avio_write(s->pb, buf, strlen(buf)); - put_flush_packet(s->pb); + avio_flush(s->pb); return 0; } diff --git a/libavformat/daud.c b/libavformat/daud.c index f852105a0c..77cae8a855 100644 --- a/libavformat/daud.c +++ b/libavformat/daud.c @@ -60,7 +60,7 @@ static int daud_write_packet(struct AVFormatContext *s, AVPacket *pkt) avio_wb16(s->pb, pkt->size); avio_wb16(s->pb, 0x8010); // unknown avio_write(s->pb, pkt->data, pkt->size); - put_flush_packet(s->pb); + avio_flush(s->pb); return 0; } diff --git a/libavformat/dvenc.c b/libavformat/dvenc.c index 6d90024eef..0b80835fae 100644 --- a/libavformat/dvenc.c +++ b/libavformat/dvenc.c @@ -382,7 +382,7 @@ static int dv_write_packet(struct AVFormatContext *s, AVPacket *pkt) pkt->data, pkt->size, &frame); if (fsize > 0) { avio_write(s->pb, frame, fsize); - put_flush_packet(s->pb); + avio_flush(s->pb); } return 0; } diff --git a/libavformat/ffmenc.c b/libavformat/ffmenc.c index e648393c89..8071045467 100644 --- a/libavformat/ffmenc.c +++ b/libavformat/ffmenc.c @@ -44,7 +44,7 @@ static void flush_packet(AVFormatContext *s) h |= 0x8000; avio_wb16(pb, h); avio_write(pb, ffm->packet, ffm->packet_end - ffm->packet); - put_flush_packet(pb); + avio_flush(pb); /* prepare next packet */ ffm->frame_offset = 0; /* no key frame */ @@ -187,7 +187,7 @@ static int ffm_write_header(AVFormatContext *s) while ((avio_tell(pb) % ffm->packet_size) != 0) avio_w8(pb, 0); - put_flush_packet(pb); + avio_flush(pb); /* init packet mux */ ffm->packet_ptr = ffm->packet; @@ -235,7 +235,7 @@ static int ffm_write_trailer(AVFormatContext *s) if (ffm->packet_ptr > ffm->packet) flush_packet(s); - put_flush_packet(pb); + avio_flush(pb); return 0; } diff --git a/libavformat/ffmetaenc.c b/libavformat/ffmetaenc.c index 70940c0e09..596185b70c 100644 --- a/libavformat/ffmetaenc.c +++ b/libavformat/ffmetaenc.c @@ -53,7 +53,7 @@ static int write_header(AVFormatContext *s) avio_write(s->pb, ID_STRING, sizeof(ID_STRING) - 1); avio_w8(s->pb, '1'); // version avio_w8(s->pb, '\n'); - put_flush_packet(s->pb); + avio_flush(s->pb); return 0; } @@ -79,7 +79,7 @@ static int write_trailer(AVFormatContext *s) write_tags(s->pb, ch->metadata); } - put_flush_packet(s->pb); + avio_flush(s->pb); return 0; } diff --git a/libavformat/filmstripenc.c b/libavformat/filmstripenc.c index d20b4ecd4c..9bbc546eaf 100644 --- a/libavformat/filmstripenc.c +++ b/libavformat/filmstripenc.c @@ -67,7 +67,7 @@ static int write_trailer(AVFormatContext *s) avio_wb16(pb, 1/av_q2d(st->codec->time_base)); for (i = 0; i < 16; i++) avio_w8(pb, 0x00); // reserved - put_flush_packet(pb); + avio_flush(pb); return 0; } diff --git a/libavformat/flacenc.c b/libavformat/flacenc.c index 079e6dd713..e7605f5b23 100644 --- a/libavformat/flacenc.c +++ b/libavformat/flacenc.c @@ -104,7 +104,7 @@ static int flac_write_trailer(struct AVFormatContext *s) avio_seek(pb, 8, SEEK_SET); avio_write(pb, streaminfo, FLAC_STREAMINFO_SIZE); avio_seek(pb, file_size, SEEK_SET); - put_flush_packet(pb); + avio_flush(pb); } else { av_log(s, AV_LOG_WARNING, "unable to rewrite FLAC header.\n"); } @@ -114,7 +114,7 @@ static int flac_write_trailer(struct AVFormatContext *s) static int flac_write_packet(struct AVFormatContext *s, AVPacket *pkt) { avio_write(s->pb, pkt->data, pkt->size); - put_flush_packet(s->pb); + avio_flush(s->pb); return 0; } diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c index a1ed705d7b..b1e048551f 100644 --- a/libavformat/flvenc.c +++ b/libavformat/flvenc.c @@ -430,7 +430,7 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) avio_wb32(pb,size+flags_size+11); // previous tag size flv->duration = FFMAX(flv->duration, pkt->pts + flv->delay + pkt->duration); - put_flush_packet(pb); + avio_flush(pb); av_free(data); diff --git a/libavformat/framecrcenc.c b/libavformat/framecrcenc.c index 26ede95495..dcdfac882a 100644 --- a/libavformat/framecrcenc.c +++ b/libavformat/framecrcenc.c @@ -29,7 +29,7 @@ static int framecrc_write_packet(struct AVFormatContext *s, AVPacket *pkt) snprintf(buf, sizeof(buf), "%d, %"PRId64", %d, 0x%08x\n", pkt->stream_index, pkt->dts, pkt->size, crc); avio_write(s->pb, buf, strlen(buf)); - put_flush_packet(s->pb); + avio_flush(s->pb); return 0; } diff --git a/libavformat/gif.c b/libavformat/gif.c index 17effaaa46..f5f8147e4f 100644 --- a/libavformat/gif.c +++ b/libavformat/gif.c @@ -287,7 +287,7 @@ static int gif_write_header(AVFormatContext *s) gif_image_write_header(pb, width, height, loop_count, NULL); - put_flush_packet(s->pb); + avio_flush(s->pb); return 0; } @@ -322,7 +322,7 @@ static int gif_write_video(AVFormatContext *s, gif_image_write_image(pb, 0, 0, enc->width, enc->height, buf, enc->width * 3, PIX_FMT_RGB24); - put_flush_packet(s->pb); + avio_flush(s->pb); return 0; } @@ -340,7 +340,7 @@ static int gif_write_trailer(AVFormatContext *s) AVIOContext *pb = s->pb; avio_w8(pb, 0x3b); - put_flush_packet(s->pb); + avio_flush(s->pb); return 0; } diff --git a/libavformat/gxfenc.c b/libavformat/gxfenc.c index 44b5020db0..e6c44d6fd9 100644 --- a/libavformat/gxfenc.c +++ b/libavformat/gxfenc.c @@ -753,7 +753,7 @@ static int gxf_write_header(AVFormatContext *s) gxf->packet_count = 3; - put_flush_packet(pb); + avio_flush(pb); return 0; } @@ -781,12 +781,12 @@ static int gxf_write_trailer(AVFormatContext *s) gxf_write_map_packet(s, 1); gxf_write_flt_packet(s); gxf_write_umf_packet(s); - put_flush_packet(pb); + avio_flush(pb); /* update duration in all map packets */ for (i = 1; i < gxf->map_offsets_nb; i++) { avio_seek(pb, gxf->map_offsets[i], SEEK_SET); gxf_write_map_packet(s, 1); - put_flush_packet(pb); + avio_flush(pb); } avio_seek(pb, end, SEEK_SET); @@ -895,7 +895,7 @@ static int gxf_write_packet(AVFormatContext *s, AVPacket *pkt) gxf->packet_count = 0; } - put_flush_packet(pb); + avio_flush(pb); return 0; } diff --git a/libavformat/idroqenc.c b/libavformat/idroqenc.c index 9935b61e1b..3e8f179846 100644 --- a/libavformat/idroqenc.c +++ b/libavformat/idroqenc.c @@ -30,7 +30,7 @@ static int roq_write_header(struct AVFormatContext *s) }; avio_write(s->pb, header, 8); - put_flush_packet(s->pb); + avio_flush(s->pb); return 0; } diff --git a/libavformat/img2.c b/libavformat/img2.c index 44c53fc18c..d7e014f132 100644 --- a/libavformat/img2.c +++ b/libavformat/img2.c @@ -372,8 +372,8 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) avio_write(pb[0], pkt->data , ysize); avio_write(pb[1], pkt->data + ysize, (pkt->size - ysize)/2); avio_write(pb[2], pkt->data + ysize +(pkt->size - ysize)/2, (pkt->size - ysize)/2); - put_flush_packet(pb[1]); - put_flush_packet(pb[2]); + avio_flush(pb[1]); + avio_flush(pb[2]); avio_close(pb[1]); avio_close(pb[2]); }else{ @@ -402,7 +402,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) } avio_write(pb[0], pkt->data, pkt->size); } - put_flush_packet(pb[0]); + avio_flush(pb[0]); if (!img->is_pipe) { avio_close(pb[0]); } diff --git a/libavformat/ivfenc.c b/libavformat/ivfenc.c index 3913988144..5fffaf7959 100644 --- a/libavformat/ivfenc.c +++ b/libavformat/ivfenc.c @@ -53,7 +53,7 @@ static int ivf_write_packet(AVFormatContext *s, AVPacket *pkt) avio_wl32(pb, pkt->size); avio_wl64(pb, pkt->pts); avio_write(pb, pkt->data, pkt->size); - put_flush_packet(pb); + avio_flush(pb); return 0; } diff --git a/libavformat/libnut.c b/libavformat/libnut.c index 1c13e295f7..5e5831892a 100644 --- a/libavformat/libnut.c +++ b/libavformat/libnut.c @@ -48,7 +48,7 @@ static const AVCodecTag nut_tags[] = { static int av_write(void * h, size_t len, const uint8_t * buf) { AVIOContext * bc = h; avio_write(bc, buf, len); - //put_flush_packet(bc); + //avio_flush(bc); return len; } @@ -142,7 +142,7 @@ static int nut_write_trailer(AVFormatContext * avf) { int i; nut_muxer_uninit_reorder(priv->nut); - put_flush_packet(bc); + avio_flush(bc); for(i = 0; priv->s[i].type != -1; i++ ) av_freep(&priv->s[i].fourcc); av_freep(&priv->s); diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 4c4f00958e..0c6e51c978 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -873,7 +873,7 @@ static int mkv_write_header(AVFormatContext *s) mkv->cur_audio_pkt.size = 0; mkv->audio_buffer_size = 0; - put_flush_packet(pb); + avio_flush(pb); return 0; } @@ -1172,7 +1172,7 @@ static int mkv_write_trailer(AVFormatContext *s) end_ebml_master(pb, mkv->segment); av_free(mkv->tracks); av_destruct_packet(&mkv->cur_audio_pkt); - put_flush_packet(pb); + avio_flush(pb); return 0; } diff --git a/libavformat/md5enc.c b/libavformat/md5enc.c index 065f7e8dc9..10b3d59581 100644 --- a/libavformat/md5enc.c +++ b/libavformat/md5enc.c @@ -37,7 +37,7 @@ static void md5_finish(struct AVFormatContext *s, char *buf) buf[offset+1] = 0; avio_write(s->pb, buf, strlen(buf)); - put_flush_packet(s->pb); + avio_flush(s->pb); } #if CONFIG_MD5_MUXER diff --git a/libavformat/mmf.c b/libavformat/mmf.c index a3e8b99cb4..72dc954132 100644 --- a/libavformat/mmf.c +++ b/libavformat/mmf.c @@ -102,7 +102,7 @@ static int mmf_write_header(AVFormatContext *s) av_set_pts_info(s->streams[0], 64, 1, s->streams[0]->codec->sample_rate); - put_flush_packet(pb); + avio_flush(pb); return 0; } @@ -160,7 +160,7 @@ static int mmf_write_trailer(AVFormatContext *s) avio_seek(pb, pos, SEEK_SET); - put_flush_packet(pb); + avio_flush(pb); } return 0; } diff --git a/libavformat/movenc.c b/libavformat/movenc.c index e1fd79d6ec..774cd3a3b5 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -2042,7 +2042,7 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt) trk->sampleCount += samplesInChunk; mov->mdat_size += size; - put_flush_packet(pb); + avio_flush(pb); if (trk->hint_track >= 0 && trk->hint_track < mov->nb_streams) ff_mov_add_hinted_packet(s, pkt, trk->hint_track, trk->entry); @@ -2227,7 +2227,7 @@ static int mov_write_header(AVFormatContext *s) } } - put_flush_packet(pb); + avio_flush(pb); return 0; error: @@ -2271,7 +2271,7 @@ static int mov_write_trailer(AVFormatContext *s) } - put_flush_packet(pb); + avio_flush(pb); av_freep(&mov->tracks); diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c index 67ec826589..88b1475313 100644 --- a/libavformat/mp3enc.c +++ b/libavformat/mp3enc.c @@ -133,7 +133,7 @@ static int mp3_write_trailer(struct AVFormatContext *s) /* write the id3v1 tag */ if (id3v1_create_tag(s, buf) > 0) { avio_write(s->pb, buf, ID3v1_TAG_SIZE); - put_flush_packet(s->pb); + avio_flush(s->pb); } return 0; } diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c index 8c5c644f42..0c86df1eea 100644 --- a/libavformat/mpegenc.c +++ b/libavformat/mpegenc.c @@ -936,7 +936,7 @@ static int flush_packet(AVFormatContext *ctx, int stream_index, for(i=0;ipb, 0x00); - put_flush_packet(ctx->pb); + avio_flush(ctx->pb); s->packet_number++; @@ -965,7 +965,7 @@ static void put_vcd_padding_sector(AVFormatContext *ctx) s->vcd_padding_bytes_written += s->packet_size; - put_flush_packet(ctx->pb); + avio_flush(ctx->pb); /* increasing the packet number is correct. The SCR of the following packs is calculated from the packet_number and it has to include the padding @@ -1221,7 +1221,7 @@ static int mpeg_mux_end(AVFormatContext *ctx) it as it is usually not needed by decoders and because it complicates MPEG stream concatenation. */ //avio_wb32(ctx->pb, ISO_11172_END_CODE); - //put_flush_packet(ctx->pb); + //avio_flush(ctx->pb); for(i=0;inb_streams;i++) { stream = ctx->streams[i]->priv_data; diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index 11a840f8e4..3461a33a6a 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -579,7 +579,7 @@ static int mpegts_write_header(AVFormatContext *s) service->pcr_packet_period, ts->sdt_packet_period, ts->pat_packet_period); - put_flush_packet(s->pb); + avio_flush(s->pb); return 0; @@ -865,7 +865,7 @@ static void mpegts_write_pes(AVFormatContext *s, AVStream *st, payload_size -= len; avio_write(s->pb, buf, TS_PACKET_SIZE); } - put_flush_packet(s->pb); + avio_flush(s->pb); } static int mpegts_write_packet(AVFormatContext *s, AVPacket *pkt) @@ -988,7 +988,7 @@ static int mpegts_write_end(AVFormatContext *s) } av_freep(&ts_st->adts); } - put_flush_packet(s->pb); + avio_flush(s->pb); for(i = 0; i < ts->nb_services; i++) { service = ts->services[i]; diff --git a/libavformat/mpjpeg.c b/libavformat/mpjpeg.c index e98fb363e7..e6f6bcc5f6 100644 --- a/libavformat/mpjpeg.c +++ b/libavformat/mpjpeg.c @@ -30,7 +30,7 @@ static int mpjpeg_write_header(AVFormatContext *s) snprintf(buf1, sizeof(buf1), "--%s\n", BOUNDARY_TAG); avio_write(s->pb, buf1, strlen(buf1)); - put_flush_packet(s->pb); + avio_flush(s->pb); return 0; } @@ -44,7 +44,7 @@ static int mpjpeg_write_packet(AVFormatContext *s, AVPacket *pkt) snprintf(buf1, sizeof(buf1), "\n--%s\n", BOUNDARY_TAG); avio_write(s->pb, buf1, strlen(buf1)); - put_flush_packet(s->pb); + avio_flush(s->pb); return 0; } diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c index 8e1cfc7b0d..8cf5d93257 100644 --- a/libavformat/mxfenc.c +++ b/libavformat/mxfenc.c @@ -1272,7 +1272,7 @@ static void mxf_write_partition(AVFormatContext *s, int bodysid, avio_seek(pb, pos, SEEK_SET); } - put_flush_packet(pb); + avio_flush(pb); } static const UID mxf_mpeg2_codec_uls[] = { @@ -1731,7 +1731,7 @@ static int mxf_write_packet(AVFormatContext *s, AVPacket *pkt) mxf->body_offset += 16+4+pkt->size + klv_fill_size(16+4+pkt->size); } - put_flush_packet(pb); + avio_flush(pb); return 0; } @@ -1795,7 +1795,7 @@ static int mxf_write_footer(AVFormatContext *s) } } - put_flush_packet(pb); + avio_flush(pb); ff_audio_interleave_close(s); diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c index 05ec576ad4..86701fa1aa 100644 --- a/libavformat/nutenc.c +++ b/libavformat/nutenc.c @@ -639,7 +639,7 @@ static int write_header(AVFormatContext *s){ if ((ret = write_headers(s, bc)) < 0) return ret; - put_flush_packet(bc); + avio_flush(bc); //FIXME index @@ -843,7 +843,7 @@ static int write_trailer(AVFormatContext *s){ while(nut->header_count<3) write_headers(s, bc); - put_flush_packet(bc); + avio_flush(bc); ff_nut_free_sp(nut); av_freep(&nut->stream); av_freep(&nut->time_base); diff --git a/libavformat/oggenc.c b/libavformat/oggenc.c index 39e36c8b6b..fd88650629 100644 --- a/libavformat/oggenc.c +++ b/libavformat/oggenc.c @@ -99,14 +99,14 @@ static int ogg_write_page(AVFormatContext *s, OGGPage *page, int extra_flags) avio_write(pb, page->data, page->size); ogg_update_checksum(s, pb, crc_offset); - put_flush_packet(pb); + avio_flush(pb); size = url_close_dyn_buf(pb, &buf); if (size < 0) return size; avio_write(s->pb, buf, size); - put_flush_packet(s->pb); + avio_flush(s->pb); av_free(buf); oggstream->page_count--; return 0; diff --git a/libavformat/rawenc.c b/libavformat/rawenc.c index 20ddfd5609..a43d5f61b2 100644 --- a/libavformat/rawenc.c +++ b/libavformat/rawenc.c @@ -26,7 +26,7 @@ int ff_raw_write_packet(AVFormatContext *s, AVPacket *pkt) { avio_write(s->pb, pkt->data, pkt->size); - put_flush_packet(s->pb); + avio_flush(s->pb); return 0; } diff --git a/libavformat/rmenc.c b/libavformat/rmenc.c index 8a608861f5..4835cf4435 100644 --- a/libavformat/rmenc.c +++ b/libavformat/rmenc.c @@ -341,7 +341,7 @@ static int rm_write_header(AVFormatContext *s) if (rv10_write_header(s, 0, 0)) return AVERROR_INVALIDDATA; - put_flush_packet(s->pb); + avio_flush(s->pb); return 0; } @@ -368,7 +368,7 @@ static int rm_write_audio(AVFormatContext *s, const uint8_t *buf, int size, int } else { avio_write(pb, buf, size); } - put_flush_packet(pb); + avio_flush(pb); stream->nb_frames++; av_free(buf1); return 0; @@ -413,7 +413,7 @@ static int rm_write_video(AVFormatContext *s, const uint8_t *buf, int size, int avio_w8(pb, stream->nb_frames & 0xff); avio_write(pb, buf, size); - put_flush_packet(pb); + avio_flush(pb); stream->nb_frames++; return 0; @@ -454,7 +454,7 @@ static int rm_write_trailer(AVFormatContext *s) avio_wb32(pb, 0); avio_wb32(pb, 0); } - put_flush_packet(pb); + avio_flush(pb); return 0; } diff --git a/libavformat/rsoenc.c b/libavformat/rsoenc.c index fc7df76f76..58cfc798c9 100644 --- a/libavformat/rsoenc.c +++ b/libavformat/rsoenc.c @@ -60,7 +60,7 @@ static int rso_write_header(AVFormatContext *s) avio_wb16(pb, enc->sample_rate); avio_wb16(pb, 0x0000); /* play mode ? (0x0000 = don't loop) */ - put_flush_packet(pb); + avio_flush(pb); return 0; } @@ -95,7 +95,7 @@ static int rso_write_trailer(AVFormatContext *s) avio_wb16(pb, coded_file_size); avio_seek(pb, file_size, SEEK_SET); - put_flush_packet(pb); + avio_flush(pb); return 0; } diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c index b4b8ffcd72..438ceda810 100644 --- a/libavformat/rtpdec.c +++ b/libavformat/rtpdec.c @@ -320,7 +320,7 @@ int rtp_check_and_send_back_rr(RTPDemuxContext *s, int count) avio_w8(pb, 0); } - put_flush_packet(pb); + avio_flush(pb); len = url_close_dyn_buf(pb, &buf); if ((len > 0) && buf) { int result; @@ -348,7 +348,7 @@ void rtp_send_punch_packets(URLContext* rtp_handle) avio_wb32(pb, 0); /* Timestamp */ avio_wb32(pb, 0); /* SSRC */ - put_flush_packet(pb); + avio_flush(pb); len = url_close_dyn_buf(pb, &buf); if ((len > 0) && buf) url_write(rtp_handle, buf, len); @@ -363,7 +363,7 @@ void rtp_send_punch_packets(URLContext* rtp_handle) avio_wb16(pb, 1); /* length in words - 1 */ avio_wb32(pb, 0); /* our own SSRC */ - put_flush_packet(pb); + avio_flush(pb); len = url_close_dyn_buf(pb, &buf); if ((len > 0) && buf) url_write(rtp_handle, buf, len); diff --git a/libavformat/rtpenc.c b/libavformat/rtpenc.c index 6c49d34c31..71ccdabf4a 100644 --- a/libavformat/rtpenc.c +++ b/libavformat/rtpenc.c @@ -206,7 +206,7 @@ static void rtcp_send_sr(AVFormatContext *s1, int64_t ntp_time) avio_wb32(s1->pb, rtp_ts); avio_wb32(s1->pb, s->packet_count); avio_wb32(s1->pb, s->octet_count); - put_flush_packet(s1->pb); + avio_flush(s1->pb); } /* send an rtp packet. sequence number is incremented, but the caller @@ -225,7 +225,7 @@ void ff_rtp_send_data(AVFormatContext *s1, const uint8_t *buf1, int len, int m) avio_wb32(s1->pb, s->ssrc); avio_write(s1->pb, buf1, len); - put_flush_packet(s1->pb); + avio_flush(s1->pb); s->seq++; s->octet_count += len; diff --git a/libavformat/soxenc.c b/libavformat/soxenc.c index fb68d0b908..214acdd59b 100644 --- a/libavformat/soxenc.c +++ b/libavformat/soxenc.c @@ -78,7 +78,7 @@ static int sox_write_header(AVFormatContext *s) for ( ; comment_size > comment_len; comment_len++) avio_w8(pb, 0); - put_flush_packet(pb); + avio_flush(pb); return 0; } @@ -107,7 +107,7 @@ static int sox_write_trailer(AVFormatContext *s) avio_wb64(pb, num_samples); avio_seek(pb, file_size, SEEK_SET); - put_flush_packet(pb); + avio_flush(pb); } return 0; diff --git a/libavformat/spdifenc.c b/libavformat/spdifenc.c index b4111f62b7..f6d4ec160e 100644 --- a/libavformat/spdifenc.c +++ b/libavformat/spdifenc.c @@ -531,7 +531,7 @@ static int spdif_write_packet(struct AVFormatContext *s, AVPacket *pkt) av_log(s, AV_LOG_DEBUG, "type=%x len=%i pkt_offset=%i\n", ctx->data_type, ctx->out_bytes, ctx->pkt_offset); - put_flush_packet(s->pb); + avio_flush(s->pb); return 0; } diff --git a/libavformat/swfenc.c b/libavformat/swfenc.c index 182cb65660..052d7205e8 100644 --- a/libavformat/swfenc.c +++ b/libavformat/swfenc.c @@ -326,7 +326,7 @@ static int swf_write_header(AVFormatContext *s) put_swf_end_tag(s); } - put_flush_packet(s->pb); + avio_flush(s->pb); return 0; } @@ -432,7 +432,7 @@ static int swf_write_video(AVFormatContext *s, put_swf_tag(s, TAG_SHOWFRAME); put_swf_end_tag(s); - put_flush_packet(s->pb); + avio_flush(s->pb); return 0; } @@ -489,7 +489,7 @@ static int swf_write_trailer(AVFormatContext *s) put_swf_tag(s, TAG_END); put_swf_end_tag(s); - put_flush_packet(s->pb); + avio_flush(s->pb); /* patch file size and number of frames if not streamed */ if (!url_is_streamed(s->pb) && video_enc) { diff --git a/libavformat/vc1testenc.c b/libavformat/vc1testenc.c index 65ac6029ac..89ee9ef78c 100644 --- a/libavformat/vc1testenc.c +++ b/libavformat/vc1testenc.c @@ -62,7 +62,7 @@ static int vc1test_write_packet(AVFormatContext *s, AVPacket *pkt) avio_wl32(pb, pkt->size | ((pkt->flags & AV_PKT_FLAG_KEY) ? 0x80000000 : 0)); avio_wl32(pb, pkt->pts); avio_write(pb, pkt->data, pkt->size); - put_flush_packet(pb); + avio_flush(pb); ctx->frames++; return 0; @@ -76,7 +76,7 @@ static int vc1test_write_trailer(AVFormatContext *s) if (!url_is_streamed(s->pb)) { avio_seek(pb, 0, SEEK_SET); avio_wl24(pb, ctx->frames); - put_flush_packet(pb); + avio_flush(pb); } return 0; } diff --git a/libavformat/wav.c b/libavformat/wav.c index d96b379b2c..28ebe140b6 100644 --- a/libavformat/wav.c +++ b/libavformat/wav.c @@ -71,7 +71,7 @@ static int wav_write_header(AVFormatContext *s) /* data header */ wav->data = ff_start_tag(pb, "data"); - put_flush_packet(pb); + avio_flush(pb); return 0; } @@ -96,7 +96,7 @@ static int wav_write_trailer(AVFormatContext *s) WAVContext *wav = s->priv_data; int64_t file_size; - put_flush_packet(pb); + avio_flush(pb); if (!url_is_streamed(s->pb)) { ff_end_tag(pb, wav->data); @@ -107,7 +107,7 @@ static int wav_write_trailer(AVFormatContext *s) avio_wl32(pb, (uint32_t)(file_size - 8)); avio_seek(pb, file_size, SEEK_SET); - put_flush_packet(pb); + avio_flush(pb); if(s->streams[0]->codec->codec_tag != 0x01) { /* Update num_samps in fact chunk */ @@ -118,7 +118,7 @@ static int wav_write_trailer(AVFormatContext *s) avio_seek(pb, wav->data-12, SEEK_SET); avio_wl32(pb, number_of_samples); avio_seek(pb, file_size, SEEK_SET); - put_flush_packet(pb); + avio_flush(pb); } } return 0; diff --git a/libavformat/yuv4mpeg.c b/libavformat/yuv4mpeg.c index 01366b08b6..a852568a64 100644 --- a/libavformat/yuv4mpeg.c +++ b/libavformat/yuv4mpeg.c @@ -143,7 +143,7 @@ static int yuv4_write_packet(AVFormatContext *s, AVPacket *pkt) ptr2 += picture->linesize[2]; } } - put_flush_packet(pb); + avio_flush(pb); return 0; } From f578854efce12842ed4e4e25b36cf2f798054468 Mon Sep 17 00:00:00 2001 From: Young Han Lee Date: Fri, 11 Mar 2011 11:39:24 +0900 Subject: [PATCH 26/34] aaccoder: Change FFMAX for allzero flag to OR bit operation Signed-off-by: Ronald S. Bultje --- libavcodec/aaccoder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c index 8063fb6cd4..d2c928205f 100644 --- a/libavcodec/aaccoder.c +++ b/libavcodec/aaccoder.c @@ -723,7 +723,7 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx, sce->zeroes[w*16+g] = !nz; if (nz) minthr = FFMIN(minthr, uplim); - allz = FFMAX(allz, nz); + allz |= nz; } } for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) { From b7c96769c52a312c6f6abe43f5d8c83701118a0b Mon Sep 17 00:00:00 2001 From: Nathan Caldwell Date: Wed, 16 Mar 2011 23:34:12 -0400 Subject: [PATCH 27/34] aacenc: Refactor the parts of the AAC psymodel. 3GPP: Remove ffac from and move min_snr out of AacPsyBand. Rearrange AacPsyCoeffs to make it easier to implement energy spreading. Rename the band[] array to bands[] Copy energies and thresholds at the end of analysis. LAME: Use a loop instead of an if chain in LAME windowing. --- libavcodec/aacpsy.c | 85 ++++++++++++++++++++++----------------------- 1 file changed, 41 insertions(+), 44 deletions(-) diff --git a/libavcodec/aacpsy.c b/libavcodec/aacpsy.c index a987be0abb..de3b0f329e 100644 --- a/libavcodec/aacpsy.c +++ b/libavcodec/aacpsy.c @@ -61,9 +61,7 @@ */ typedef struct AacPsyBand{ float energy; ///< band energy - float ffac; ///< form factor float thr; ///< energy threshold - float min_snr; ///< minimal SNR float thr_quiet; ///< threshold in quiet }AacPsyBand; @@ -88,17 +86,18 @@ typedef struct AacPsyChannel{ * psychoacoustic model frame type-dependent coefficients */ typedef struct AacPsyCoeffs{ - float ath [64]; ///< absolute threshold of hearing per bands - float barks [64]; ///< Bark value for each spectral band in long frame - float spread_low[64]; ///< spreading factor for low-to-high threshold spreading in long frame - float spread_hi [64]; ///< spreading factor for high-to-low threshold spreading in long frame + float ath; ///< absolute threshold of hearing per bands + float barks; ///< Bark value for each spectral band in long frame + float spread_low[2]; ///< spreading factor for low-to-high threshold spreading in long frame + float spread_hi [2]; ///< spreading factor for high-to-low threshold spreading in long frame + float min_snr; ///< minimal SNR }AacPsyCoeffs; /** * 3GPP TS26.403-inspired psychoacoustic model specific data */ typedef struct AacPsyContext{ - AacPsyCoeffs psy_coef[2]; + AacPsyCoeffs psy_coef[2][64]; AacPsyChannel *ch; }AacPsyContext; @@ -243,27 +242,30 @@ static av_cold int psy_3gpp_init(FFPsyContext *ctx) { minath = ath(3410, ATH_ADD); for (j = 0; j < 2; j++) { - AacPsyCoeffs *coeffs = &pctx->psy_coef[j]; + AacPsyCoeffs *coeffs = pctx->psy_coef[j]; + const uint8_t *band_sizes = ctx->bands[j]; float line_to_frequency = ctx->avctx->sample_rate / (j ? 256.f : 2048.0f); i = 0; prev = 0.0; for (g = 0; g < ctx->num_bands[j]; g++) { - i += ctx->bands[j][g]; + i += band_sizes[g]; bark = calc_bark((i-1) * line_to_frequency); - coeffs->barks[g] = (bark + prev) / 2.0; + coeffs[g].barks = (bark + prev) / 2.0; prev = bark; } for (g = 0; g < ctx->num_bands[j] - 1; g++) { - coeffs->spread_low[g] = pow(10.0, -(coeffs->barks[g+1] - coeffs->barks[g]) * PSY_3GPP_SPREAD_LOW); - coeffs->spread_hi [g] = pow(10.0, -(coeffs->barks[g+1] - coeffs->barks[g]) * PSY_3GPP_SPREAD_HI); + AacPsyCoeffs *coeff = &coeffs[g]; + float bark_width = coeffs[g+1].barks - coeffs->barks; + coeff->spread_low[0] = pow(10.0, -bark_width * PSY_3GPP_SPREAD_LOW); + coeff->spread_hi [0] = pow(10.0, -bark_width * PSY_3GPP_SPREAD_HI); } start = 0; for (g = 0; g < ctx->num_bands[j]; g++) { minscale = ath(start * line_to_frequency, ATH_ADD); - for (i = 1; i < ctx->bands[j][g]; i++) + for (i = 1; i < band_sizes[g]; i++) minscale = FFMIN(minscale, ath((start + i) * line_to_frequency, ATH_ADD)); - coeffs->ath[g] = minscale - minath; - start += ctx->bands[j][g]; + coeffs[g].ath = minscale - minath; + start += band_sizes[g]; } } @@ -406,24 +408,32 @@ static void psy_3gpp_analyze(FFPsyContext *ctx, int channel, band->energy += coefs[start+i] * coefs[start+i]; band->thr = band->energy * 0.001258925f; start += band_sizes[g]; - - ctx->psy_bands[channel*PSY_MAX_BANDS+w+g].energy = band->energy; } } //modify thresholds - spread, threshold in quiet - 5.4.3 "Spreaded Energy Calculation" for (w = 0; w < wi->num_windows*16; w += 16) { - AacPsyBand *band = &pch->band[w]; - for (g = 1; g < num_bands; g++) - band[g].thr = FFMAX(band[g].thr, band[g-1].thr * coeffs->spread_hi [g]); - for (g = num_bands - 2; g >= 0; g--) - band[g].thr = FFMAX(band[g].thr, band[g+1].thr * coeffs->spread_low[g]); - for (g = 0; g < num_bands; g++) { - band[g].thr_quiet = band[g].thr = FFMAX(band[g].thr, coeffs->ath[g]); - if (!(wi->window_type[0] == LONG_STOP_SEQUENCE || (wi->window_type[1] == LONG_START_SEQUENCE && !w))) - band[g].thr = FFMAX(PSY_3GPP_RPEMIN*band[g].thr, FFMIN(band[g].thr, - PSY_3GPP_RPELEV*pch->prev_band[w+g].thr_quiet)); - ctx->psy_bands[channel*PSY_MAX_BANDS+w+g].threshold = band[g].thr; + AacPsyBand *bands = &pch->band[w]; + for (g = 1; g < num_bands; g++) + bands[g].thr = FFMAX(bands[g].thr, bands[g-1].thr * coeffs[g].spread_hi[0]); + for (g = num_bands - 2; g >= 0; g--) + bands[g].thr = FFMAX(bands[g].thr, bands[g+1].thr * coeffs[g].spread_low[0]); + for (g = 0; g < num_bands; g++) { + AacPsyBand *band = &bands[g]; + band->thr_quiet = band->thr = FFMAX(band->thr, coeffs[g].ath); + if (!(wi->window_type[0] == LONG_STOP_SEQUENCE || (wi->window_type[1] == LONG_START_SEQUENCE && !w))) + band->thr = FFMAX(PSY_3GPP_RPEMIN*band->thr, FFMIN(band->thr, + PSY_3GPP_RPELEV*pch->prev_band[w+g].thr_quiet)); + } + } + + for (w = 0; w < wi->num_windows*16; w += 16) { + for (g = 0; g < num_bands; g++) { + AacPsyBand *band = &pch->band[w+g]; + FFPsyBand *psy_band = &ctx->psy_bands[channel*PSY_MAX_BANDS+w+g]; + + psy_band->threshold = band->thr; + psy_band->energy = band->energy; } } memcpy(pch->prev_band, pch->band, sizeof(pch->band)); @@ -553,22 +563,9 @@ static FFPsyWindowInfo psy_lame_window(FFPsyContext *ctx, if (pch->prev_attack == 3 || att_sum) { uselongblock = 0; - if (attacks[1] && attacks[0]) - attacks[1] = 0; - if (attacks[2] && attacks[1]) - attacks[2] = 0; - if (attacks[3] && attacks[2]) - attacks[3] = 0; - if (attacks[4] && attacks[3]) - attacks[4] = 0; - if (attacks[5] && attacks[4]) - attacks[5] = 0; - if (attacks[6] && attacks[5]) - attacks[6] = 0; - if (attacks[7] && attacks[6]) - attacks[7] = 0; - if (attacks[8] && attacks[7]) - attacks[8] = 0; + for (i = 1; i < AAC_NUM_BLOCKS_SHORT + 1; i++) + if (attacks[i] && attacks[i-1]) + attacks[i] = 0; } } else { /* We have no lookahead info, so just use same type as the previous sequence. */ From 4afedfd8e5c5f102d3a67c224c33b51bbed47eee Mon Sep 17 00:00:00 2001 From: Nathan Caldwell Date: Wed, 16 Mar 2011 23:35:39 -0400 Subject: [PATCH 28/34] aacenc: cosmetics, indentation, and comment clarification Correct bad indentation in aaccoder Clarify and correct comments in 3GPP psymodel, other cosmetics. --- libavcodec/aaccoder.c | 50 +++++++++++++++++++++---------------------- libavcodec/aacpsy.c | 21 ++++++++++-------- 2 files changed, 37 insertions(+), 34 deletions(-) diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c index d2c928205f..79723c61ef 100644 --- a/libavcodec/aaccoder.c +++ b/libavcodec/aaccoder.c @@ -146,34 +146,34 @@ static av_always_inline float quantize_and_encode_band_cost_template( curidx *= range; curidx += quants[j] + off; } - curbits = ff_aac_spectral_bits[cb-1][curidx]; - vec = &ff_aac_codebook_vectors[cb-1][curidx*dim]; - if (BT_UNSIGNED) { - for (k = 0; k < dim; k++) { - float t = fabsf(in[i+k]); - float di; - if (BT_ESC && vec[k] == 64.0f) { //FIXME: slow - if (t >= CLIPPED_ESCAPE) { - di = t - CLIPPED_ESCAPE; - curbits += 21; - } else { - int c = av_clip(quant(t, Q), 0, 8191); - di = t - c*cbrtf(c)*IQ; - curbits += av_log2(c)*2 - 4 + 1; - } + curbits = ff_aac_spectral_bits[cb-1][curidx]; + vec = &ff_aac_codebook_vectors[cb-1][curidx*dim]; + if (BT_UNSIGNED) { + for (k = 0; k < dim; k++) { + float t = fabsf(in[i+k]); + float di; + if (BT_ESC && vec[k] == 64.0f) { //FIXME: slow + if (t >= CLIPPED_ESCAPE) { + di = t - CLIPPED_ESCAPE; + curbits += 21; } else { - di = t - vec[k]*IQ; + int c = av_clip(quant(t, Q), 0, 8191); + di = t - c*cbrtf(c)*IQ; + curbits += av_log2(c)*2 - 4 + 1; } - if (vec[k] != 0.0f) - curbits++; - rd += di*di; - } - } else { - for (k = 0; k < dim; k++) { - float di = in[i+k] - vec[k]*IQ; - rd += di*di; + } else { + di = t - vec[k]*IQ; } + if (vec[k] != 0.0f) + curbits++; + rd += di*di; } + } else { + for (k = 0; k < dim; k++) { + float di = in[i+k] - vec[k]*IQ; + rd += di*di; + } + } cost += rd * lambda + curbits; resbits += curbits; if (cost >= uplim) @@ -575,7 +575,7 @@ static void search_for_quantizers_anmr(AVCodecContext *avctx, AACEncContext *s, int qnrg = av_clip_uint8(log2f(sqrtf(qnrgf/qcnt))*4 - 31 + SCALE_ONE_POS - SCALE_DIV_512); q1 = qnrg + 30; q0 = qnrg - 30; - //av_log(NULL, AV_LOG_ERROR, "q0 %d, q1 %d\n", q0, q1); + //av_log(NULL, AV_LOG_ERROR, "q0 %d, q1 %d\n", q0, q1); if (q0 < q0low) { q1 += q0low - q0; q0 = q0low; diff --git a/libavcodec/aacpsy.c b/libavcodec/aacpsy.c index de3b0f329e..d9896ed74f 100644 --- a/libavcodec/aacpsy.c +++ b/libavcodec/aacpsy.c @@ -39,8 +39,8 @@ * constants for 3GPP AAC psychoacoustic model * @{ */ -#define PSY_3GPP_SPREAD_HI 1.5f // spreading factor for ascending threshold spreading (15 dB/Bark) -#define PSY_3GPP_SPREAD_LOW 3.0f // spreading factor for descending threshold spreading (30 dB/Bark) +#define PSY_3GPP_THR_SPREAD_HI 1.5f // spreading factor for low-to-hi threshold spreading (15 dB/Bark) +#define PSY_3GPP_THR_SPREAD_LOW 3.0f // spreading factor for hi-to-low threshold spreading (30 dB/Bark) #define PSY_3GPP_RPEMIN 0.01f #define PSY_3GPP_RPELEV 2.0f @@ -256,8 +256,8 @@ static av_cold int psy_3gpp_init(FFPsyContext *ctx) { for (g = 0; g < ctx->num_bands[j] - 1; g++) { AacPsyCoeffs *coeff = &coeffs[g]; float bark_width = coeffs[g+1].barks - coeffs->barks; - coeff->spread_low[0] = pow(10.0, -bark_width * PSY_3GPP_SPREAD_LOW); - coeff->spread_hi [0] = pow(10.0, -bark_width * PSY_3GPP_SPREAD_HI); + coeff->spread_low[0] = pow(10.0, -bark_width * PSY_3GPP_THR_SPREAD_LOW); + coeff->spread_hi [0] = pow(10.0, -bark_width * PSY_3GPP_THR_SPREAD_HI); } start = 0; for (g = 0; g < ctx->num_bands[j]; g++) { @@ -395,9 +395,9 @@ static void psy_3gpp_analyze(FFPsyContext *ctx, int channel, AacPsyChannel *pch = &pctx->ch[channel]; int start = 0; int i, w, g; - const int num_bands = ctx->num_bands[wi->num_windows == 8]; - const uint8_t* band_sizes = ctx->bands[wi->num_windows == 8]; - AacPsyCoeffs *coeffs = &pctx->psy_coef[wi->num_windows == 8]; + const int num_bands = ctx->num_bands[wi->num_windows == 8]; + const uint8_t *band_sizes = ctx->bands[wi->num_windows == 8]; + AacPsyCoeffs *coeffs = &pctx->psy_coef[wi->num_windows == 8]; //calculate energies, initial thresholds and related values - 5.4.2 "Threshold Calculation" for (w = 0; w < wi->num_windows*16; w += 16) { @@ -410,17 +410,19 @@ static void psy_3gpp_analyze(FFPsyContext *ctx, int channel, start += band_sizes[g]; } } - //modify thresholds - spread, threshold in quiet - 5.4.3 "Spreaded Energy Calculation" + //modify thresholds and energies - spread, threshold in quiet, pre-echo control for (w = 0; w < wi->num_windows*16; w += 16) { - AacPsyBand *bands = &pch->band[w]; + //5.4.2.3 "Spreading" & 5.4.3 "Spreaded Energy Calculation" for (g = 1; g < num_bands; g++) bands[g].thr = FFMAX(bands[g].thr, bands[g-1].thr * coeffs[g].spread_hi[0]); for (g = num_bands - 2; g >= 0; g--) bands[g].thr = FFMAX(bands[g].thr, bands[g+1].thr * coeffs[g].spread_low[0]); + //5.4.2.4 "Threshold in quiet" for (g = 0; g < num_bands; g++) { AacPsyBand *band = &bands[g]; band->thr_quiet = band->thr = FFMAX(band->thr, coeffs[g].ath); + //5.4.2.5 "Pre-echo control" if (!(wi->window_type[0] == LONG_STOP_SEQUENCE || (wi->window_type[1] == LONG_START_SEQUENCE && !w))) band->thr = FFMAX(PSY_3GPP_RPEMIN*band->thr, FFMIN(band->thr, PSY_3GPP_RPELEV*pch->prev_band[w+g].thr_quiet)); @@ -436,6 +438,7 @@ static void psy_3gpp_analyze(FFPsyContext *ctx, int channel, psy_band->energy = band->energy; } } + memcpy(pch->prev_band, pch->band, sizeof(pch->band)); } From 79f43a8cb6ff426e706a4cf4f21ad6dd7ebf3467 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Tue, 15 Mar 2011 13:11:57 +0100 Subject: [PATCH 29/34] lavf: enable av_dlog() in compute_pkt_fields2() Turns a comment into an av_dlog() instruction, also add a commented issues. Signed-off-by: Michael Niedermayer (cherry picked from commit 77f21ce4641b53f3277ba30ca3d009b6250fd9ea) Signed-off-by: Reinhard Tartler --- libavformat/utils.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libavformat/utils.c b/libavformat/utils.c index 113728f389..d5372d7233 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -18,6 +18,9 @@ * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ + +/* #define DEBUG */ + #include "avformat.h" #include "avio_internal.h" #include "internal.h" @@ -2910,7 +2913,8 @@ static int compute_pkt_fields2(AVFormatContext *s, AVStream *st, AVPacket *pkt){ int delay = FFMAX(st->codec->has_b_frames, !!st->codec->max_b_frames); int num, den, frame_size, i; -// av_log(s, AV_LOG_DEBUG, "av_write_frame: pts:%"PRId64" dts:%"PRId64" cur_dts:%"PRId64" b:%d size:%d st:%d\n", pkt->pts, pkt->dts, st->cur_dts, delay, pkt->size, pkt->stream_index); + av_dlog(s, "av_write_frame: pts:%"PRId64" dts:%"PRId64" cur_dts:%"PRId64" b:%d size:%d st:%d\n", + pkt->pts, pkt->dts, st->cur_dts, delay, pkt->size, pkt->stream_index); /* if(pkt->pts == AV_NOPTS_VALUE && pkt->dts == AV_NOPTS_VALUE) return -1;*/ From 70abc32314b220cbf4d0a087e52b6ea43bb36b96 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Tue, 15 Mar 2011 13:12:15 +0100 Subject: [PATCH 30/34] lavf: enable av_dlog message in av_interleaved_write_frame() Help debugging timestamp issues. Signed-off-by: Michael Niedermayer (cherry picked from commit d541c8b468c12892fe7b7e655e1ed45e11e2166d) Signed-off-by: Reinhard Tartler --- libavformat/utils.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavformat/utils.c b/libavformat/utils.c index d5372d7233..38ff809246 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -3093,7 +3093,8 @@ int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt){ if(st->codec->codec_type == AVMEDIA_TYPE_AUDIO && pkt->size==0) return 0; -//av_log(NULL, AV_LOG_DEBUG, "av_interleaved_write_frame %d %"PRId64" %"PRId64"\n", pkt->size, pkt->dts, pkt->pts); + av_dlog(s, "av_interleaved_write_frame size:%d dts:%"PRId64" pts:%"PRId64"\n", + pkt->size, pkt->dts, pkt->pts); if(compute_pkt_fields2(s, st, pkt) < 0 && !(s->oformat->flags & AVFMT_NOTIMESTAMPS)) return -1; From 68d875addcffe6941e0f75202e3972e37371180f Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Tue, 15 Mar 2011 13:03:03 +0100 Subject: [PATCH 31/34] lavf: make av_interleave_packet() return meaningful error codes Signed-off-by: Michael Niedermayer (cherry picked from commit c5dcb3d493a6bb73efeb8bfae24f5cc31908201f) Signed-off-by: Reinhard Tartler --- libavformat/utils.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libavformat/utils.c b/libavformat/utils.c index 38ff809246..ad00ce83e7 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -3088,6 +3088,7 @@ static int av_interleave_packet(AVFormatContext *s, AVPacket *out, AVPacket *in, int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt){ AVStream *st= s->streams[ pkt->stream_index]; + int ret; //FIXME/XXX/HACK drop zero sized packets if(st->codec->codec_type == AVMEDIA_TYPE_AUDIO && pkt->size==0) @@ -3095,11 +3096,11 @@ int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt){ av_dlog(s, "av_interleaved_write_frame size:%d dts:%"PRId64" pts:%"PRId64"\n", pkt->size, pkt->dts, pkt->pts); - if(compute_pkt_fields2(s, st, pkt) < 0 && !(s->oformat->flags & AVFMT_NOTIMESTAMPS)) - return -1; + if((ret = compute_pkt_fields2(s, st, pkt)) < 0 && !(s->oformat->flags & AVFMT_NOTIMESTAMPS)) + return ret; if(pkt->dts == AV_NOPTS_VALUE && !(s->oformat->flags & AVFMT_NOTIMESTAMPS)) - return -1; + return AVERROR(EINVAL); for(;;){ AVPacket opkt; From bc040cb3e2eac2882b4af01de3b769620634b2aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Thu, 17 Mar 2011 10:24:08 +0000 Subject: [PATCH 32/34] applehttp: Fix a typo in a comment Signed-off-by: Mans Rullgard --- libavformat/applehttp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/applehttp.c b/libavformat/applehttp.c index 7a3d8b0b10..d2c2c29e17 100644 --- a/libavformat/applehttp.c +++ b/libavformat/applehttp.c @@ -519,7 +519,7 @@ reload: c->max_start_seq - c->cur_seq_no); c->cur_seq_no = c->max_start_seq; } - /* If more segments exit, open the next one */ + /* If more segments exist, open the next one */ if (c->cur_seq_no < c->min_end_seq) goto start; /* We've reached the end of the playlists - return eof if this is a From dc6fdad5dcbf4e796543929ccbce0de1f8535efd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Thu, 17 Mar 2011 12:23:52 +0200 Subject: [PATCH 33/34] Add missed APIchanges and changelog entries Add an APIchanges entry for the av_pkt_dump2 and av_pkt_dump_log2 functions, and a changelog entry for the apple http live streaming protocol handler. Since neither of them got a minor bump at commit time, but were applied before the jv demuxer, they all can be considered added in this minor version. Signed-off-by: Luca Barbato --- Changelog | 1 + doc/APIchanges | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/Changelog b/Changelog index 95c8b657fb..4a7fd6f67b 100644 --- a/Changelog +++ b/Changelog @@ -78,6 +78,7 @@ version : - movie source added - Bink version 'b' audio and video decoder - Bitmap Brothers JV playback system +- Apple HTTP Live Streaming protocol handler version 0.6: diff --git a/doc/APIchanges b/doc/APIchanges index 3a8543edf3..f9ae6c1a7f 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -12,6 +12,11 @@ libavutil: 2009-03-08 API changes, most recent first: +2011-03-02 - 863c471 - lavf 52.103.0 - av_pkt_dump2, av_pkt_dump_log2 + Add new functions av_pkt_dump2, av_pkt_dump_log2 that uses the + source stream timebase for outputting timestamps. Deprecate + av_pkt_dump and av_pkt_dump_log. + 2011-02-20 - e731b8d - lavf 52.102.0 - avio.h * e731b8d - rename init_put_byte() to ffio_init_context(), deprecating the original, and move it to a private header so it is no longer From f1f60f5252b0b448adcce0c1c52f3161ee69b9bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Thu, 17 Mar 2011 12:24:23 +0200 Subject: [PATCH 34/34] lavf: Make make_absolute_url a lavf internal function This is shared by both applehttp demuxer and protocol. Signed-off-by: Luca Barbato --- libavformat/applehttp.c | 55 ++---------------------------------- libavformat/applehttpproto.c | 55 ++---------------------------------- libavformat/internal.h | 11 ++++++++ libavformat/utils.c | 51 +++++++++++++++++++++++++++++++++ 4 files changed, 66 insertions(+), 106 deletions(-) diff --git a/libavformat/applehttp.c b/libavformat/applehttp.c index d2c2c29e17..d6f7db36e1 100644 --- a/libavformat/applehttp.c +++ b/libavformat/applehttp.c @@ -86,57 +86,6 @@ static int read_chomp_line(AVIOContext *s, char *buf, int maxlen) return len; } -static void make_absolute_url(char *buf, int size, const char *base, - const char *rel) -{ - char *sep; - /* Absolute path, relative to the current server */ - if (base && strstr(base, "://") && rel[0] == '/') { - if (base != buf) - av_strlcpy(buf, base, size); - sep = strstr(buf, "://"); - if (sep) { - sep += 3; - sep = strchr(sep, '/'); - if (sep) - *sep = '\0'; - } - av_strlcat(buf, rel, size); - return; - } - /* If rel actually is an absolute url, just copy it */ - if (!base || strstr(rel, "://") || rel[0] == '/') { - av_strlcpy(buf, rel, size); - return; - } - if (base != buf) - av_strlcpy(buf, base, size); - /* Remove the file name from the base url */ - sep = strrchr(buf, '/'); - if (sep) - sep[1] = '\0'; - else - buf[0] = '\0'; - while (av_strstart(rel, "../", NULL) && sep) { - /* Remove the path delimiter at the end */ - sep[0] = '\0'; - sep = strrchr(buf, '/'); - /* If the next directory name to pop off is "..", break here */ - if (!strcmp(sep ? &sep[1] : buf, "..")) { - /* Readd the slash we just removed */ - av_strlcat(buf, "/", size); - break; - } - /* Cut off the directory name */ - if (sep) - sep[1] = '\0'; - else - buf[0] = '\0'; - rel += 3; - } - av_strlcat(buf, rel, size); -} - static void free_segment_list(struct variant *var) { int i; @@ -183,7 +132,7 @@ static struct variant *new_variant(AppleHTTPContext *c, int bandwidth, return NULL; reset_packet(&var->pkt); var->bandwidth = bandwidth; - make_absolute_url(var->url, sizeof(var->url), base, url); + ff_make_absolute_url(var->url, sizeof(var->url), base, url); dynarray_add(&c->variants, &c->n_variants, var); return var; } @@ -274,7 +223,7 @@ static int parse_playlist(AppleHTTPContext *c, const char *url, goto fail; } seg->duration = duration; - make_absolute_url(seg->url, sizeof(seg->url), url, line); + ff_make_absolute_url(seg->url, sizeof(seg->url), url, line); dynarray_add(&var->segments, &var->n_segments, seg); is_segment = 0; } diff --git a/libavformat/applehttpproto.c b/libavformat/applehttpproto.c index 871f2712df..c287c6c614 100644 --- a/libavformat/applehttpproto.c +++ b/libavformat/applehttpproto.c @@ -75,57 +75,6 @@ static int read_chomp_line(AVIOContext *s, char *buf, int maxlen) return len; } -static void make_absolute_url(char *buf, int size, const char *base, - const char *rel) -{ - char *sep; - /* Absolute path, relative to the current server */ - if (base && strstr(base, "://") && rel[0] == '/') { - if (base != buf) - av_strlcpy(buf, base, size); - sep = strstr(buf, "://"); - if (sep) { - sep += 3; - sep = strchr(sep, '/'); - if (sep) - *sep = '\0'; - } - av_strlcat(buf, rel, size); - return; - } - /* If rel actually is an absolute url, just copy it */ - if (!base || strstr(rel, "://") || rel[0] == '/') { - av_strlcpy(buf, rel, size); - return; - } - if (base != buf) - av_strlcpy(buf, base, size); - /* Remove the file name from the base url */ - sep = strrchr(buf, '/'); - if (sep) - sep[1] = '\0'; - else - buf[0] = '\0'; - while (av_strstart(rel, "../", NULL) && sep) { - /* Remove the path delimiter at the end */ - sep[0] = '\0'; - sep = strrchr(buf, '/'); - /* If the next directory name to pop off is "..", break here */ - if (!strcmp(sep ? &sep[1] : buf, "..")) { - /* Readd the slash we just removed */ - av_strlcat(buf, "/", size); - break; - } - /* Cut off the directory name */ - if (sep) - sep[1] = '\0'; - else - buf[0] = '\0'; - rel += 3; - } - av_strlcat(buf, rel, size); -} - static void free_segment_list(AppleHTTPContext *s) { int i; @@ -201,7 +150,7 @@ static int parse_playlist(URLContext *h, const char *url) goto fail; } seg->duration = duration; - make_absolute_url(seg->url, sizeof(seg->url), url, line); + ff_make_absolute_url(seg->url, sizeof(seg->url), url, line); dynarray_add(&s->segments, &s->n_segments, seg); is_segment = 0; } else if (is_variant) { @@ -211,7 +160,7 @@ static int parse_playlist(URLContext *h, const char *url) goto fail; } var->bandwidth = bandwidth; - make_absolute_url(var->url, sizeof(var->url), url, line); + ff_make_absolute_url(var->url, sizeof(var->url), url, line); dynarray_add(&s->variants, &s->n_variants, var); is_variant = 0; } diff --git a/libavformat/internal.h b/libavformat/internal.h index 02a27e4724..d5bfc33187 100644 --- a/libavformat/internal.h +++ b/libavformat/internal.h @@ -239,4 +239,15 @@ AVChapter *ff_new_chapter(AVFormatContext *s, int id, AVRational time_base, */ void ff_reduce_index(AVFormatContext *s, int stream_index); +/* + * Convert a relative url into an absolute url, given a base url. + * + * @param buf the buffer where output absolute url is written + * @param size the size of buf + * @param base the base url, may be equal to buf. + * @param rel the new url, which is interpreted relative to base + */ +void ff_make_absolute_url(char *buf, int size, const char *base, + const char *rel); + #endif /* AVFORMAT_INTERNAL_H */ diff --git a/libavformat/utils.c b/libavformat/utils.c index ad00ce83e7..d6a17009db 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -3814,3 +3814,54 @@ int ff_find_stream_index(AVFormatContext *s, int id) } return -1; } + +void ff_make_absolute_url(char *buf, int size, const char *base, + const char *rel) +{ + char *sep; + /* Absolute path, relative to the current server */ + if (base && strstr(base, "://") && rel[0] == '/') { + if (base != buf) + av_strlcpy(buf, base, size); + sep = strstr(buf, "://"); + if (sep) { + sep += 3; + sep = strchr(sep, '/'); + if (sep) + *sep = '\0'; + } + av_strlcat(buf, rel, size); + return; + } + /* If rel actually is an absolute url, just copy it */ + if (!base || strstr(rel, "://") || rel[0] == '/') { + av_strlcpy(buf, rel, size); + return; + } + if (base != buf) + av_strlcpy(buf, base, size); + /* Remove the file name from the base url */ + sep = strrchr(buf, '/'); + if (sep) + sep[1] = '\0'; + else + buf[0] = '\0'; + while (av_strstart(rel, "../", NULL) && sep) { + /* Remove the path delimiter at the end */ + sep[0] = '\0'; + sep = strrchr(buf, '/'); + /* If the next directory name to pop off is "..", break here */ + if (!strcmp(sep ? &sep[1] : buf, "..")) { + /* Readd the slash we just removed */ + av_strlcat(buf, "/", size); + break; + } + /* Cut off the directory name */ + if (sep) + sep[1] = '\0'; + else + buf[0] = '\0'; + rel += 3; + } + av_strlcat(buf, rel, size); +}