Merge remote-tracking branch 'qatar/master'
* qatar/master: fft: init functions with INIT_XMM/YMM. pcmenc: set frame_size to 0. gsm demuxer: use generic seeking instead of a gsm-specific function. gsm demuxer: return packets with only 1 gsm block at a time. avcodec: add GSM parser doc: Replace ffmpeg references in avserver config file by avconv. doc: Fix names of av_log color environment variables. Fix a bunch of platform name and other typos. Add some missing changelog entries and release 0.8_beta2 No longer build libpostproc by default wtv: fix memleaks during normal operation threads: add CODEC_CAP_AUTO_THREADS for libvpx and xavs Conflicts: Changelog RELEASE cmdutils.c configure doc/ffserver.conf doc/platform.texi ffplay.c libavcodec/Makefile libavcodec/version.h libavformat/wtv.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
		
						commit
						794006f8fe
					
				@ -13,6 +13,7 @@ version next:
 | 
			
		||||
- tinterlace video filter
 | 
			
		||||
- astreamsync audio filter
 | 
			
		||||
- amerge audio filter
 | 
			
		||||
- GSM audio parser
 | 
			
		||||
- Automatic thread count based on detection number of (available) CPU cores
 | 
			
		||||
- y41p Brooktree Uncompressed 4:1:1 12-bit encoder and decoder
 | 
			
		||||
- ffprobe -show_error option
 | 
			
		||||
@ -22,6 +23,8 @@ version next:
 | 
			
		||||
- ffprobe -show_frames option
 | 
			
		||||
- silencedetect audio filter
 | 
			
		||||
- ffprobe -show_program_version, -show_library_versions, -show_versions options
 | 
			
		||||
- rv34: frame-level multi-threading
 | 
			
		||||
- optimized iMDCT transform on x86 using SSE for for mpegaudiodec
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
version 0.9:
 | 
			
		||||
 | 
			
		||||
@ -34,7 +34,9 @@
 | 
			
		||||
#include "libavdevice/avdevice.h"
 | 
			
		||||
#include "libswscale/swscale.h"
 | 
			
		||||
#include "libswresample/swresample.h"
 | 
			
		||||
#if CONFIG_POSTPROC
 | 
			
		||||
#include "libpostproc/postprocess.h"
 | 
			
		||||
#endif
 | 
			
		||||
#include "libavutil/avstring.h"
 | 
			
		||||
#include "libavutil/mathematics.h"
 | 
			
		||||
#include "libavutil/parseutils.h"
 | 
			
		||||
@ -607,7 +609,9 @@ static void print_all_libs_info(int flags, int level)
 | 
			
		||||
    PRINT_LIB_INFO(avfilter, AVFILTER, flags, level);
 | 
			
		||||
    PRINT_LIB_INFO(swscale,  SWSCALE,  flags, level);
 | 
			
		||||
    PRINT_LIB_INFO(swresample,SWRESAMPLE,  flags, level);
 | 
			
		||||
#if CONFIG_POSTPROC
 | 
			
		||||
    PRINT_LIB_INFO(postproc, POSTPROC, flags, level);
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void print_program_info(int flags, int level)
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										2
									
								
								configure
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								configure
									
									
									
									
										vendored
									
									
								
							@ -253,7 +253,7 @@ Advanced options (experts only):
 | 
			
		||||
  --disable-armvfp         disable ARM VFP optimizations
 | 
			
		||||
  --disable-iwmmxt         disable iwmmxt optimizations
 | 
			
		||||
  --disable-mmi            disable MMI optimizations
 | 
			
		||||
  --disable-neon           disable neon optimizations
 | 
			
		||||
  --disable-neon           disable NEON optimizations
 | 
			
		||||
  --disable-vis            disable VIS optimizations
 | 
			
		||||
  --disable-yasm           disable use of yasm assembler
 | 
			
		||||
  --enable-pic             build position-independent code
 | 
			
		||||
 | 
			
		||||
@ -119,8 +119,8 @@ Set the logging level used by the library.
 | 
			
		||||
By default the program logs to stderr, if coloring is supported by the
 | 
			
		||||
terminal, colors are used to mark errors and warnings. Log coloring
 | 
			
		||||
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}.
 | 
			
		||||
@env{AV_LOG_FORCE_NOCOLOR} or @env{NO_COLOR}, or can be forced setting
 | 
			
		||||
the environment variable @env{AV_LOG_FORCE_COLOR}.
 | 
			
		||||
The use of the environment variable @env{NO_COLOR} is deprecated and
 | 
			
		||||
will be dropped in a following FFmpeg version.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -655,6 +655,7 @@ OBJS-$(CONFIG_DVBSUB_PARSER)           += dvbsub_parser.o
 | 
			
		||||
OBJS-$(CONFIG_DVDSUB_PARSER)           += dvdsub_parser.o
 | 
			
		||||
OBJS-$(CONFIG_FLAC_PARSER)             += flac_parser.o flacdata.o flac.o \
 | 
			
		||||
                                          vorbis_data.o
 | 
			
		||||
OBJS-$(CONFIG_GSM_PARSER)              += gsm_parser.o
 | 
			
		||||
OBJS-$(CONFIG_H261_PARSER)             += h261_parser.o
 | 
			
		||||
OBJS-$(CONFIG_H263_PARSER)             += h263_parser.o
 | 
			
		||||
OBJS-$(CONFIG_H264_PARSER)             += h264_parser.o h264.o            \
 | 
			
		||||
 | 
			
		||||
@ -432,6 +432,7 @@ void avcodec_register_all(void)
 | 
			
		||||
    REGISTER_PARSER  (DVBSUB, dvbsub);
 | 
			
		||||
    REGISTER_PARSER  (DVDSUB, dvdsub);
 | 
			
		||||
    REGISTER_PARSER  (FLAC, flac);
 | 
			
		||||
    REGISTER_PARSER  (GSM, gsm);
 | 
			
		||||
    REGISTER_PARSER  (H261, h261);
 | 
			
		||||
    REGISTER_PARSER  (H263, h263);
 | 
			
		||||
    REGISTER_PARSER  (H264, h264);
 | 
			
		||||
 | 
			
		||||
@ -50,7 +50,7 @@ static void decode_mb(MpegEncContext *s, int ref){
 | 
			
		||||
        h->mb_xy= s->mb_x + s->mb_y*s->mb_stride;
 | 
			
		||||
        memset(h->non_zero_count_cache, 0, sizeof(h->non_zero_count_cache));
 | 
			
		||||
        assert(ref>=0);
 | 
			
		||||
        /* FIXME: It is posible albeit uncommon that slice references
 | 
			
		||||
        /* FIXME: It is possible albeit uncommon that slice references
 | 
			
		||||
         * differ between slices. We take the easy approach and ignore
 | 
			
		||||
         * it for now. If this turns out to have any relevance in
 | 
			
		||||
         * practice then correct remapping should be added. */
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										31
									
								
								libavcodec/gsm.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								libavcodec/gsm.h
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,31 @@
 | 
			
		||||
/*
 | 
			
		||||
 * GSM common header
 | 
			
		||||
 *
 | 
			
		||||
 * This file is part of Libav.
 | 
			
		||||
 *
 | 
			
		||||
 * Libav 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.
 | 
			
		||||
 *
 | 
			
		||||
 * Libav 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 Libav; if not, write to the Free Software
 | 
			
		||||
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef AVCODEC_GSM_H
 | 
			
		||||
#define AVCODEC_GSM_H
 | 
			
		||||
 | 
			
		||||
/* bytes per block */
 | 
			
		||||
#define GSM_BLOCK_SIZE    33
 | 
			
		||||
#define GSM_MS_BLOCK_SIZE 65
 | 
			
		||||
 | 
			
		||||
/* samples per block */
 | 
			
		||||
#define GSM_FRAME_SIZE 160
 | 
			
		||||
 | 
			
		||||
#endif /* AVCODEC_GSM_H */
 | 
			
		||||
							
								
								
									
										79
									
								
								libavcodec/gsm_parser.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										79
									
								
								libavcodec/gsm_parser.c
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,79 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (c) 2012  Justin Ruggles
 | 
			
		||||
 *
 | 
			
		||||
 * This file is part of Libav.
 | 
			
		||||
 *
 | 
			
		||||
 * Libav 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.
 | 
			
		||||
 *
 | 
			
		||||
 * Libav 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 Libav; if not, write to the Free Software
 | 
			
		||||
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @file
 | 
			
		||||
 * GSM audio parser
 | 
			
		||||
 *
 | 
			
		||||
 * Splits packets into individual blocks.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "parser.h"
 | 
			
		||||
#include "gsm.h"
 | 
			
		||||
 | 
			
		||||
typedef struct GSMParseContext {
 | 
			
		||||
    ParseContext pc;
 | 
			
		||||
    int block_size;
 | 
			
		||||
    int remaining;
 | 
			
		||||
} GSMParseContext;
 | 
			
		||||
 | 
			
		||||
static int gsm_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
 | 
			
		||||
                     const uint8_t **poutbuf, int *poutbuf_size,
 | 
			
		||||
                     const uint8_t *buf, int buf_size)
 | 
			
		||||
{
 | 
			
		||||
    GSMParseContext *s = s1->priv_data;
 | 
			
		||||
    ParseContext *pc = &s->pc;
 | 
			
		||||
    int next;
 | 
			
		||||
 | 
			
		||||
    if (!s->block_size) {
 | 
			
		||||
        switch (avctx->codec_id) {
 | 
			
		||||
        case CODEC_ID_GSM:    s->block_size = GSM_BLOCK_SIZE;    break;
 | 
			
		||||
        case CODEC_ID_GSM_MS: s->block_size = GSM_MS_BLOCK_SIZE; break;
 | 
			
		||||
        default:
 | 
			
		||||
            return AVERROR(EINVAL);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (!s->remaining)
 | 
			
		||||
        s->remaining = s->block_size;
 | 
			
		||||
    if (s->remaining <= buf_size) {
 | 
			
		||||
        next = s->remaining;
 | 
			
		||||
        s->remaining = 0;
 | 
			
		||||
    } else {
 | 
			
		||||
        next = END_NOT_FOUND;
 | 
			
		||||
        s->remaining -= buf_size;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (ff_combine_frame(pc, next, &buf, &buf_size) < 0 || !buf_size) {
 | 
			
		||||
        *poutbuf      = NULL;
 | 
			
		||||
        *poutbuf_size = 0;
 | 
			
		||||
        return buf_size;
 | 
			
		||||
    }
 | 
			
		||||
    *poutbuf      = buf;
 | 
			
		||||
    *poutbuf_size = buf_size;
 | 
			
		||||
    return next;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
AVCodecParser ff_gsm_parser = {
 | 
			
		||||
    .codec_ids      = { CODEC_ID_GSM, CODEC_ID_GSM_MS },
 | 
			
		||||
    .priv_data_size = sizeof(GSMParseContext),
 | 
			
		||||
    .parser_parse   = gsm_parse,
 | 
			
		||||
    .parser_close   = ff_parse_close,
 | 
			
		||||
};
 | 
			
		||||
@ -25,11 +25,6 @@
 | 
			
		||||
#include <stdint.h>
 | 
			
		||||
#include "avcodec.h"
 | 
			
		||||
 | 
			
		||||
// input and output sizes in byte
 | 
			
		||||
#define GSM_BLOCK_SIZE    33
 | 
			
		||||
#define GSM_MS_BLOCK_SIZE 65
 | 
			
		||||
#define GSM_FRAME_SIZE   160
 | 
			
		||||
 | 
			
		||||
typedef struct {
 | 
			
		||||
    AVFrame frame;
 | 
			
		||||
    // Contains first 120 elements from the previous frame
 | 
			
		||||
 | 
			
		||||
@ -25,6 +25,7 @@
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "get_bits.h"
 | 
			
		||||
#include "gsm.h"
 | 
			
		||||
#include "gsmdec_data.h"
 | 
			
		||||
 | 
			
		||||
static void apcm_dequant_add(GetBitContext *gb, int16_t *dst)
 | 
			
		||||
 | 
			
		||||
@ -27,13 +27,10 @@
 | 
			
		||||
 | 
			
		||||
// The idiosyncrasies of GSM-in-WAV are explained at http://kbs.cs.tu-berlin.de/~jutta/toast.html
 | 
			
		||||
 | 
			
		||||
#include "avcodec.h"
 | 
			
		||||
#include <gsm/gsm.h>
 | 
			
		||||
 | 
			
		||||
// gsm.h misses some essential constants
 | 
			
		||||
#define GSM_BLOCK_SIZE 33
 | 
			
		||||
#define GSM_MS_BLOCK_SIZE 65
 | 
			
		||||
#define GSM_FRAME_SIZE 160
 | 
			
		||||
#include "avcodec.h"
 | 
			
		||||
#include "gsm.h"
 | 
			
		||||
 | 
			
		||||
static av_cold int libgsm_encode_init(AVCodecContext *avctx) {
 | 
			
		||||
    if (avctx->channels > 1) {
 | 
			
		||||
 | 
			
		||||
@ -119,5 +119,6 @@ AVCodec ff_libvpx_decoder = {
 | 
			
		||||
    .init           = vp8_init,
 | 
			
		||||
    .close          = vp8_free,
 | 
			
		||||
    .decode         = vp8_decode,
 | 
			
		||||
    .long_name = NULL_IF_CONFIG_SMALL("libvpx VP8"),
 | 
			
		||||
    .capabilities   = CODEC_CAP_AUTO_THREADS,
 | 
			
		||||
    .long_name      = NULL_IF_CONFIG_SMALL("libvpx VP8"),
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@ -622,7 +622,7 @@ AVCodec ff_libvpx_encoder = {
 | 
			
		||||
    .init           = vp8_init,
 | 
			
		||||
    .encode         = vp8_encode,
 | 
			
		||||
    .close          = vp8_free,
 | 
			
		||||
    .capabilities   = CODEC_CAP_DELAY,
 | 
			
		||||
    .capabilities   = CODEC_CAP_DELAY | CODEC_CAP_AUTO_THREADS,
 | 
			
		||||
    .pix_fmts = (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
 | 
			
		||||
    .long_name = NULL_IF_CONFIG_SMALL("libvpx VP8"),
 | 
			
		||||
    .priv_class = &class,
 | 
			
		||||
 | 
			
		||||
@ -414,7 +414,7 @@ AVCodec ff_libxavs_encoder = {
 | 
			
		||||
    .init           = XAVS_init,
 | 
			
		||||
    .encode         = XAVS_frame,
 | 
			
		||||
    .close          = XAVS_close,
 | 
			
		||||
    .capabilities   = CODEC_CAP_DELAY,
 | 
			
		||||
    .capabilities   = CODEC_CAP_DELAY | CODEC_CAP_AUTO_THREADS,
 | 
			
		||||
    .pix_fmts       = (const enum PixelFormat[]) { PIX_FMT_YUV420P, PIX_FMT_NONE },
 | 
			
		||||
    .long_name      = NULL_IF_CONFIG_SMALL("libxavs - the Chinese Audio Video Standard Encoder"),
 | 
			
		||||
    .priv_class     = &class,
 | 
			
		||||
 | 
			
		||||
@ -22,6 +22,7 @@
 | 
			
		||||
#define BITSTREAM_READER_LE
 | 
			
		||||
#include "avcodec.h"
 | 
			
		||||
#include "msgsmdec.h"
 | 
			
		||||
#include "gsm.h"
 | 
			
		||||
#include "gsmdec_template.c"
 | 
			
		||||
 | 
			
		||||
int ff_msgsm_decode_block(AVCodecContext *avctx, int16_t *samples,
 | 
			
		||||
 | 
			
		||||
@ -1,5 +1,5 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Micrsoft RLE Video Decoder
 | 
			
		||||
 * Microsoft RLE video decoder
 | 
			
		||||
 * Copyright (C) 2003 the ffmpeg project
 | 
			
		||||
 *
 | 
			
		||||
 * This file is part of FFmpeg.
 | 
			
		||||
@ -21,7 +21,7 @@
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @file
 | 
			
		||||
 * MS RLE Video Decoder by Mike Melanson (melanson@pcisys.net)
 | 
			
		||||
 * MS RLE video decoder by Mike Melanson (melanson@pcisys.net)
 | 
			
		||||
 * For more information about the MS RLE format, visit:
 | 
			
		||||
 *   http://www.pcisys.net/~melanson/codecs/
 | 
			
		||||
 *
 | 
			
		||||
 | 
			
		||||
@ -33,7 +33,7 @@
 | 
			
		||||
 | 
			
		||||
static av_cold int pcm_encode_init(AVCodecContext *avctx)
 | 
			
		||||
{
 | 
			
		||||
    avctx->frame_size = 1;
 | 
			
		||||
    avctx->frame_size = 0;
 | 
			
		||||
    switch(avctx->codec->id) {
 | 
			
		||||
    case CODEC_ID_PCM_ALAW:
 | 
			
		||||
        pcm_alaw_tableinit();
 | 
			
		||||
 | 
			
		||||
@ -21,7 +21,7 @@
 | 
			
		||||
#define AVCODEC_VERSION_H
 | 
			
		||||
 | 
			
		||||
#define LIBAVCODEC_VERSION_MAJOR 53
 | 
			
		||||
#define LIBAVCODEC_VERSION_MINOR 54
 | 
			
		||||
#define LIBAVCODEC_VERSION_MINOR 55
 | 
			
		||||
#define LIBAVCODEC_VERSION_MICRO 100
 | 
			
		||||
 | 
			
		||||
#define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
 | 
			
		||||
 | 
			
		||||
@ -640,11 +640,14 @@ cglobal fft_dispatch%3%2, 2,5,8, z, nbits
 | 
			
		||||
%endmacro ; DECL_FFT
 | 
			
		||||
 | 
			
		||||
%ifdef HAVE_AVX
 | 
			
		||||
INIT_YMM
 | 
			
		||||
DECL_FFT 6, _avx
 | 
			
		||||
DECL_FFT 6, _avx, _interleave
 | 
			
		||||
%endif
 | 
			
		||||
INIT_XMM
 | 
			
		||||
DECL_FFT 5, _sse
 | 
			
		||||
DECL_FFT 5, _sse, _interleave
 | 
			
		||||
INIT_MMX
 | 
			
		||||
DECL_FFT 4, _3dn
 | 
			
		||||
DECL_FFT 4, _3dn, _interleave
 | 
			
		||||
DECL_FFT 4, _3dn2
 | 
			
		||||
 | 
			
		||||
@ -37,7 +37,7 @@ static int gsm_read_packet(AVFormatContext *s, AVPacket *pkt)
 | 
			
		||||
{
 | 
			
		||||
    int ret, size;
 | 
			
		||||
 | 
			
		||||
    size = GSM_BLOCK_SIZE * 32;
 | 
			
		||||
    size = GSM_BLOCK_SIZE;
 | 
			
		||||
 | 
			
		||||
    pkt->pos = avio_tell(s->pb);
 | 
			
		||||
    pkt->stream_index = 0;
 | 
			
		||||
@ -48,7 +48,7 @@ static int gsm_read_packet(AVFormatContext *s, AVPacket *pkt)
 | 
			
		||||
        return ret < 0 ? ret : AVERROR(EIO);
 | 
			
		||||
    }
 | 
			
		||||
    pkt->size     = ret;
 | 
			
		||||
    pkt->duration = ret      / GSM_BLOCK_SIZE;
 | 
			
		||||
    pkt->duration = 1;
 | 
			
		||||
    pkt->pts      = pkt->pos / GSM_BLOCK_SIZE;
 | 
			
		||||
 | 
			
		||||
    return 0;
 | 
			
		||||
@ -65,7 +65,6 @@ static int gsm_read_header(AVFormatContext *s, AVFormatParameters *ap)
 | 
			
		||||
    st->codec->codec_id    = s->iformat->value;
 | 
			
		||||
    st->codec->channels    = 1;
 | 
			
		||||
    st->codec->sample_rate = c->sample_rate;
 | 
			
		||||
    st->codec->block_align = GSM_BLOCK_SIZE;
 | 
			
		||||
    st->codec->bit_rate    = GSM_BLOCK_SIZE * 8 * c->sample_rate / GSM_BLOCK_SAMPLES;
 | 
			
		||||
 | 
			
		||||
    avpriv_set_pts_info(st, 64, GSM_BLOCK_SAMPLES, GSM_SAMPLE_RATE);
 | 
			
		||||
@ -73,39 +72,6 @@ static int gsm_read_header(AVFormatContext *s, AVFormatParameters *ap)
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int gsm_read_seek2(AVFormatContext *s, int stream_index, int64_t min_ts,
 | 
			
		||||
                          int64_t ts, int64_t max_ts, int flags)
 | 
			
		||||
{
 | 
			
		||||
    GSMDemuxerContext *c = s->priv_data;
 | 
			
		||||
 | 
			
		||||
    /* convert timestamps to file positions */
 | 
			
		||||
    if (!(flags & AVSEEK_FLAG_BYTE)) {
 | 
			
		||||
        if (stream_index < 0) {
 | 
			
		||||
            AVRational bitrate_q = { GSM_BLOCK_SAMPLES, c->sample_rate * GSM_BLOCK_SIZE };
 | 
			
		||||
            ts     = av_rescale_q(ts,     AV_TIME_BASE_Q, bitrate_q);
 | 
			
		||||
            min_ts = av_rescale_q(min_ts, AV_TIME_BASE_Q, bitrate_q);
 | 
			
		||||
            max_ts = av_rescale_q(max_ts, AV_TIME_BASE_Q, bitrate_q);
 | 
			
		||||
        } else {
 | 
			
		||||
            ts     *= GSM_BLOCK_SIZE;
 | 
			
		||||
            min_ts *= GSM_BLOCK_SIZE;
 | 
			
		||||
            max_ts *= GSM_BLOCK_SIZE;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    /* round to nearest block boundary */
 | 
			
		||||
    ts = (ts + GSM_BLOCK_SIZE / 2) / GSM_BLOCK_SIZE * GSM_BLOCK_SIZE;
 | 
			
		||||
    ts = FFMAX(0, ts);
 | 
			
		||||
 | 
			
		||||
    /* handle min/max */
 | 
			
		||||
    while (ts < min_ts)
 | 
			
		||||
        ts += GSM_BLOCK_SIZE;
 | 
			
		||||
    while (ts > max_ts)
 | 
			
		||||
        ts -= GSM_BLOCK_SIZE;
 | 
			
		||||
    if (ts < min_ts || ts > max_ts)
 | 
			
		||||
        return -1;
 | 
			
		||||
 | 
			
		||||
    return avio_seek(s->pb, ts, SEEK_SET);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static const AVOption options[] = {
 | 
			
		||||
    { "sample_rate", "", offsetof(GSMDemuxerContext, sample_rate),
 | 
			
		||||
       AV_OPT_TYPE_INT, {.dbl = GSM_SAMPLE_RATE}, 1, INT_MAX / GSM_BLOCK_SIZE,
 | 
			
		||||
@ -126,7 +92,7 @@ AVInputFormat ff_gsm_demuxer = {
 | 
			
		||||
    .priv_data_size = sizeof(GSMDemuxerContext),
 | 
			
		||||
    .read_header    = gsm_read_header,
 | 
			
		||||
    .read_packet    = gsm_read_packet,
 | 
			
		||||
    .read_seek2     = gsm_read_seek2,
 | 
			
		||||
    .flags          = AVFMT_GENERIC_INDEX,
 | 
			
		||||
    .extensions     = "gsm",
 | 
			
		||||
    .value          = CODEC_ID_GSM,
 | 
			
		||||
    .priv_class     = &class,
 | 
			
		||||
 | 
			
		||||
@ -1022,6 +1022,7 @@ static int read_seek(AVFormatContext *s, int stream_index,
 | 
			
		||||
static int read_close(AVFormatContext *s)
 | 
			
		||||
{
 | 
			
		||||
    WtvContext *wtv = s->priv_data;
 | 
			
		||||
    av_freep(&wtv->index_entries);
 | 
			
		||||
    wtvfile_close(wtv->pb);
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -67,7 +67,7 @@ $EGREP $OPT '^\+ *(const *|)static' $*| $EGREP --color=always '[^=]= *(0|NULL)[^
 | 
			
		||||
cat $TMP
 | 
			
		||||
hiegrep '# *ifdef * (HAVE|CONFIG)_' 'ifdefs that should be #if' $*
 | 
			
		||||
 | 
			
		||||
hiegrep '\b(awnser|cant|dont|wont|usefull|successfull|occured|teh|alot|wether|skiped|heigth|informations|colums|loosy|loosing|seperate|preceed|upto|paket)\b' 'common typos' $*
 | 
			
		||||
hiegrep '\b(awnser|cant|dont|wont|usefull|successfull|occured|teh|alot|wether|skiped|heigth|informations|colums|loosy|loosing|seperate|preceed|upto|paket|posible)\b' 'common typos' $*
 | 
			
		||||
 | 
			
		||||
hiegrep 'av_log\( *NULL' 'Missing context in av_log' $*
 | 
			
		||||
hiegrep '[^sn]printf' 'Please use av_log' $*
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user