From 81a131312d0b56808e3f794cfd5d54ca6e13156f Mon Sep 17 00:00:00 2001 From: Jason Garrett-Glaser Date: Sat, 12 Mar 2011 15:30:18 -0800 Subject: [PATCH 01/18] VP8: fix other function declaration Was missed in 3efbe137. --- libavcodec/vp8.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c index 42f401d2b1..c067f4cf2f 100644 --- a/libavcodec/vp8.c +++ b/libavcodec/vp8.c @@ -695,7 +695,7 @@ skip_eob: static av_always_inline int decode_block_coeffs(VP56RangeCoder *c, DCTELEM block[16], - uint8_t probs[8][3][NUM_DCT_TOKENS-1], + uint8_t probs[16][3][NUM_DCT_TOKENS-1], int i, int zero_nhood, int16_t qmul[2]) { uint8_t *token_prob = probs[i][zero_nhood]; From 0e6a3ee4fa317f674a3e895188620aa5839cc414 Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Wed, 9 Mar 2011 10:11:53 +0100 Subject: [PATCH 02/18] doc: document applehttp protocol The documentation might be extended once/if a live/store override option will have to be provided for non-compliant segmenter. --- doc/protocols.texi | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/doc/protocols.texi b/doc/protocols.texi index 29f5c90d81..5655b10180 100644 --- a/doc/protocols.texi +++ b/doc/protocols.texi @@ -19,6 +19,22 @@ supported protocols. A description of the currently available protocols follows. +@section applehttp + +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. + +@example +applehttp://host/path/to/remote/resource.m3u8 +applehttp+http://host/path/to/remote/resource.m3u8 +applehttp+file://path/to/local/resource.m3u8 +@end example + + @section concat Physical concatenation protocol. From 21de920472cc3d338312957bfd03dcac278b5ae3 Mon Sep 17 00:00:00 2001 From: Johan Andersson Date: Sun, 13 Mar 2011 23:29:19 +0100 Subject: [PATCH 03/18] Update the url to the site website and change ffmpeg-devel to libav-devel Signed-off-by: Ronald S. Bultje --- doc/developer.texi | 22 +++++++++++----------- doc/faq.texi | 8 ++++---- doc/ffserver.conf | 2 +- doc/git-howto.txt | 8 ++++---- doc/libavfilter.texi | 2 +- doc/optimization.txt | 4 ++-- libavcodec/dsputil.h | 2 +- libavcodec/mlpdec.c | 2 +- libavcodec/utils.c | 4 ++-- 9 files changed, 27 insertions(+), 27 deletions(-) diff --git a/doc/developer.texi b/doc/developer.texi index acffbe67e2..96ab9f7a4b 100644 --- a/doc/developer.texi +++ b/doc/developer.texi @@ -151,7 +151,7 @@ should also be avoided if they don't make the code easier to understand. ask/discuss it on the developer mailing list. @item Do not change behavior of the programs (renaming options etc) or public - API or ABI without first discussing it on the ffmpeg-devel mailing list. + API or ABI without first discussing it on the libav-devel mailing list. Do not remove functionality from the code. Just improve! Note: Redundant code can be removed. @@ -160,7 +160,7 @@ should also be avoided if they don't make the code easier to understand. which change behavior, defaults etc, without asking first. The same applies to compiler warning fixes, trivial looking fixes and to code maintained by other developers. We usually have a reason for doing things - the way we do. Send your changes as patches to the ffmpeg-devel mailing + the way we do. Send your changes as patches to the libav-devel mailing list, and if the code maintainers say OK, you may commit. This does not apply to files you wrote and/or maintain. @item @@ -182,27 +182,27 @@ should also be avoided if they don't make the code easier to understand. particular bug. Comments such as "fixed!" or "Changed it." are unacceptable. @item If you apply a patch by someone else, include the name and email address in - the log message. Since the ffmpeg-cvslog mailing list is publicly + the log message. Since the libav-commits mailing list is publicly archived you should add some SPAM protection to the email address. Send an - answer to ffmpeg-devel (or wherever you got the patch from) saying that + answer to libav-devel (or wherever you got the patch from) saying that you applied the patch. @item When applying patches that have been discussed (at length) on the mailing list, reference the thread in the log message. @item Do NOT commit to code actively maintained by others without permission. - Send a patch to ffmpeg-devel instead. If no one answers within a reasonable + Send a patch to libav-devel instead. If no one answers within a reasonable timeframe (12h for build failures and security fixes, 3 days small changes, 1 week for big patches) then commit your patch if you think it is OK. Also note, the maintainer can simply ask for more time to review! @item - Subscribe to the ffmpeg-cvslog mailing list. The diffs of all commits + Subscribe to the libav-commits mailing list. The diffs of all commits are sent there and reviewed by all the other developers. Bugs and possible improvements or general questions regarding commits are discussed there. We expect you to react if problems with your code are uncovered. @item Update the documentation if you change behavior or add features. If you are - unsure how best to do this, send a patch to ffmpeg-devel, the documentation + unsure how best to do this, send a patch to libav-devel, the documentation maintainer(s) will review and commit your stuff. @item Try to keep important discussions and requests (also) on the public @@ -261,8 +261,8 @@ verify that there are no big problems. Patches should be posted as base64 encoded attachments (or any other encoding which ensures that the patch will not be trashed during -transmission) to the ffmpeg-devel mailing list, see -@url{http://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-devel} +transmission) to the libav-devel mailing list, see +@url{https://lists.libav.org/mailman/listinfo/libav-devel} It also helps quite a bit if you tell us what the patch does (for example 'replaces lrint by lrintf'), and why (for example '*BSD isn't C99 compliant @@ -361,7 +361,7 @@ send a reminder by email. Your patch should eventually be dealt with. If the patch fixes a bug, did you provide enough information, including a sample, so the bug can be reproduced and the fix can be verified? Note please do not attach samples >100k to mails but rather provide a - URL, you can upload to ftp://upload.ffmpeg.org + URL, you can upload to ftp://upload.libav.org @item Did you provide a verbose summary about what the patch does change? @item @@ -387,7 +387,7 @@ send a reminder by email. Your patch should eventually be dealt with. @section Patch review process -All patches posted to ffmpeg-devel will be reviewed, unless they contain a +All patches posted to libav-devel will be reviewed, unless they contain a clear note that the patch is not for the git master branch. Reviews and comments will be posted as replies to the patch on the mailing list. The patch submitter then has to take care of every comment, diff --git a/doc/faq.texi b/doc/faq.texi index b8a13b79eb..e92c0e5f26 100644 --- a/doc/faq.texi +++ b/doc/faq.texi @@ -25,7 +25,7 @@ Nowhere. We do not support old FFmpeg 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 still experience the problem, then you can report it according to the -guidelines in @url{http://ffmpeg.org/bugreports.html}. +guidelines in @url{http://libav.org/bugreports.html}. @section Why doesn't FFmpeg support feature [xyz]? @@ -40,13 +40,13 @@ No. Windows DLLs are not portable, bloated and often slow. Moreover FFmpeg strives to support all codecs natively. A DLL loader is not conducive to that goal. -@section My bug report/mail to ffmpeg-devel/user has not received any replies. +@section My bug report/mail to libav-devel/user has not received any replies. Likely reasons @itemize @item We are busy and haven't had time yet to read your report or investigate the issue. -@item You didn't follow @url{http://ffmpeg.org/bugreports.html}. +@item You didn't follow @url{http://libav.org/bugreports.html}. @item You didn't use Subversion HEAD. @item You reported a segmentation fault without gdb output. @item You describe a problem but not how to reproduce it. @@ -124,7 +124,7 @@ problem and an NP-hard problem... @section ffmpeg does not work; what is wrong? Try a @code{make distclean} in the ffmpeg source directory before the build. If this does not help see -(@url{http://ffmpeg.org/bugreports.html}). +(@url{http://libav.org/bugreports.html}). @section How do I encode single pictures into movies? diff --git a/doc/ffserver.conf b/doc/ffserver.conf index 217117005c..62728b036c 100644 --- a/doc/ffserver.conf +++ b/doc/ffserver.conf @@ -371,7 +371,7 @@ ACL allow 192.168.0.0 192.168.255.255 # Redirect index.html to the appropriate site -URL http://www.ffmpeg.org/ +URL http://www.libav.org/ diff --git a/doc/git-howto.txt b/doc/git-howto.txt index 519c8970ef..c6cbc2b668 100644 --- a/doc/git-howto.txt +++ b/doc/git-howto.txt @@ -44,11 +44,11 @@ I. BASICS: 1. Cloning the source tree: - git clone git://git.ffmpeg.org/ffmpeg.git + git clone git://git.libav.org/libav.git This will put the FFmpeg sources into the directory . - git clone git@git.ffmpeg.org:ffmpeg.git + git clone git@git.libav.org:libav.git This will put the FFmpeg sources into the directory and let you push back your changes to the remote repository. @@ -97,7 +97,7 @@ I. BASICS: git log You may also use the graphical tools like gitview or gitk or the web - interface available at http://git.ffmpeg.org/ + interface available at http://git.libav.org/ 6. Checking source tree status: @@ -255,5 +255,5 @@ I. BASICS: where $SHA1 is the commit SHA1 from the 'git log' output. -Contact the project admins if you have technical +Contact the project admins if you have technical problems with the GIT server. diff --git a/doc/libavfilter.texi b/doc/libavfilter.texi index f0b448259a..f7cf74717b 100644 --- a/doc/libavfilter.texi +++ b/doc/libavfilter.texi @@ -20,7 +20,7 @@ libavfilter then check it out from the libavfilter repository into some directory of your choice by: @example - svn checkout svn://svn.ffmpeg.org/soc/libavfilter + svn checkout svn://svn.libav.org/soc/libavfilter @end example And then read the README file in the top directory to learn how to diff --git a/doc/optimization.txt b/doc/optimization.txt index 08954f9973..53cd21d22d 100644 --- a/doc/optimization.txt +++ b/doc/optimization.txt @@ -18,14 +18,14 @@ 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 -branches are listed at http://ffmpeg.org/download.html). +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 comprehend the instructions, it could help understanding the functions and how they can be optimized. NOTE: If you still don't understand some function, ask at our mailing list!!! -(http://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-devel) +(https://lists.libav.org/mailman/listinfo/libav-devel) When is an optimization justified? diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h index 3e55d1338d..b4798b3de8 100644 --- a/libavcodec/dsputil.h +++ b/libavcodec/dsputil.h @@ -122,7 +122,7 @@ void ff_gmc_c(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int oy, /* minimum alignment rules ;) If you notice errors in the align stuff, need more alignment for some ASM code for some CPU or need to use a function with less aligned data then send a mail -to the ffmpeg-devel mailing list, ... +to the libav-devel mailing list, ... !warning These alignments might not match reality, (missing attribute((align)) stuff somewhere possible). diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c index a655b3d4a9..9f6863afc2 100644 --- a/libavcodec/mlpdec.c +++ b/libavcodec/mlpdec.c @@ -41,7 +41,7 @@ static const char* sample_message = "Please file a bug report following the instructions at " - "http://ffmpeg.org/bugreports.html and include " + "http://libav.org/bugreports.html and include " "a sample of this file."; typedef struct SubStream { diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 03fa7baeb5..18631ff164 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -1204,8 +1204,8 @@ void av_log_ask_for_sample(void *avc, const char *msg) if (msg) av_log(avc, AV_LOG_WARNING, "%s ", msg); av_log(avc, AV_LOG_WARNING, "If you want to help, upload a sample " - "of this file to ftp://upload.ffmpeg.org/MPlayer/incoming/ " - "and contact the ffmpeg-devel mailing list.\n"); + "of this file to ftp://upload.libav.org/MPlayer/incoming/ " + "and contact the libav-devel mailing list.\n"); } static AVHWAccel *first_hwaccel = NULL; From 0697440c1ef55e6def219cdf0e22682b0b71f089 Mon Sep 17 00:00:00 2001 From: Peter Ross Date: Thu, 10 Mar 2011 23:23:25 +1100 Subject: [PATCH 04/18] Bitmap Brothers JV video decoder Signed-off-by: Ronald S. Bultje --- libavcodec/Makefile | 1 + libavcodec/allcodecs.c | 1 + libavcodec/avcodec.h | 5 +- libavcodec/jvdec.c | 215 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 220 insertions(+), 2 deletions(-) create mode 100644 libavcodec/jvdec.c diff --git a/libavcodec/Makefile b/libavcodec/Makefile index e116a7d01c..21bdbf42d1 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -184,6 +184,7 @@ OBJS-$(CONFIG_INTERPLAY_VIDEO_DECODER) += interplayvideo.o OBJS-$(CONFIG_JPEGLS_DECODER) += jpeglsdec.o jpegls.o \ mjpegdec.o mjpeg.o OBJS-$(CONFIG_JPEGLS_ENCODER) += jpeglsenc.o jpegls.o +OBJS-$(CONFIG_JV_DECODER) += jvdec.o OBJS-$(CONFIG_KGV1_DECODER) += kgv1dec.o OBJS-$(CONFIG_KMVC_DECODER) += kmvc.o OBJS-$(CONFIG_LAGARITH_DECODER) += lagarith.o lagarithrac.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index 108a3ab7c8..2ed49a2727 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -126,6 +126,7 @@ void avcodec_register_all(void) REGISTER_DECODER (INDEO5, indeo5); REGISTER_DECODER (INTERPLAY_VIDEO, interplay_video); REGISTER_ENCDEC (JPEGLS, jpegls); + REGISTER_DECODER (JV, jv); REGISTER_DECODER (KGV1, kgv1); REGISTER_DECODER (KMVC, kmvc); REGISTER_DECODER (LAGARITH, lagarith); diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 12cca6ff97..6491e07452 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -32,8 +32,8 @@ #include "libavutil/cpu.h" #define LIBAVCODEC_VERSION_MAJOR 52 -#define LIBAVCODEC_VERSION_MINOR 113 -#define LIBAVCODEC_VERSION_MICRO 2 +#define LIBAVCODEC_VERSION_MINOR 114 +#define LIBAVCODEC_VERSION_MICRO 0 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \ @@ -261,6 +261,7 @@ enum CodecID { CODEC_ID_MXPEG, CODEC_ID_LAGARITH, CODEC_ID_PRORES, + CODEC_ID_JV, /* various PCM "codecs" */ CODEC_ID_PCM_S16LE= 0x10000, diff --git a/libavcodec/jvdec.c b/libavcodec/jvdec.c new file mode 100644 index 0000000000..61faef6a54 --- /dev/null +++ b/libavcodec/jvdec.c @@ -0,0 +1,215 @@ +/* + * Bitmap Brothers JV video decoder + * Copyright (c) 2011 Peter Ross + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * Bitmap Brothers JV video decoder + * @author Peter Ross + */ + +#include "avcodec.h" +#include "dsputil.h" +#include "get_bits.h" +#include "libavutil/intreadwrite.h" + +typedef struct JvContext { + DSPContext dsp; + AVFrame frame; + uint32_t palette[AVPALETTE_COUNT]; + int palette_has_changed; +} JvContext; + +static av_cold int decode_init(AVCodecContext *avctx) +{ + JvContext *s = avctx->priv_data; + avctx->pix_fmt = PIX_FMT_PAL8; + dsputil_init(&s->dsp, avctx); + return 0; +} + +/** + * Decode 2x2 block + */ +static inline void decode2x2(GetBitContext *gb, uint8_t *dst, int linesize) +{ + int i, j, v[2]; + + switch (get_bits(gb, 2)) { + case 1: + v[0] = get_bits(gb, 8); + for (j = 0; j < 2; j++) + memset(dst + j*linesize, v[0], 2); + break; + case 2: + v[0] = get_bits(gb, 8); + v[1] = get_bits(gb, 8); + for (j = 0; j < 2; j++) + for (i = 0; i < 2; i++) + dst[j*linesize + i] = v[get_bits1(gb)]; + break; + case 3: + for (j = 0; j < 2; j++) + for (i = 0; i < 2; i++) + dst[j*linesize + i] = get_bits(gb, 8); + } +} + +/** + * Decode 4x4 block + */ +static inline void decode4x4(GetBitContext *gb, uint8_t *dst, int linesize) +{ + int i, j, v[2]; + + switch (get_bits(gb, 2)) { + case 1: + v[0] = get_bits(gb, 8); + for (j = 0; j < 4; j++) + memset(dst + j*linesize, v[0], 4); + break; + case 2: + v[0] = get_bits(gb, 8); + v[1] = get_bits(gb, 8); + for (j = 2; j >= 0; j -= 2) { + for (i = 0; i < 4; i++) + dst[j*linesize + i] = v[get_bits1(gb)]; + for (i = 0; i < 4; i++) + dst[(j+1)*linesize + i] = v[get_bits1(gb)]; + } + break; + case 3: + for (j = 0; j < 4; j += 2) + for (i = 0; i < 4; i += 2) + decode2x2(gb, dst + j*linesize + i, linesize); + } +} + +/** + * Decode 8x8 block + */ +static inline void decode8x8(GetBitContext *gb, uint8_t *dst, int linesize, DSPContext *dsp) +{ + int i, j, v[2]; + + switch (get_bits(gb, 2)) { + case 1: + v[0] = get_bits(gb, 8); + dsp->fill_block_tab[1](dst, v[0], linesize, 8); + break; + case 2: + v[0] = get_bits(gb, 8); + v[1] = get_bits(gb, 8); + for (j = 7; j >= 0; j--) + for (i = 0; i < 8; i++) + dst[j*linesize + i] = v[get_bits1(gb)]; + break; + case 3: + for (j = 0; j < 8; j += 4) + for (i = 0; i < 8; i += 4) + decode4x4(gb, dst + j*linesize + i, linesize); + } +} + +static int decode_frame(AVCodecContext *avctx, + void *data, int *data_size, + AVPacket *avpkt) +{ + JvContext *s = avctx->priv_data; + int buf_size = avpkt->size; + const uint8_t *buf = avpkt->data; + const uint8_t *buf_end = buf + buf_size; + int video_size, video_type, i, j; + + video_size = AV_RL32(buf); + video_type = buf[4]; + buf += 5; + + if (video_size) { + if (avctx->reget_buffer(avctx, &s->frame) < 0) { + av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + return -1; + } + + if (video_type == 0 || video_type == 1) { + GetBitContext gb; + init_get_bits(&gb, buf, FFMIN(video_size, buf_end - buf)); + + for (j = 0; j < avctx->height; j += 8) + for (i = 0; i < avctx->width; i += 8) + decode8x8(&gb, s->frame.data[0] + j*s->frame.linesize[0] + i, + s->frame.linesize[0], &s->dsp); + + buf += video_size; + } else if (video_type == 2) { + if (buf + 1 <= buf_end) { + int v = *buf++; + for (j = 0; j < avctx->height; j++) + memset(s->frame.data[0] + j*s->frame.linesize[0], v, avctx->width); + } + } else { + av_log(avctx, AV_LOG_WARNING, "unsupported frame type %i\n", video_type); + return AVERROR_INVALIDDATA; + } + } + + if (buf < buf_end) { + for (i = 0; i < AVPALETTE_COUNT && buf + 3 <= buf_end; i++) { + s->palette[i] = AV_RB24(buf) << 2; + buf += 3; + } + s->palette_has_changed = 1; + } + + if (video_size) { + s->frame.key_frame = 1; + s->frame.pict_type = FF_I_TYPE; + s->frame.palette_has_changed = s->palette_has_changed; + s->palette_has_changed = 0; + memcpy(s->frame.data[1], s->palette, AVPALETTE_SIZE); + + *data_size = sizeof(AVFrame); + *(AVFrame*)data = s->frame; + } + + return buf_size; +} + +static av_cold int decode_close(AVCodecContext *avctx) +{ + JvContext *s = avctx->priv_data; + + if(s->frame.data[0]) + avctx->release_buffer(avctx, &s->frame); + + return 0; +} + +AVCodec ff_jv_decoder = { + .name = "jv", + .long_name = NULL_IF_CONFIG_SMALL("Bitmap Brothers JV video"), + .type = CODEC_TYPE_VIDEO, + .id = CODEC_ID_JV, + .priv_data_size = sizeof(JvContext), + .init = decode_init, + .close = decode_close, + .decode = decode_frame, + .capabilities = CODEC_CAP_DR1, +}; From bfaefd87dc5c46a4d422cebcff7a9a6dbaad046f Mon Sep 17 00:00:00 2001 From: Peter Ross Date: Thu, 10 Mar 2011 23:29:22 +1100 Subject: [PATCH 05/18] Bitmap Brothers JV demuxer Signed-off-by: Ronald S. Bultje --- libavformat/Makefile | 1 + libavformat/allformats.c | 1 + libavformat/jvdec.c | 221 +++++++++++++++++++++++++++++++++++++++ libavformat/version.h | 2 +- 4 files changed, 224 insertions(+), 1 deletion(-) create mode 100644 libavformat/jvdec.c diff --git a/libavformat/Makefile b/libavformat/Makefile index eb9ca49e4d..4eb1620700 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -110,6 +110,7 @@ OBJS-$(CONFIG_ISS_DEMUXER) += iss.o OBJS-$(CONFIG_IV8_DEMUXER) += iv8.o OBJS-$(CONFIG_IVF_DEMUXER) += ivfdec.o riff.o OBJS-$(CONFIG_IVF_MUXER) += ivfenc.o +OBJS-$(CONFIG_JV_DEMUXER) += jvdec.o OBJS-$(CONFIG_LMLM4_DEMUXER) += lmlm4.o OBJS-$(CONFIG_LXF_DEMUXER) += lxfdec.o OBJS-$(CONFIG_M4V_DEMUXER) += m4vdec.o rawdec.o diff --git a/libavformat/allformats.c b/libavformat/allformats.c index 562f6248a5..bca968ab88 100644 --- a/libavformat/allformats.c +++ b/libavformat/allformats.c @@ -110,6 +110,7 @@ void av_register_all(void) REGISTER_DEMUXER (ISS, iss); REGISTER_DEMUXER (IV8, iv8); REGISTER_MUXDEMUX (IVF, ivf); + REGISTER_DEMUXER (JV, jv); REGISTER_DEMUXER (LMLM4, lmlm4); REGISTER_DEMUXER (LXF, lxf); REGISTER_MUXDEMUX (M4V, m4v); diff --git a/libavformat/jvdec.c b/libavformat/jvdec.c new file mode 100644 index 0000000000..90b689948f --- /dev/null +++ b/libavformat/jvdec.c @@ -0,0 +1,221 @@ +/* + * Bitmap Brothers JV demuxer + * Copyright (c) 2005, 2011 Peter Ross + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * Bitmap Brothers JV demuxer + * @author Peter Ross + */ + +#include "libavutil/intreadwrite.h" +#include "avformat.h" + +typedef struct { + int audio_size; /** audio packet size (bytes) */ + int video_size; /** video packet size (bytes) */ + int palette; /** frame contains palette change */ + int video_type; /** per-frame video compression type */ +} JVFrame; + +typedef struct { + JVFrame *frames; + enum { + JV_AUDIO = 0, + JV_VIDEO, + JV_PADDING + } state; + int64_t pts; +} JVDemuxContext; + +#define MAGIC " Compression by John M Phillips Copyright (C) 1995 The Bitmap Brothers Ltd." + +static int read_probe(AVProbeData *pd) +{ + if (pd->buf[0] == 'J' && pd->buf[1] == 'V' && + !memcmp(pd->buf + 4, MAGIC, FFMIN(strlen(MAGIC), pd->buf_size - 4))) + return AVPROBE_SCORE_MAX; + return 0; +} + +static int read_header(AVFormatContext *s, + AVFormatParameters *ap) +{ + JVDemuxContext *jv = s->priv_data; + AVIOContext *pb = s->pb; + AVStream *vst, *ast; + int64_t audio_pts = 0; + int64_t offset; + int i; + + avio_skip(pb, 80); + + ast = av_new_stream(s, 0); + vst = av_new_stream(s, 1); + if (!ast || !vst) + return AVERROR(ENOMEM); + + vst->codec->codec_type = CODEC_TYPE_VIDEO; + vst->codec->codec_id = CODEC_ID_JV; + vst->codec->codec_tag = 0; /* no fourcc */ + vst->codec->width = avio_rl16(pb); + vst->codec->height = avio_rl16(pb); + vst->nb_frames = + ast->nb_index_entries = avio_rl16(pb); + av_set_pts_info(vst, 64, avio_rl16(pb), 1000); + + avio_skip(pb, 4); + + ast->codec->codec_type = CODEC_TYPE_AUDIO; + ast->codec->codec_id = CODEC_ID_PCM_U8; + ast->codec->codec_tag = 0; /* no fourcc */ + ast->codec->sample_rate = avio_rl16(pb); + ast->codec->channels = 1; + av_set_pts_info(ast, 64, 1, ast->codec->sample_rate); + + avio_skip(pb, 10); + + ast->index_entries = av_malloc(ast->nb_index_entries * sizeof(*ast->index_entries)); + if (!ast->index_entries) + return AVERROR(ENOMEM); + + jv->frames = av_malloc(ast->nb_index_entries * sizeof(JVFrame)); + if (!jv->frames) + return AVERROR(ENOMEM); + + offset = 0x68 + ast->nb_index_entries * 16; + for(i = 0; i < ast->nb_index_entries; i++) { + AVIndexEntry *e = ast->index_entries + i; + JVFrame *jvf = jv->frames + i; + + /* total frame size including audio, video, palette data and padding */ + e->size = avio_rl32(pb); + e->timestamp = i; + e->pos = offset; + offset += e->size; + + jvf->audio_size = avio_rl32(pb); + jvf->video_size = avio_rl32(pb); + jvf->palette = avio_r8(pb); + if (avio_r8(pb)) + av_log(s, AV_LOG_WARNING, "unsupported audio codec\n"); + jvf->video_type = avio_r8(pb); + avio_skip(pb, 1); + + e->timestamp = jvf->audio_size ? audio_pts : AV_NOPTS_VALUE; + audio_pts += jvf->audio_size; + + e->flags = jvf->video_type != 1 ? AVINDEX_KEYFRAME : 0; + } + + jv->state = JV_AUDIO; + return 0; +} + +static int read_packet(AVFormatContext *s, AVPacket *pkt) +{ + JVDemuxContext *jv = s->priv_data; + AVIOContext *pb = s->pb; + AVStream *ast = s->streams[0]; + + while (!url_feof(s->pb) && jv->pts < ast->nb_index_entries) { + const AVIndexEntry *e = ast->index_entries + jv->pts; + const JVFrame *jvf = jv->frames + jv->pts; + + switch(jv->state) { + case JV_AUDIO: + jv->state++; + if (jvf->audio_size ) { + if (av_get_packet(s->pb, pkt, jvf->audio_size) < 0) + return AVERROR(ENOMEM); + pkt->stream_index = 0; + pkt->pts = e->timestamp; + pkt->flags |= PKT_FLAG_KEY; + return 0; + } + case JV_VIDEO: + jv->state++; + if (jvf->video_size || jvf->palette) { + int size = jvf->video_size + (jvf->palette ? 768 : 0); + if (av_new_packet(pkt, size + 5)) + return AVERROR(ENOMEM); + + AV_WL32(pkt->data, jvf->video_size); + pkt->data[4] = jvf->video_type; + if (avio_read(pb, pkt->data + 5, size) < 0) + return AVERROR(EIO); + + pkt->size = size + 5; + pkt->stream_index = 1; + pkt->pts = jv->pts; + if (jvf->video_type != 1) + pkt->flags |= PKT_FLAG_KEY; + return 0; + } + case JV_PADDING: + avio_skip(pb, FFMAX(e->size - jvf->audio_size - jvf->video_size + - (jvf->palette ? 768 : 0), 0)); + jv->state = JV_AUDIO; + jv->pts++; + } + } + + return AVERROR(EIO); +} + +static int read_seek(AVFormatContext *s, int stream_index, + int64_t ts, int flags) +{ + JVDemuxContext *jv = s->priv_data; + AVStream *ast = s->streams[0]; + int i; + + if (flags & (AVSEEK_FLAG_BYTE|AVSEEK_FLAG_FRAME)) + return AVERROR_NOTSUPP; + + switch(stream_index) { + case 0: + i = av_index_search_timestamp(ast, ts, flags); + break; + case 1: + i = ts; + break; + default: + return 0; + } + + if (i < 0 || i >= ast->nb_index_entries) + return 0; + + jv->state = JV_AUDIO; + jv->pts = i; + avio_seek(s->pb, ast->index_entries[i].pos, SEEK_SET); + return 0; +} + +AVInputFormat ff_jv_demuxer = { + .name = "jv", + .long_name = NULL_IF_CONFIG_SMALL("Bitmap Brothers JV"), + .priv_data_size = sizeof(JVDemuxContext), + .read_probe = read_probe, + .read_header = read_header, + .read_packet = read_packet, + .read_seek = read_seek, +}; diff --git a/libavformat/version.h b/libavformat/version.h index 494cf11a25..aed8908ebe 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -24,7 +24,7 @@ #include "libavutil/avutil.h" #define LIBAVFORMAT_VERSION_MAJOR 52 -#define LIBAVFORMAT_VERSION_MINOR 102 +#define LIBAVFORMAT_VERSION_MINOR 103 #define LIBAVFORMAT_VERSION_MICRO 0 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ From 402f9ad5fd13f594719408ca8d4cea8238db1de9 Mon Sep 17 00:00:00 2001 From: Peter Ross Date: Wed, 9 Mar 2011 02:11:10 +1100 Subject: [PATCH 06/18] Bitmap Brothers JV errata Signed-off-by: Ronald S. Bultje --- Changelog | 1 + MAINTAINERS | 2 ++ doc/general.texi | 3 +++ 3 files changed, 6 insertions(+) diff --git a/Changelog b/Changelog index dc47dabd9f..95c8b657fb 100644 --- a/Changelog +++ b/Changelog @@ -77,6 +77,7 @@ version : - Wing Commander IV movies decoder added - movie source added - Bink version 'b' audio and video decoder +- Bitmap Brothers JV playback system version 0.6: diff --git a/MAINTAINERS b/MAINTAINERS index f3ea177c78..0905af2243 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -143,6 +143,7 @@ Codecs: interplayvideo.c Mike Melanson ivi* Kostya Shishkov jpeg_ls.c Kostya Shishkov + jvdec.c Peter Ross kmvc.c Kostya Shishkov lcl*.c Roberto Togni, Reimar Doeffinger libgsm.c Michel Bardiaux @@ -276,6 +277,7 @@ Muxers/Demuxers: ipmovie.c Mike Melanson img2.c Michael Niedermayer iss.c Stefan Gehrer + jvdec.c Peter Ross libnut.c Oded Shimon lmlm4.c Ivo van Poorten lxfdec.c Tomas Härdin diff --git a/doc/general.texi b/doc/general.texi index b7fd12938c..080357a39d 100644 --- a/doc/general.texi +++ b/doc/general.texi @@ -62,6 +62,8 @@ library: @tab Used in some games from Bethesda Softworks. @item Bink @tab @tab X @tab Multimedia format used by many games. +@item Bitmap Brothers JV @tab @tab X + @tab Used in Z and Z95 games. @item Brute Force & Ignorance @tab @tab X @tab Used in the game Flash Traffic: City of Angels. @item Interplay C93 @tab @tab X @@ -352,6 +354,7 @@ following image formats are supported: @item Bethesda VID video @tab @tab X @tab Used in some games from Bethesda Softworks. @item Bink Video @tab @tab X +@item Bitmap Brothers JV video @tab @tab X @item Brute Force & Ignorance @tab @tab X @tab Used in the game Flash Traffic: City of Angels. @item C93 video @tab @tab X From 20c1281fe3fb30a8583d3a56ab2978e4ac8e9ee6 Mon Sep 17 00:00:00 2001 From: Peter Ross Date: Sat, 12 Mar 2011 13:31:26 +1100 Subject: [PATCH 07/18] jv demuxer: calculate palette_size for each frame in read_header Signed-off-by: Ronald S. Bultje --- libavformat/jvdec.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libavformat/jvdec.c b/libavformat/jvdec.c index 90b689948f..98fa6e72b2 100644 --- a/libavformat/jvdec.c +++ b/libavformat/jvdec.c @@ -31,7 +31,7 @@ typedef struct { int audio_size; /** audio packet size (bytes) */ int video_size; /** video packet size (bytes) */ - int palette; /** frame contains palette change */ + int palette_size; /** palette size (bytes) */ int video_type; /** per-frame video compression type */ } JVFrame; @@ -113,7 +113,7 @@ static int read_header(AVFormatContext *s, jvf->audio_size = avio_rl32(pb); jvf->video_size = avio_rl32(pb); - jvf->palette = avio_r8(pb); + jvf->palette_size = avio_r8(pb) ? 768 : 0; if (avio_r8(pb)) av_log(s, AV_LOG_WARNING, "unsupported audio codec\n"); jvf->video_type = avio_r8(pb); @@ -152,8 +152,8 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) } case JV_VIDEO: jv->state++; - if (jvf->video_size || jvf->palette) { - int size = jvf->video_size + (jvf->palette ? 768 : 0); + if (jvf->video_size || jvf->palette_size) { + int size = jvf->video_size + jvf->palette_size; if (av_new_packet(pkt, size + 5)) return AVERROR(ENOMEM); @@ -171,7 +171,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) } case JV_PADDING: avio_skip(pb, FFMAX(e->size - jvf->audio_size - jvf->video_size - - (jvf->palette ? 768 : 0), 0)); + - jvf->palette_size, 0)); jv->state = JV_AUDIO; jv->pts++; } From 772cb06281d9b82f283fc6c2ca7fb55a562d0ad9 Mon Sep 17 00:00:00 2001 From: Peter Ross Date: Sat, 12 Mar 2011 13:31:40 +1100 Subject: [PATCH 08/18] jv demuxer: define JV_PREAMBLE_SIZE instead of hard coding the number Signed-off-by: Ronald S. Bultje --- libavformat/jvdec.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libavformat/jvdec.c b/libavformat/jvdec.c index 98fa6e72b2..314a341ac6 100644 --- a/libavformat/jvdec.c +++ b/libavformat/jvdec.c @@ -28,6 +28,8 @@ #include "libavutil/intreadwrite.h" #include "avformat.h" +#define JV_PREAMBLE_SIZE 5 + typedef struct { int audio_size; /** audio packet size (bytes) */ int video_size; /** video packet size (bytes) */ @@ -154,15 +156,15 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) jv->state++; if (jvf->video_size || jvf->palette_size) { int size = jvf->video_size + jvf->palette_size; - if (av_new_packet(pkt, size + 5)) + if (av_new_packet(pkt, size + JV_PREAMBLE_SIZE)) return AVERROR(ENOMEM); AV_WL32(pkt->data, jvf->video_size); pkt->data[4] = jvf->video_type; - if (avio_read(pb, pkt->data + 5, size) < 0) + if (avio_read(pb, pkt->data + JV_PREAMBLE_SIZE, size) < 0) return AVERROR(EIO); - pkt->size = size + 5; + pkt->size = size + JV_PREAMBLE_SIZE; pkt->stream_index = 1; pkt->pts = jv->pts; if (jvf->video_type != 1) From 7f05c164d8ccbfded9bcefdb41942bc28d85c87a Mon Sep 17 00:00:00 2001 From: Peter Ross Date: Sun, 13 Mar 2011 16:15:38 +1100 Subject: [PATCH 09/18] jv demuxer: prevent video packet size overflow In the event of overflow, the JV_PADDING state will avio_skip over any overflow bytes (using JVFrame.total_size). Signed-off-by: Ronald S. Bultje --- libavformat/jvdec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/jvdec.c b/libavformat/jvdec.c index 314a341ac6..9235e51a99 100644 --- a/libavformat/jvdec.c +++ b/libavformat/jvdec.c @@ -116,6 +116,8 @@ static int read_header(AVFormatContext *s, jvf->audio_size = avio_rl32(pb); jvf->video_size = avio_rl32(pb); jvf->palette_size = avio_r8(pb) ? 768 : 0; + jvf->video_size = FFMIN(FFMAX(jvf->video_size, 0), + INT_MAX - JV_PREAMBLE_SIZE - jvf->palette_size); if (avio_r8(pb)) av_log(s, AV_LOG_WARNING, "unsupported audio codec\n"); jvf->video_type = avio_r8(pb); From 6e7cf13b6b1d0e08969b64129b9022cc1171d875 Mon Sep 17 00:00:00 2001 From: Peter Ross Date: Sun, 13 Mar 2011 16:27:05 +1100 Subject: [PATCH 10/18] mm decoder: move buffer allocation from decode_init() to decode_frame() This permits playback in ffplay when libavfilter is enabled. Signed-off-by: Ronald S. Bultje --- libavcodec/mmvideo.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libavcodec/mmvideo.c b/libavcodec/mmvideo.c index 60e00fbe29..92420b1d25 100644 --- a/libavcodec/mmvideo.c +++ b/libavcodec/mmvideo.c @@ -59,10 +59,6 @@ static av_cold int mm_decode_init(AVCodecContext *avctx) avctx->pix_fmt = PIX_FMT_PAL8; s->frame.reference = 1; - if (avctx->get_buffer(avctx, &s->frame)) { - av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n"); - return -1; - } return 0; } @@ -182,6 +178,11 @@ static int mm_decode_frame(AVCodecContext *avctx, buf += MM_PREAMBLE_SIZE; buf_size -= MM_PREAMBLE_SIZE; + if (avctx->reget_buffer(avctx, &s->frame) < 0) { + av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); + return -1; + } + switch(type) { case MM_TYPE_PALETTE : mm_decode_pal(s, buf, buf_end); return buf_size; case MM_TYPE_INTRA : mm_decode_intra(s, 0, 0, buf, buf_size); break; From 323e6fead07c75f418e4b60704a4f437bb3483b2 Mon Sep 17 00:00:00 2001 From: Justin Date: Fri, 11 Mar 2011 13:03:26 -0500 Subject: [PATCH 11/18] ac3enc: do not right-shift fixed-point coefficients in the final MDCT stage. This increases the accuracy of coefficients, leading to improved quality. Rescaling of the coefficients to full 25-bit accuracy is done rather than offsetting the exponent values. This requires coefficient scaling to be done before determining the rematrixing strategy. Also, the rematrixing strategy calculation must use 64-bit math to prevent overflow due to the higher precision coefficients. --- libavcodec/ac3enc.c | 25 ++++++++++--------- libavcodec/ac3enc_fixed.c | 49 ++++++++++++++++++++++++++++---------- libavcodec/ac3enc_fixed.h | 2 ++ libavcodec/ac3enc_float.h | 2 ++ tests/ref/acodec/ac3_fixed | 2 +- tests/ref/lavf/rm | 2 +- tests/ref/seek/ac3_rm | 22 ++++++++--------- 7 files changed, 65 insertions(+), 39 deletions(-) diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c index baa9597977..4c01fe3cbd 100644 --- a/libavcodec/ac3enc.c +++ b/libavcodec/ac3enc.c @@ -78,7 +78,7 @@ typedef struct AC3Block { int16_t **band_psd; ///< psd per critical band int16_t **mask; ///< masking curve uint16_t **qmant; ///< quantized mantissas - int8_t exp_shift[AC3_MAX_CHANNELS]; ///< exponent shift values + uint8_t coeff_shift[AC3_MAX_CHANNELS]; ///< fixed-point coefficient shift values uint8_t new_rematrixing_strategy; ///< send new rematrixing flags in this block uint8_t rematrixing_flags[4]; ///< rematrixing flags } AC3Block; @@ -269,7 +269,7 @@ static void apply_mdct(AC3EncodeContext *s) apply_window(&s->dsp, s->windowed_samples, input_samples, s->mdct.window, AC3_WINDOW_SIZE); - block->exp_shift[ch] = normalize_samples(s); + block->coeff_shift[ch] = normalize_samples(s); mdct512(&s->mdct, block->mdct_coef[ch], s->windowed_samples); } @@ -328,10 +328,10 @@ static void compute_rematrixing_strategy(AC3EncodeContext *s) CoefType rt = block->mdct_coef[1][i]; CoefType md = lt + rt; CoefType sd = lt - rt; - sum[0] += lt * lt; - sum[1] += rt * rt; - sum[2] += md * md; - sum[3] += sd * sd; + MAC_COEF(sum[0], lt, lt); + MAC_COEF(sum[1], rt, rt); + MAC_COEF(sum[2], md, md); + MAC_COEF(sum[3], sd, sd); } /* compare sums to determine if rematrixing will be used for this band */ @@ -416,14 +416,13 @@ static void extract_exponents(AC3EncodeContext *s) AC3Block *block = &s->blocks[blk]; uint8_t *exp = block->exp[ch]; int32_t *coef = block->fixed_coef[ch]; - int exp_shift = block->exp_shift[ch]; for (i = 0; i < AC3_MAX_COEFS; i++) { int e; int v = abs(coef[i]); if (v == 0) e = 24; else { - e = 23 - av_log2(v) + exp_shift; + e = 23 - av_log2(v); if (e >= 24) { e = 24; coef[i] = 0; @@ -1139,7 +1138,7 @@ static inline int asym_quant(int c, int e, int qbits) * Quantize a set of mantissas for a single channel in a single block. */ static void quantize_mantissas_blk_ch(AC3EncodeContext *s, int32_t *fixed_coef, - int8_t exp_shift, uint8_t *exp, + uint8_t *exp, uint8_t *bap, uint16_t *qmant, int n) { int i; @@ -1147,7 +1146,7 @@ static void quantize_mantissas_blk_ch(AC3EncodeContext *s, int32_t *fixed_coef, for (i = 0; i < n; i++) { int v; int c = fixed_coef[i]; - int e = exp[i] - exp_shift; + int e = exp[i]; int b = bap[i]; switch (b) { case 0: @@ -1243,7 +1242,7 @@ static void quantize_mantissas(AC3EncodeContext *s) s->qmant1_ptr = s->qmant2_ptr = s->qmant4_ptr = NULL; for (ch = 0; ch < s->channels; ch++) { - quantize_mantissas_blk_ch(s, block->fixed_coef[ch], block->exp_shift[ch], + quantize_mantissas_blk_ch(s, block->fixed_coef[ch], block->exp[ch], block->bap[ch], block->qmant[ch], s->nb_coefs[ch]); } @@ -1507,10 +1506,10 @@ static int ac3_encode_frame(AVCodecContext *avctx, unsigned char *frame, apply_mdct(s); - compute_rematrixing_strategy(s); - scale_coefficients(s); + compute_rematrixing_strategy(s); + apply_rematrixing(s); process_exponents(s); diff --git a/libavcodec/ac3enc_fixed.c b/libavcodec/ac3enc_fixed.c index 3de00ee484..e750a39038 100644 --- a/libavcodec/ac3enc_fixed.c +++ b/libavcodec/ac3enc_fixed.c @@ -131,10 +131,10 @@ mdct_alloc_fail: /** Complex multiply */ -#define CMUL(pre, pim, are, aim, bre, bim) \ +#define CMUL(pre, pim, are, aim, bre, bim, rshift) \ { \ - pre = (MUL16(are, bre) - MUL16(aim, bim)) >> 15; \ - pim = (MUL16(are, bim) + MUL16(bre, aim)) >> 15; \ + pre = (MUL16(are, bre) - MUL16(aim, bim)) >> rshift; \ + pim = (MUL16(are, bim) + MUL16(bre, aim)) >> rshift; \ } @@ -195,7 +195,7 @@ static void fft(AC3MDCTContext *mdct, IComplex *z, int ln) p++; q++; for(l = nblocks; l < np2; l += nblocks) { - CMUL(tmp_re, tmp_im, mdct->costab[l], -mdct->sintab[l], q->re, q->im); + CMUL(tmp_re, tmp_im, mdct->costab[l], -mdct->sintab[l], q->re, q->im, 15); BF(p->re, p->im, q->re, q->im, p->re, p->im, tmp_re, tmp_im); p++; @@ -234,7 +234,7 @@ static void mdct512(AC3MDCTContext *mdct, int32_t *out, int16_t *in) for (i = 0; i < n4; i++) { re = ((int)rot[ 2*i] - (int)rot[ n-1-2*i]) >> 1; im = -((int)rot[n2+2*i] - (int)rot[n2-1-2*i]) >> 1; - CMUL(x[i].re, x[i].im, re, im, -mdct->xcos1[i], mdct->xsin1[i]); + CMUL(x[i].re, x[i].im, re, im, -mdct->xcos1[i], mdct->xsin1[i], 15); } fft(mdct, x, mdct->nbits - 2); @@ -243,7 +243,7 @@ static void mdct512(AC3MDCTContext *mdct, int32_t *out, int16_t *in) for (i = 0; i < n4; i++) { re = x[i].re; im = x[i].im; - CMUL(out[n2-1-2*i], out[2*i], re, im, mdct->xsin1[i], mdct->xcos1[i]); + CMUL(out[n2-1-2*i], out[2*i], re, im, mdct->xsin1[i], mdct->xcos1[i], 0); } } @@ -294,10 +294,26 @@ static void lshift_tab(int16_t *tab, int n, unsigned int lshift) } +/** + * Right-shift each value in an array of int32_t by a specified amount. + * @param src input array + * @param len number of values in the array + * @param shift right shift amount + */ +static void ac3_rshift_int32_c(int32_t *src, unsigned int len, unsigned int shift) +{ + int i; + + if (shift > 0) { + for (i = 0; i < len; i++) + src[i] >>= shift; + } +} + + /** * Normalize the input samples to use the maximum available precision. - * This assumes signed 16-bit input samples. Exponents are reduced by 9 to - * match the 24-bit internal precision for MDCT coefficients. + * This assumes signed 16-bit input samples. * * @return exponent shift */ @@ -305,18 +321,25 @@ static int normalize_samples(AC3EncodeContext *s) { int v = 14 - log2_tab(s, s->windowed_samples, AC3_WINDOW_SIZE); lshift_tab(s->windowed_samples, AC3_WINDOW_SIZE, v); - return v - 9; + /* +6 to right-shift from 31-bit to 25-bit */ + return v + 6; } /** - * Scale MDCT coefficients from float to fixed-point. + * Scale MDCT coefficients to 25-bit signed fixed-point. */ static void scale_coefficients(AC3EncodeContext *s) { - /* scaling/conversion is obviously not needed for the fixed-point encoder - since the coefficients are already fixed-point. */ - return; + int blk, ch; + + for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) { + AC3Block *block = &s->blocks[blk]; + for (ch = 0; ch < s->channels; ch++) { + ac3_rshift_int32_c(block->mdct_coef[ch], AC3_MAX_COEFS, + block->coeff_shift[ch]); + } + } } diff --git a/libavcodec/ac3enc_fixed.h b/libavcodec/ac3enc_fixed.h index 12c8ace4aa..bad2306321 100644 --- a/libavcodec/ac3enc_fixed.h +++ b/libavcodec/ac3enc_fixed.h @@ -36,6 +36,8 @@ typedef int16_t SampleType; typedef int32_t CoefType; typedef int64_t CoefSumType; +#define MAC_COEF(d,a,b) MAC64(d,a,b) + /** * Compex number. diff --git a/libavcodec/ac3enc_float.h b/libavcodec/ac3enc_float.h index 1726ca045f..a4702bb51a 100644 --- a/libavcodec/ac3enc_float.h +++ b/libavcodec/ac3enc_float.h @@ -36,6 +36,8 @@ typedef float SampleType; typedef float CoefType; typedef float CoefSumType; +#define MAC_COEF(d,a,b) ((d)+=(a)*(b)) + typedef struct AC3MDCTContext { const float *window; ///< MDCT window function diff --git a/tests/ref/acodec/ac3_fixed b/tests/ref/acodec/ac3_fixed index f32443d3fb..4ef69ffd93 100644 --- a/tests/ref/acodec/ac3_fixed +++ b/tests/ref/acodec/ac3_fixed @@ -1,2 +1,2 @@ -07bd593823ebd721b3a32ef298bdfc20 *./tests/data/acodec/ac3.rm +b3a8f0a8809a58b2ece90744f06fff96 *./tests/data/acodec/ac3.rm 98751 ./tests/data/acodec/ac3.rm diff --git a/tests/ref/lavf/rm b/tests/ref/lavf/rm index b8bf220778..53b1255c83 100644 --- a/tests/ref/lavf/rm +++ b/tests/ref/lavf/rm @@ -1,2 +1,2 @@ -d149fc272dfd21fb8908ee21d7b1651b *./tests/data/lavf/lavf.rm +7da378131db880bcf2e58305d54418ec *./tests/data/lavf/lavf.rm 346706 ./tests/data/lavf/lavf.rm diff --git a/tests/ref/seek/ac3_rm b/tests/ref/seek/ac3_rm index 07fcfa1ec6..9b7db9ae9c 100644 --- a/tests/ref/seek/ac3_rm +++ b/tests/ref/seek/ac3_rm @@ -4,28 +4,29 @@ ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 ret: 0 st:-1 flags:1 ts: 1.894167 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 ret: 0 st: 0 flags:0 ts: 0.788000 -ret: 0 st: 0 flags:1 dts:4160806.587000 pts:4160806.587000 pos: 3883 size: 116 +ret: 0 st: 0 flags:1 dts:12581.487000 pts:12581.487000 pos: 5822 size: 916 ret: 0 st: 0 flags:1 ts:-0.317000 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 ret: 0 st:-1 flags:0 ts: 2.576668 -ret: 0 st: 0 flags:1 dts:4160806.587000 pts:4160806.587000 pos: 3883 size: 116 +ret: 0 st: 0 flags:1 dts:524.800000 pts:524.800000 pos: 6155 size: 244 ret:-1 st:-1 flags:1 ts: 1.470835 ret: 0 st: 0 flags:0 ts: 0.365000 -ret: 0 st: 0 flags:1 dts:4160806.587000 pts:4160806.587000 pos: 3883 size: 116 +ret: 0 st: 0 flags:1 dts:12581.487000 pts:12581.487000 pos: 5822 size: 916 ret: 0 st: 0 flags:1 ts:-0.741000 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 ret:-1 st:-1 flags:0 ts: 2.153336 -ret:-1 st:-1 flags:1 ts: 1.047503 +ret: 0 st:-1 flags:1 ts: 1.047503 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 ret: 0 st: 0 flags:0 ts:-0.058000 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 -ret:-1 st: 0 flags:1 ts: 2.836000 +ret: 0 st: 0 flags:1 ts: 2.836000 +ret: 0 st: 0 flags:1 dts: 2.681000 pts: 2.681000 pos: 44105 size: 558 ret:-1 st:-1 flags:0 ts: 1.730004 ret: 0 st:-1 flags:1 ts: 0.624171 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 ret: 0 st: 0 flags:0 ts:-0.482000 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 -ret: 0 st: 0 flags:1 ts: 2.413000 -ret: 0 st: 0 flags:1 dts: 2.229000 pts: 2.229000 pos: 36705 size: 556 +ret:-1 st: 0 flags:1 ts: 2.413000 ret:-1 st:-1 flags:0 ts: 1.306672 ret: 0 st:-1 flags:1 ts: 0.200839 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 @@ -33,13 +34,12 @@ ret: 0 st: 0 flags:0 ts:-0.905000 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 ret:-1 st: 0 flags:1 ts: 1.989000 ret: 0 st:-1 flags:0 ts: 0.883340 -ret: 0 st: 0 flags:1 dts:4160806.587000 pts:4160806.587000 pos: 3883 size: 116 +ret: 0 st: 0 flags:1 dts:12581.487000 pts:12581.487000 pos: 5822 size: 916 ret: 0 st:-1 flags:1 ts:-0.222493 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 -ret: 0 st: 0 flags:0 ts: 2.672000 -ret: 0 st: 0 flags:1 dts:6354.691000 pts:6354.691000 pos: 10783 size: 304 +ret:-1 st: 0 flags:0 ts: 2.672000 ret:-1 st: 0 flags:1 ts: 1.566000 ret: 0 st:-1 flags:0 ts: 0.460008 -ret: 0 st: 0 flags:1 dts:4160806.587000 pts:4160806.587000 pos: 3883 size: 116 +ret: 0 st: 0 flags:1 dts:12581.487000 pts:12581.487000 pos: 5822 size: 916 ret: 0 st:-1 flags:1 ts:-0.645825 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 From f1efbca5e914b28cd37cb1ea82d371acf3b96f61 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Fri, 11 Mar 2011 16:45:01 -0500 Subject: [PATCH 12/18] ac3enc: add SIMD-optimized shifting functions for use with the fixed-point AC3 encoder. --- libavcodec/ac3dsp.c | 37 ++++++++++++++++++++++++++++++ libavcodec/ac3dsp.h | 22 ++++++++++++++++++ libavcodec/ac3enc_fixed.c | 41 ++++----------------------------- libavcodec/x86/ac3dsp.asm | 45 +++++++++++++++++++++++++++++++++++++ libavcodec/x86/ac3dsp_mmx.c | 12 ++++++++++ 5 files changed, 120 insertions(+), 37 deletions(-) diff --git a/libavcodec/ac3dsp.c b/libavcodec/ac3dsp.c index da3a123e9b..4d9db9be50 100644 --- a/libavcodec/ac3dsp.c +++ b/libavcodec/ac3dsp.c @@ -50,10 +50,47 @@ static int ac3_max_msb_abs_int16_c(const int16_t *src, int len) return v; } +static void ac3_lshift_int16_c(int16_t *src, unsigned int len, + unsigned int shift) +{ + uint32_t *src32 = (uint32_t *)src; + const uint32_t mask = ~(((1 << shift) - 1) << 16); + int i; + len >>= 1; + for (i = 0; i < len; i += 8) { + src32[i ] = (src32[i ] << shift) & mask; + src32[i+1] = (src32[i+1] << shift) & mask; + src32[i+2] = (src32[i+2] << shift) & mask; + src32[i+3] = (src32[i+3] << shift) & mask; + src32[i+4] = (src32[i+4] << shift) & mask; + src32[i+5] = (src32[i+5] << shift) & mask; + src32[i+6] = (src32[i+6] << shift) & mask; + src32[i+7] = (src32[i+7] << shift) & mask; + } +} + +static void ac3_rshift_int32_c(int32_t *src, unsigned int len, + unsigned int shift) +{ + do { + *src++ >>= shift; + *src++ >>= shift; + *src++ >>= shift; + *src++ >>= shift; + *src++ >>= shift; + *src++ >>= shift; + *src++ >>= shift; + *src++ >>= shift; + len -= 8; + } while (len > 0); +} + av_cold void ff_ac3dsp_init(AC3DSPContext *c) { c->ac3_exponent_min = ac3_exponent_min_c; c->ac3_max_msb_abs_int16 = ac3_max_msb_abs_int16_c; + c->ac3_lshift_int16 = ac3_lshift_int16_c; + c->ac3_rshift_int32 = ac3_rshift_int32_c; if (HAVE_MMX) ff_ac3dsp_init_x86(c); diff --git a/libavcodec/ac3dsp.h b/libavcodec/ac3dsp.h index a4f141f2f5..31a0af375d 100644 --- a/libavcodec/ac3dsp.h +++ b/libavcodec/ac3dsp.h @@ -46,6 +46,28 @@ typedef struct AC3DSPContext { * @return a value with the same MSB as max(abs(src[])) */ int (*ac3_max_msb_abs_int16)(const int16_t *src, int len); + + /** + * Left-shift each value in an array of int16_t by a specified amount. + * @param src input array + * constraints: align 16 + * @param len number of values in the array + * constraints: multiple of 32 greater than 0 + * @param shift left shift amount + * constraints: range [0,15] + */ + void (*ac3_lshift_int16)(int16_t *src, unsigned int len, unsigned int shift); + + /** + * Right-shift each value in an array of int32_t by a specified amount. + * @param src input array + * constraints: align 16 + * @param len number of values in the array + * constraints: multiple of 16 greater than 0 + * @param shift right shift amount + * constraints: range [0,31] + */ + void (*ac3_rshift_int32)(int32_t *src, unsigned int len, unsigned int shift); } AC3DSPContext; void ff_ac3dsp_init (AC3DSPContext *c); diff --git a/libavcodec/ac3enc_fixed.c b/libavcodec/ac3enc_fixed.c index e750a39038..d1bb429ccc 100644 --- a/libavcodec/ac3enc_fixed.c +++ b/libavcodec/ac3enc_fixed.c @@ -277,40 +277,6 @@ static int log2_tab(AC3EncodeContext *s, int16_t *src, int len) } -/** - * Left-shift each value in an array by a specified amount. - * @param tab input array - * @param n number of values in the array - * @param lshift left shift amount - */ -static void lshift_tab(int16_t *tab, int n, unsigned int lshift) -{ - int i; - - if (lshift > 0) { - for (i = 0; i < n; i++) - tab[i] <<= lshift; - } -} - - -/** - * Right-shift each value in an array of int32_t by a specified amount. - * @param src input array - * @param len number of values in the array - * @param shift right shift amount - */ -static void ac3_rshift_int32_c(int32_t *src, unsigned int len, unsigned int shift) -{ - int i; - - if (shift > 0) { - for (i = 0; i < len; i++) - src[i] >>= shift; - } -} - - /** * Normalize the input samples to use the maximum available precision. * This assumes signed 16-bit input samples. @@ -320,7 +286,8 @@ static void ac3_rshift_int32_c(int32_t *src, unsigned int len, unsigned int shif static int normalize_samples(AC3EncodeContext *s) { int v = 14 - log2_tab(s, s->windowed_samples, AC3_WINDOW_SIZE); - lshift_tab(s->windowed_samples, AC3_WINDOW_SIZE, v); + if (v > 0) + s->ac3dsp.ac3_lshift_int16(s->windowed_samples, AC3_WINDOW_SIZE, v); /* +6 to right-shift from 31-bit to 25-bit */ return v + 6; } @@ -336,8 +303,8 @@ static void scale_coefficients(AC3EncodeContext *s) for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) { AC3Block *block = &s->blocks[blk]; for (ch = 0; ch < s->channels; ch++) { - ac3_rshift_int32_c(block->mdct_coef[ch], AC3_MAX_COEFS, - block->coeff_shift[ch]); + s->ac3dsp.ac3_rshift_int32(block->mdct_coef[ch], AC3_MAX_COEFS, + block->coeff_shift[ch]); } } } diff --git a/libavcodec/x86/ac3dsp.asm b/libavcodec/x86/ac3dsp.asm index b1eeca9cd2..e281791b1e 100644 --- a/libavcodec/x86/ac3dsp.asm +++ b/libavcodec/x86/ac3dsp.asm @@ -133,3 +133,48 @@ INIT_XMM AC3_MAX_MSB_ABS_INT16 sse2, min_max %define ABS2 ABS2_SSSE3 AC3_MAX_MSB_ABS_INT16 ssse3, or_abs + +;----------------------------------------------------------------------------- +; macro used for ff_ac3_lshift_int16() and ff_ac3_rshift_int32() +;----------------------------------------------------------------------------- + +%macro AC3_SHIFT 4 ; l/r, 16/32, shift instruction, instruction set +cglobal ac3_%1shift_int%2_%4, 3,3,5, src, len, shift + movd m0, shiftd +.loop: + mova m1, [srcq ] + mova m2, [srcq+mmsize ] + mova m3, [srcq+mmsize*2] + mova m4, [srcq+mmsize*3] + %3 m1, m0 + %3 m2, m0 + %3 m3, m0 + %3 m4, m0 + mova [srcq ], m1 + mova [srcq+mmsize ], m2 + mova [srcq+mmsize*2], m3 + mova [srcq+mmsize*3], m4 + add srcq, mmsize*4 + sub lend, mmsize*32/%2 + ja .loop +.end: + REP_RET +%endmacro + +;----------------------------------------------------------------------------- +; void ff_ac3_lshift_int16(int16_t *src, unsigned int len, unsigned int shift) +;----------------------------------------------------------------------------- + +INIT_MMX +AC3_SHIFT l, 16, psllw, mmx +INIT_XMM +AC3_SHIFT l, 16, psllw, sse2 + +;----------------------------------------------------------------------------- +; void ff_ac3_rshift_int32(int32_t *src, unsigned int len, unsigned int shift) +;----------------------------------------------------------------------------- + +INIT_MMX +AC3_SHIFT r, 32, psrad, mmx +INIT_XMM +AC3_SHIFT r, 32, psrad, sse2 diff --git a/libavcodec/x86/ac3dsp_mmx.c b/libavcodec/x86/ac3dsp_mmx.c index d8af59ce8d..835b10696d 100644 --- a/libavcodec/x86/ac3dsp_mmx.c +++ b/libavcodec/x86/ac3dsp_mmx.c @@ -32,6 +32,12 @@ extern int ff_ac3_max_msb_abs_int16_mmxext(const int16_t *src, int len); extern int ff_ac3_max_msb_abs_int16_sse2 (const int16_t *src, int len); extern int ff_ac3_max_msb_abs_int16_ssse3 (const int16_t *src, int len); +extern void ff_ac3_lshift_int16_mmx (int16_t *src, unsigned int len, unsigned int shift); +extern void ff_ac3_lshift_int16_sse2(int16_t *src, unsigned int len, unsigned int shift); + +extern void ff_ac3_rshift_int32_mmx (int32_t *src, unsigned int len, unsigned int shift); +extern void ff_ac3_rshift_int32_sse2(int32_t *src, unsigned int len, unsigned int shift); + av_cold void ff_ac3dsp_init_x86(AC3DSPContext *c) { int mm_flags = av_get_cpu_flags(); @@ -40,6 +46,8 @@ av_cold void ff_ac3dsp_init_x86(AC3DSPContext *c) if (mm_flags & AV_CPU_FLAG_MMX) { c->ac3_exponent_min = ff_ac3_exponent_min_mmx; c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_mmx; + c->ac3_lshift_int16 = ff_ac3_lshift_int16_mmx; + c->ac3_rshift_int32 = ff_ac3_rshift_int32_mmx; } if (mm_flags & AV_CPU_FLAG_MMX2 && HAVE_MMX2) { c->ac3_exponent_min = ff_ac3_exponent_min_mmxext; @@ -48,6 +56,10 @@ av_cold void ff_ac3dsp_init_x86(AC3DSPContext *c) if (mm_flags & AV_CPU_FLAG_SSE2 && HAVE_SSE) { c->ac3_exponent_min = ff_ac3_exponent_min_sse2; c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_sse2; + if (!(mm_flags & AV_CPU_FLAG_SSE2SLOW)) { + c->ac3_lshift_int16 = ff_ac3_lshift_int16_sse2; + c->ac3_rshift_int32 = ff_ac3_rshift_int32_sse2; + } } if (mm_flags & AV_CPU_FLAG_SSSE3 && HAVE_SSSE3) { c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_ssse3; From 9f8f62d4a37735ea823e82bad566a2aa69732888 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Mon, 14 Mar 2011 17:15:34 +0000 Subject: [PATCH 13/18] Delete MAINTAINERS file This file is a bad idea and also badly outdated. Signed-off-by: Mans Rullgard --- MAINTAINERS | 379 ---------------------------------------------------- 1 file changed, 379 deletions(-) delete mode 100644 MAINTAINERS diff --git a/MAINTAINERS b/MAINTAINERS deleted file mode 100644 index 0905af2243..0000000000 --- a/MAINTAINERS +++ /dev/null @@ -1,379 +0,0 @@ -FFmpeg maintainers -================== - -Below is a list of the people maintaining different parts of the -FFmpeg code. - - -Applications -============ - -ffmpeg: - ffmpeg.c Michael Niedermayer - -ffplay: - ffplay.c Michael Niedermayer - -ffprobe: - ffprobe.c Stefano Sabatini - -ffserver: - ffserver.c, ffserver.h Baptiste Coudurier - -Commandline utility code: - cmdutils.c, cmdutils.h Michael Niedermayer - -QuickTime faststart: - tools/qt-faststart.c Baptiste Coudurier - - -Miscellaneous Areas -=================== - -documentation Mike Melanson -website Robert Swain -build system (configure,Makefiles) Diego Biurrun, Mans Rullgard -project server Diego Biurrun, Mans Rullgard -mailinglists Michael Niedermayer, Baptiste Coudurier -presets Robert Swain -metadata subsystem Aurelien Jacobs -release management Diego Biurrun, Reinhard Tartler - - -libavutil -========= - -External Interfaces: - libavutil/avutil.h Michael Niedermayer -Internal Interfaces: - libavutil/common.h Michael Niedermayer - -Other: - intfloat* Michael Niedermayer - rational.c, rational.h Michael Niedermayer - mathematics.c, mathematics.h Michael Niedermayer - integer.c, integer.h Michael Niedermayer - bswap.h - - -libavcodec -========== - -Generic Parts: - External Interfaces: - avcodec.h Michael Niedermayer - utility code: - utils.c Michael Niedermayer - mem.c Michael Niedermayer - opt.c, opt.h Michael Niedermayer - arithmetic expression evaluator: - eval.c Michael Niedermayer - audio and video frame extraction: - parser.c Michael Niedermayer - bitstream reading: - bitstream.c, bitstream.h Michael Niedermayer - CABAC: - cabac.h, cabac.c Michael Niedermayer - DSP utilities: - dsputils.c, dsputils.h Michael Niedermayer - entropy coding: - rangecoder.c, rangecoder.h Michael Niedermayer - lzw.* Michael Niedermayer - floating point AAN DCT: - faandct.c, faandct.h Michael Niedermayer - Golomb coding: - golomb.c, golomb.h Michael Niedermayer - LPC: - lpc.c, lpc.h Justin Ruggles - motion estimation: - motion* Michael Niedermayer - rate control: - ratecontrol.c Michael Niedermayer - libxvid_rc.c Michael Niedermayer - simple IDCT: - simple_idct.c, simple_idct.h Michael Niedermayer - postprocessing: - libpostproc/* Michael Niedermayer - table generation: - tableprint.c, tableprint.h Reimar Doeffinger - -Codecs: - 4xm.c Michael Niedermayer - 8bps.c Roberto Togni - 8svx.c Jaikrishnan Menon - aasc.c Kostya Shishkov - ac3* Justin Ruggles - alacenc.c Jaikrishnan Menon - alsdec.c Thilo Borgmann - apedec.c Kostya Shishkov - ass* Aurelien Jacobs - asv* Michael Niedermayer - atrac3* Benjamin Larsson - bgmc.c, bgmc.h Thilo Borgmann - bink.c Kostya Shishkov - binkaudio.c Peter Ross - bmp.c Mans Rullgard, Kostya Shishkov - cavs* Stefan Gehrer - celp_filters.* Vitor Sessak - cinepak.c Roberto Togni - cljr Alex Beregszaszi - cook.c, cookdata.h Benjamin Larsson - cscd.c Reimar Doeffinger - dca.c Kostya Shishkov, Benjamin Larsson - dnxhd* Baptiste Coudurier - dpcm.c Mike Melanson - dxa.c Kostya Shishkov - dv.c Roman Shaposhnik - eacmv*, eaidct*, eat* Peter Ross - ffv1.c Michael Niedermayer - flac* Justin Ruggles - flashsv* Benjamin Larsson - flicvideo.c Mike Melanson - g722.c Martin Storsjo - g726.c Roman Shaposhnik - gifdec.c Baptiste Coudurier - h264* Loren Merritt, Michael Niedermayer - h261* Michael Niedermayer - h263* Michael Niedermayer - huffyuv.c Michael Niedermayer - idcinvideo.c Mike Melanson - imc* Benjamin Larsson - indeo2* Kostya Shishkov - indeo5* Kostya Shishkov - interplayvideo.c Mike Melanson - ivi* Kostya Shishkov - jpeg_ls.c Kostya Shishkov - jvdec.c Peter Ross - kmvc.c Kostya Shishkov - lcl*.c Roberto Togni, Reimar Doeffinger - libgsm.c Michel Bardiaux - libdirac* David Conrad - libopenjpeg.c Jaikrishnan Menon - libschroedinger* David Conrad - libspeexdec.c Justin Ruggles - libtheoraenc.c David Conrad - libvorbis.c David Conrad - libxavs.c Stefan Gehrer - libx264.c Mans Rullgard, Jason Garrett-Glaser - loco.c Kostya Shishkov - lzo.h, lzo.c Reimar Doeffinger - mdec.c Michael Niedermayer - mimic.c Ramiro Polla - mjpeg.c Michael Niedermayer - mlp* Ramiro Polla - mmvideo.c Peter Ross - mpc* Kostya Shishkov - mpeg12.c, mpeg12data.h Michael Niedermayer - mpegvideo.c, mpegvideo.h Michael Niedermayer - msmpeg4.c, msmpeg4data.h Michael Niedermayer - msrle.c Mike Melanson - msvideo1.c Mike Melanson - nellymoserdec.c Benjamin Larsson - nuv.c Reimar Doeffinger - pcx.c Ivo van Poorten - pgssubdec.c Reimar Doeffinger - ptx.c Ivo van Poorten - qcelp* Reynaldo H. Verdejo Pinochet - qdm2.c, qdm2data.h Roberto Togni, Benjamin Larsson - qdrw.c Kostya Shishkov - qpeg.c Kostya Shishkov - qtrle.c Mike Melanson - ra144.c, ra144.h, ra288.c, ra288.h Roberto Togni - resample2.c Michael Niedermayer - rl2.c Sascha Sommer - rpza.c Roberto Togni - rtjpeg.c, rtjpeg.h Reimar Doeffinger - rv10.c Michael Niedermayer - rv3* Kostya Shishkov - rv4* Kostya Shishkov - s3tc* Ivo van Poorten - smacker.c Kostya Shishkov - smc.c Mike Melanson - snow.c Michael Niedermayer, Loren Merritt - sonic.c Alex Beregszaszi - srtdec.c Aurelien Jacobs - sunrast.c Ivo van Poorten - svq3.c Michael Niedermayer - targa.c Kostya Shishkov - tiff.c Kostya Shishkov - truemotion1* Mike Melanson - truemotion2* Kostya Shishkov - truespeech.c Kostya Shishkov - tscc.c Kostya Shishkov - tta.c Alex Beregszaszi, Jaikrishnan Menon - txd.c Ivo van Poorten - ulti* Kostya Shishkov - vb.c Kostya Shishkov - vc1* Kostya Shishkov - vcr1.c Michael Niedermayer - vmnc.c Kostya Shishkov - vorbis_enc.c Oded Shimon - vorbis_dec.c Denes Balatoni, David Conrad - vp3* Mike Melanson - vp5 Aurelien Jacobs - vp6 Aurelien Jacobs - vp8 David Conrad, Jason Garrett-Glaser, Ronald Bultje - vqavideo.c Mike Melanson - wavpack.c Kostya Shishkov - wmaprodec.c Sascha Sommer - wmavoice.c Ronald S. Bultje - wmv2.c Michael Niedermayer - wnv1.c Kostya Shishkov - xan.c Mike Melanson - xl.c Kostya Shishkov - xvmc.c Ivan Kalvachev - zmbv* Kostya Shishkov - -Hardware acceleration: - dxva2* Laurent Aimar - vaapi* Gwenole Beauchesne - vdpau* Carl Eugen Hoyos - - -libavdevice -=========== - External Interface: - libavdevice/avdevice.h - - - libdc1394.c Roman Shaposhnik - v4l2.c Luca Abeni - vfwcap.c Ramiro Polla - - -libavformat -=========== - -Generic parts: - External Interface: - libavformat/avformat.h Michael Niedermayer - Utility Code: - libavformat/utils.c Michael Niedermayer - - -Muxers/Demuxers: - 4xm.c Mike Melanson - adtsenc.c Robert Swain - aiff.c Baptiste Coudurier - ape.c Kostya Shishkov - ass* Aurelien Jacobs - avi* Michael Niedermayer - bink.c Peter Ross - caf* Peter Ross - crc.c Michael Niedermayer - daud.c Reimar Doeffinger - dv.c Roman Shaposhnik - dxa.c Kostya Shishkov - electronicarts.c Peter Ross - ffm* Baptiste Coudurier - flac* Justin Ruggles - flic.c Mike Melanson - flvdec.c, flvenc.c Michael Niedermayer - gxf.c Reimar Doeffinger - gxfenc.c Baptiste Coudurier - idcin.c Mike Melanson - idroqdec.c Mike Melanson - iff.c Jaikrishnan Menon - ipmovie.c Mike Melanson - img2.c Michael Niedermayer - iss.c Stefan Gehrer - jvdec.c Peter Ross - libnut.c Oded Shimon - lmlm4.c Ivo van Poorten - lxfdec.c Tomas Härdin - matroska.c Aurelien Jacobs - matroskadec.c Aurelien Jacobs - matroskaenc.c David Conrad - metadata* Aurelien Jacobs - mm.c Peter Ross - mov.c Michael Niedermayer, Baptiste Coudurier - movenc.c Michael Niedermayer, Baptiste Coudurier - mpc.c Kostya Shishkov - mpeg.c Michael Niedermayer - mpegenc.c Michael Niedermayer - mpegts* Baptiste Coudurier - msnwc_tcp.c Ramiro Polla - mtv.c Reynaldo H. Verdejo Pinochet - mxf* Baptiste Coudurier - nsvdec.c Francois Revol - nut.c Michael Niedermayer - nuv.c Reimar Doeffinger - oggdec.c, oggdec.h David Conrad - oggenc.c Baptiste Coudurier - oggparse*.c David Conrad - oma.c Maxim Poliakovski - psxstr.c Mike Melanson - pva.c Ivo van Poorten - r3d.c Baptiste Coudurier - raw.c Michael Niedermayer - rdt.c Ronald S. Bultje - rl2.c Sascha Sommer - rmdec.c, rmenc.c Ronald S. Bultje, Kostya Shishkov - rtmp* Kostya Shishkov - rtp.c, rtpenc.c Martin Storsjo - rtpdec_asf.* Ronald S. Bultje - rtpenc_mpv.*, rtpenc_aac.* Martin Storsjo - rtsp.c Luca Barbato - sdp.c Martin Storsjo - segafilm.c Mike Melanson - siff.c Kostya Shishkov - smacker.c Kostya Shishkov - srtdec.c Aurelien Jacobs - swf.c Baptiste Coudurier - tta.c Alex Beregszaszi - txd.c Ivo van Poorten - voc.c Aurelien Jacobs - wav.c Michael Niedermayer - wc3movie.c Mike Melanson - westwood.c Mike Melanson - wtv.c Peter Ross - wv.c Kostya Shishkov - -Protocols: - http.c Ronald S. Bultje - mms*.c Ronald S. Bultje - udp.c Luca Abeni - - -Operating systems / CPU architectures -===================================== - -Alpha Mans Rullgard, Falk Hueffner -ARM Mans Rullgard -AVR32 Mans Rullgard -MIPS Mans Rullgard -Mac OS X / PowerPC Romain Dolbeau, Guillaume Poirier -Amiga / PowerPC Colin Ward -Linux / PowerPC Luca Barbato -Windows MinGW Alex Beregszaszi, Ramiro Polla -Windows Cygwin Victor Paesa -ADI/Blackfin DSP Marc Hoffman -Sparc Roman Shaposhnik -x86 Michael Niedermayer - - -GnuPG Fingerprints of maintainers and others who have svn write access -====================================================================== - -Anssi Hannula 1A92 FF42 2DD9 8D2E 8AF7 65A9 4278 C520 513D F3CB -Anton Khirnov 6D0C 6625 56F8 65D1 E5F5 814B B50A 1241 C067 07AB -Attila Kinali 11F0 F9A6 A1D2 11F6 C745 D10C 6520 BCDD F2DF E765 -Baptiste Coudurier 8D77 134D 20CC 9220 201F C5DB 0AC9 325C 5C1A BAAA -Ben Littler 3EE3 3723 E560 3214 A8CD 4DEB 2CDB FCE7 768C 8D2C -Benoit Fouet B22A 4F4F 43EF 636B BB66 FCDC 0023 AE1E 2985 49C8 -Daniel Verkamp 78A6 07ED 782C 653E C628 B8B9 F0EB 8DD8 2F0E 21C7 -Diego Biurrun 8227 1E31 B6D9 4994 7427 E220 9CAE D6CC 4757 FCC5 -Jaikrishnan Menon 61A1 F09F 01C9 2D45 78E1 C862 25DC 8831 AF70 D368 -Justin Ruggles 3136 ECC0 C10D 6C04 5F43 CA29 FCBE CD2A 3787 1EBF -Loren Merritt ABD9 08F4 C920 3F65 D8BE 35D7 1540 DAA7 060F 56DE -Luca Barbato 6677 4209 213C 8843 5B67 29E7 E84C 78C2 84E9 0E34 -Michael Niedermayer 9FF2 128B 147E F673 0BAD F133 611E C787 040B 0FAB -Panagiotis Issaris 515C E262 10A8 FDCE 5481 7B9C 3AD7 D9A5 071D B3A9 -Peter Ross A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B -Reimar Döffinger C61D 16E5 9E2C D10C 8958 38A4 0899 A2B9 06D4 D9C7 -Reinhard Tartler 9300 5DC2 7E87 6C37 ED7B CA9A 9808 3544 9453 48A4 -Reynaldo H. Verdejo Pinochet 6E27 CD34 170C C78E 4D4F 5F40 C18E 077F 3114 452A -Robert Swain EE7A 56EA 4A81 A7B5 2001 A521 67FA 362D A2FC 3E71 -Sascha Sommer 38A0 F88B 868E 9D3A 97D4 D6A0 E823 706F 1E07 0D3C -Stefano Sabatini 9A43 10F8 D32C D33C 48E7 C52C 5DF2 8E4D B2EE 066B -Tomas Härdin D133 29CA 4EEC 9DB4 7076 F697 B04B 7403 3313 41FD From 025225d7ee0e7585dff9617c60259febd9e7299c Mon Sep 17 00:00:00 2001 From: Philip Langdale Date: Mon, 14 Mar 2011 22:14:22 -0700 Subject: [PATCH 14/18] h264_mp4toannexb_bsf: Fix spurious warning when stream has SPS and PPS units. Signed-off-by: Philip Langdale Signed-off-by: Ronald S. Bultje --- libavcodec/h264_mp4toannexb_bsf.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavcodec/h264_mp4toannexb_bsf.c b/libavcodec/h264_mp4toannexb_bsf.c index df49b34810..3754f2aee7 100644 --- a/libavcodec/h264_mp4toannexb_bsf.c +++ b/libavcodec/h264_mp4toannexb_bsf.c @@ -116,8 +116,11 @@ static int h264_mp4toannexb_filter(AVBitStreamFilterContext *bsfc, memcpy(out+total_size-unit_size, extradata+2, unit_size); extradata += 2+unit_size; - if (!unit_nb && !sps_done++) + if (!unit_nb && !sps_done++) { unit_nb = *extradata++; /* number of pps unit(s) */ + if (unit_nb) + pps_seen = 1; + } } if(out) From 75b9ed04b977bfd467816f7e60c6511ef89b8a2b Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 14 Mar 2011 20:38:54 +0100 Subject: [PATCH 15/18] lavf/utils: dont't explicitly check AVIOContext.error The error should be caught in write_packet()/write_trailer() Signed-off-by: Ronald S. Bultje --- libavformat/utils.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/libavformat/utils.c b/libavformat/utils.c index 918b07df41..902a170b53 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2988,8 +2988,6 @@ int av_write_frame(AVFormatContext *s, AVPacket *pkt) return ret; ret= s->oformat->write_packet(s, pkt); - if(!ret) - ret= url_ferror(s->pb); return ret; } @@ -3111,8 +3109,6 @@ int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt){ if(ret<0) return ret; - if(url_ferror(s->pb)) - return url_ferror(s->pb); } } @@ -3134,15 +3130,11 @@ int av_write_trailer(AVFormatContext *s) if(ret<0) goto fail; - if(url_ferror(s->pb)) - goto fail; } if(s->oformat->write_trailer) ret = s->oformat->write_trailer(s); fail: - if(ret == 0) - ret=url_ferror(s->pb); for(i=0;inb_streams;i++) { av_freep(&s->streams[i]->priv_data); av_freep(&s->streams[i]->index_entries); From 3e68b3ba7b015cf2154ad2023781eedd47f0f4bb Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 14 Mar 2011 20:38:55 +0100 Subject: [PATCH 16/18] avio: deprecate url_ferror AVIOContext.error should be used directly instead. Signed-off-by: Ronald S. Bultje --- ffplay.c | 2 +- libavformat/asfdec.c | 2 +- libavformat/avio.h | 3 +-- libavformat/aviobuf.c | 6 +++--- libavformat/dsicin.c | 2 +- libavformat/mxg.c | 2 +- libavformat/wtv.c | 2 +- 7 files changed, 9 insertions(+), 10 deletions(-) diff --git a/ffplay.c b/ffplay.c index 60194372d9..fe0448744d 100644 --- a/ffplay.c +++ b/ffplay.c @@ -2570,7 +2570,7 @@ static int decode_thread(void *arg) if (ret < 0) { if (ret == AVERROR_EOF || ic->pb->eof_reached) eof=1; - if (url_ferror(ic->pb)) + if (ic->pb->error) break; SDL_Delay(100); /* wait for user event */ continue; diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index 10d34499c7..cbcd576c9f 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -743,7 +743,7 @@ static int ff_asf_get_packet(AVFormatContext *s, AVIOContext *pb) * imply complete -EAGAIN handling support at random positions in * the stream. */ - if (url_ferror(pb) == AVERROR(EAGAIN)) + if (pb->error == AVERROR(EAGAIN)) return AVERROR(EAGAIN); if (!pb->eof_reached) av_log(s, AV_LOG_ERROR, "ff asf bad header %x at:%"PRId64"\n", c, avio_tell(pb)); diff --git a/libavformat/avio.h b/libavformat/avio.h index 2949629d57..b8f9c588cc 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -437,6 +437,7 @@ attribute_deprecated int url_fgetc(AVIOContext *s); * @deprecated use AVIOContext.eof_reached */ attribute_deprecated int url_feof(AVIOContext *s); +attribute_deprecated int url_ferror(AVIOContext *s); #endif AVIOContext *avio_alloc_context( @@ -499,8 +500,6 @@ int64_t avio_seek(AVIOContext *s, int64_t offset, int whence); */ int64_t avio_size(AVIOContext *s); -int url_ferror(AVIOContext *s); - int av_url_read_fpause(AVIOContext *h, int pause); int64_t av_url_read_fseek(AVIOContext *h, int stream_index, int64_t timestamp, int flags); diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index d0f63df3d2..4f39fe3529 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -272,7 +272,6 @@ int url_feof(AVIOContext *s) return 0; return s->eof_reached; } -#endif int url_ferror(AVIOContext *s) { @@ -280,6 +279,7 @@ int url_ferror(AVIOContext *s) return 0; return s->error; } +#endif void avio_wl32(AVIOContext *s, unsigned int val) { @@ -599,7 +599,7 @@ int avio_read(AVIOContext *s, unsigned char *buf, int size) } } if (size1 == size) { - if (url_ferror(s)) return url_ferror(s); + if (s->error) return s->error; if (s->eof_reached) return AVERROR_EOF; } return size1 - size; @@ -622,7 +622,7 @@ int ffio_read_partial(AVIOContext *s, unsigned char *buf, int size) memcpy(buf, s->buf_ptr, len); s->buf_ptr += len; if (!len) { - if (url_ferror(s)) return url_ferror(s); + if (s->error) return s->error; if (s->eof_reached) return AVERROR_EOF; } return len; diff --git a/libavformat/dsicin.c b/libavformat/dsicin.c index 7030491992..023441be73 100644 --- a/libavformat/dsicin.c +++ b/libavformat/dsicin.c @@ -147,7 +147,7 @@ static int cin_read_frame_header(CinDemuxContext *cin, AVIOContext *pb) { hdr->video_frame_size = avio_rl32(pb); hdr->audio_frame_size = avio_rl32(pb); - if (pb->eof_reached || url_ferror(pb)) + if (pb->eof_reached || pb->error) return AVERROR(EIO); if (avio_rl32(pb) != 0xAA55AA55) diff --git a/libavformat/mxg.c b/libavformat/mxg.c index 3a71b22054..7d342f1766 100644 --- a/libavformat/mxg.c +++ b/libavformat/mxg.c @@ -132,7 +132,7 @@ static int mxg_read_packet(AVFormatContext *s, AVPacket *pkt) uint8_t *startmarker_ptr, *end, *search_end, marker; MXGContext *mxg = s->priv_data; - while (!s->pb->eof_reached && !url_ferror(s->pb)){ + while (!s->pb->eof_reached && !s->pb->error){ if (mxg->cache_size <= OVERREAD_SIZE) { /* update internal buffer */ ret = mxg_update_cache(s, DEFAULT_PACKET_SIZE + OVERREAD_SIZE); diff --git a/libavformat/wtv.c b/libavformat/wtv.c index 2b3737bc84..191c1c1d67 100644 --- a/libavformat/wtv.c +++ b/libavformat/wtv.c @@ -77,7 +77,7 @@ static int wtvfile_read_packet(void *opaque, uint8_t *buf, int buf_size) AVIOContext *pb = wf->pb_filesystem; int nread = 0; - if (wf->error || url_ferror(pb)) + if (wf->error || pb->error) return -1; if (wf->position >= wf->length || pb->eof_reached) return 0; From bafa4dd3e69531f262472ac286e0ae7d4dbfbd97 Mon Sep 17 00:00:00 2001 From: Nicolas George Date: Sun, 13 Mar 2011 00:42:26 +0100 Subject: [PATCH 17/18] Add AVERROR_EXIT. This is different from AVERROR(EINTR) because calls that fail with EINTR should usually be restarted. Signed-off-by: Nicolas George Signed-off-by: Ronald S. Bultje --- libavutil/error.c | 1 + libavutil/error.h | 2 ++ 2 files changed, 3 insertions(+) diff --git a/libavutil/error.c b/libavutil/error.c index 5cf54aadea..93f8925d44 100644 --- a/libavutil/error.c +++ b/libavutil/error.c @@ -37,6 +37,7 @@ int av_strerror(int errnum, char *errbuf, size_t errbuf_size) case AVERROR_FILTER_NOT_FOUND: errstr = "Filter not found"; break; case AVERROR_BSF_NOT_FOUND: errstr = "Bitstream filter not found"; break; case AVERROR_STREAM_NOT_FOUND: errstr = "Stream not found"; break; + case AVERROR_EXIT: errstr = "Immediate exit requested"; break; } if (errstr) { diff --git a/libavutil/error.h b/libavutil/error.h index 290487f3d9..0d475664c7 100644 --- a/libavutil/error.h +++ b/libavutil/error.h @@ -66,6 +66,8 @@ #define AVERROR_BSF_NOT_FOUND (-MKTAG(0xF8,'B','S','F')) ///< Bitstream filter not found #define AVERROR_STREAM_NOT_FOUND (-MKTAG(0xF8,'S','T','R')) ///< Stream not found +#define AVERROR_EXIT (-MKTAG('E','X','I','T')) ///< Immediate exit was requested; the called function should not be restarted + /** * Put a description of the AVERROR code errnum in errbuf. * In case of failure the global variable errno is set to indicate the From c76374c6db5f486672f9df223f43e4892bd655c9 Mon Sep 17 00:00:00 2001 From: Nicolas George Date: Sun, 13 Mar 2011 00:42:27 +0100 Subject: [PATCH 18/18] Use AVERROR_EXIT with url_interrupt_cb. Functions interrupted by url_interrupt_cb should not be restarted. Therefore using AVERROR(EINTR) was wrong, as it did not allow to distinguish when the underlying system call was interrupted and actually needed to be restarted. This fixes roundup issues 2657 and 2659 (ffplay not exiting for streamed content). Signed-off-by: Nicolas George Signed-off-by: Ronald S. Bultje --- libavformat/applehttp.c | 2 +- libavformat/applehttpproto.c | 4 ++-- libavformat/avio.c | 2 +- libavformat/avio.h | 2 +- libavformat/rtpproto.c | 2 +- libavformat/rtsp.c | 2 +- libavformat/tcp.c | 6 ++++-- libavformat/udp.c | 2 +- libavformat/utils.c | 2 +- 9 files changed, 13 insertions(+), 11 deletions(-) diff --git a/libavformat/applehttp.c b/libavformat/applehttp.c index c1609b895d..7a3d8b0b10 100644 --- a/libavformat/applehttp.c +++ b/libavformat/applehttp.c @@ -528,7 +528,7 @@ reload: return AVERROR_EOF; while (av_gettime() - c->last_load_time < c->target_duration*1000000) { if (url_interrupt_cb()) - return AVERROR(EINTR); + return AVERROR_EXIT; usleep(100*1000); } /* Enough time has elapsed since the last reload */ diff --git a/libavformat/applehttpproto.c b/libavformat/applehttpproto.c index 83071300e8..871f2712df 100644 --- a/libavformat/applehttpproto.c +++ b/libavformat/applehttpproto.c @@ -318,7 +318,7 @@ retry: return AVERROR_EOF; while (av_gettime() - s->last_load_time < s->target_duration*1000000) { if (url_interrupt_cb()) - return AVERROR(EINTR); + return AVERROR_EXIT; usleep(100*1000); } goto retry; @@ -328,7 +328,7 @@ retry: ret = url_open(&s->seg_hd, url, URL_RDONLY); if (ret < 0) { if (url_interrupt_cb()) - return AVERROR(EINTR); + return AVERROR_EXIT; av_log(NULL, AV_LOG_WARNING, "Unable to open %s\n", url); s->cur_seq_no++; goto retry; diff --git a/libavformat/avio.c b/libavformat/avio.c index 2265549266..5dca68a50c 100644 --- a/libavformat/avio.c +++ b/libavformat/avio.c @@ -238,7 +238,7 @@ static inline int retry_transfer_wrapper(URLContext *h, unsigned char *buf, int fast_retries = FFMAX(fast_retries, 2); len += ret; if (url_interrupt_cb()) - return AVERROR(EINTR); + return AVERROR_EXIT; } return len; } diff --git a/libavformat/avio.h b/libavformat/avio.h index b8f9c588cc..761ced6aa1 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -237,7 +237,7 @@ void url_get_filename(URLContext *h, char *buf, int buf_size); /** * The callback is called in blocking functions to test regulary if - * asynchronous interruption is needed. AVERROR(EINTR) is returned + * asynchronous interruption is needed. AVERROR_EXIT is returned * in this case by the interrupted function. 'NULL' means no interrupt * callback is given. */ diff --git a/libavformat/rtpproto.c b/libavformat/rtpproto.c index 269b1b2726..bca8ab648b 100644 --- a/libavformat/rtpproto.c +++ b/libavformat/rtpproto.c @@ -241,7 +241,7 @@ static int rtp_read(URLContext *h, uint8_t *buf, int size) #else for(;;) { if (url_interrupt_cb()) - return AVERROR(EINTR); + return AVERROR_EXIT; /* build fdset to listen to RTP and RTCP packets */ n = poll(p, 2, 100); if (n > 0) { diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index a24f12bacf..f50650ed8f 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -1565,7 +1565,7 @@ static int udp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st, for (;;) { if (url_interrupt_cb()) - return AVERROR(EINTR); + return AVERROR_EXIT; if (wait_end && wait_end - av_gettime() < 0) return AVERROR(EAGAIN); max_p = 0; diff --git a/libavformat/tcp.c b/libavformat/tcp.c index b01f0b85bf..83529dfcc4 100644 --- a/libavformat/tcp.c +++ b/libavformat/tcp.c @@ -73,8 +73,10 @@ static int tcp_open(URLContext *h, const char *uri, int flags) if (ret < 0) { struct pollfd p = {fd, POLLOUT, 0}; if (ff_neterrno() == AVERROR(EINTR)) { - if (url_interrupt_cb()) + if (url_interrupt_cb()) { + ret = AVERROR_EXIT; goto fail1; + } goto redo; } if (ff_neterrno() != AVERROR(EINPROGRESS) && @@ -84,7 +86,7 @@ static int tcp_open(URLContext *h, const char *uri, int flags) /* wait until we are connected or until abort */ for(;;) { if (url_interrupt_cb()) { - ret = AVERROR(EINTR); + ret = AVERROR_EXIT; goto fail1; } ret = poll(&p, 1, 100); diff --git a/libavformat/udp.c b/libavformat/udp.c index 0196573209..76a0f35099 100644 --- a/libavformat/udp.c +++ b/libavformat/udp.c @@ -452,7 +452,7 @@ static int udp_read(URLContext *h, uint8_t *buf, int size) for(;;) { if (url_interrupt_cb()) - return AVERROR(EINTR); + return AVERROR_EXIT; ret = poll(&p, 1, 100); if (ret < 0) { if (ff_neterrno() == AVERROR(EINTR)) diff --git a/libavformat/utils.c b/libavformat/utils.c index 902a170b53..1dfaa3caf3 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2267,7 +2267,7 @@ int av_find_stream_info(AVFormatContext *ic) read_size = 0; for(;;) { if(url_interrupt_cb()){ - ret= AVERROR(EINTR); + ret= AVERROR_EXIT; av_log(ic, AV_LOG_DEBUG, "interrupted\n"); break; }