Commit 5380fee3 authored by Alexander Strange's avatar Alexander Strange

Merge mainline.

parents ef2d8664 08c0efd4
......@@ -89,6 +89,7 @@ version 0.6:
- 35% faster VP3/Theora decoding
- faster AAC decoding
- faster H.264 decoding
- RealAudio 1.0 (14.4K) encoder
......
......@@ -331,7 +331,6 @@ Alpha Mans Rullgard, Falk Hueffner
ARM Mans Rullgard
AVR32 Mans Rullgard
MIPS Mans Rullgard
BeOS Francois Revol
Mac OS X / PowerPC Romain Dolbeau, Guillaume Poirier
Amiga / PowerPC Colin Ward
Linux / PowerPC Luca Barbato
......
......@@ -36,6 +36,7 @@
#include "libpostproc/postprocess.h"
#include "libavutil/avstring.h"
#include "libavutil/pixdesc.h"
#include "libavutil/eval.h"
#include "libavcodec/opt.h"
#include "cmdutils.h"
#include "version.h"
......@@ -58,7 +59,7 @@ double parse_number_or_die(const char *context, const char *numstr, int type, do
{
char *tail;
const char *error;
double d = strtod(numstr, &tail);
double d = av_strtod(numstr, &tail);
if (*tail)
error= "Expected number for %s but found: %s\n";
else if (d < min || d > max)
......
......@@ -115,7 +115,6 @@ Configuration options:
--enable-runtime-cpudetect detect cpu capabilities at runtime (bigger binary)
--enable-hardcoded-tables use hardcoded tables instead of runtime generation
--enable-memalign-hack emulate memalign, interferes with memory debuggers
--enable-beos-netserver enable BeOS netserver
--disable-everything disable all components listed below
--disable-encoder=NAME disable encoder NAME
--enable-encoder=NAME enable encoder NAME
......@@ -894,7 +893,6 @@ CONFIG_LIST="
avfilter_lavf
avformat
avisynth
beos_netserver
bzlib
dct
doc
......@@ -1272,6 +1270,7 @@ png_decoder_select="zlib"
png_encoder_select="zlib"
qcelp_decoder_select="lsp"
qdm2_decoder_select="mdct rdft"
real_144_encoder_select="lpc"
rv10_decoder_select="h263_decoder"
rv10_encoder_select="h263_encoder"
rv20_decoder_select="h263_decoder"
......@@ -1389,10 +1388,6 @@ alsa_indev_deps="alsa_asoundlib_h snd_pcm_htimestamp"
alsa_indev_extralibs="-lasound"
alsa_outdev_deps="alsa_asoundlib_h"
alsa_outdev_extralibs="-lasound"
audio_beos_indev_deps="audio_beos"
audio_beos_indev_extralibs="-lmedia -lbe"
audio_beos_outdev_deps="audio_beos"
audio_beos_outdev_extralibs="-lmedia -lbe"
bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
dv1394_indev_deps="dv1394 dv_demuxer"
jack_indev_deps="jack_jack_h"
......@@ -2127,30 +2122,10 @@ enabled spic && enable pic
# OS specific
case $target_os in
beos|haiku|zeta)
prefix_default="$HOME/config"
# 3 gcc releases known for BeOS, each with ugly bugs
gcc_version="$($cc -v 2>&1 | grep version | cut -d ' ' -f3-)"
case "$gcc_version" in
2.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc"
disable mmx
;;
*20010315*) echo "BeBits gcc"
add_cflags -fno-expensive-optimizations
;;
esac
SHFLAGS=-nostart
# enable BeOS things
enable audio_beos
# no need for libm, but the inet stuff
# Check for BONE
# XXX: actually should check for NOT net_server
if echo $BEINCLUDES | grep -q 'headers/be/bone'; then
network_extralibs="-lbind -lsocket"
else
enable beos_netserver
network_extralibs="-lnet"
fi ;;
haiku)
prefix_default="/boot/common"
network_extralibs="-lnetwork"
;;
sunos)
FFSERVERLDFLAGS=""
SHFLAGS='-shared -Wl,-h,$$(@F)'
......
......@@ -12,6 +12,9 @@ libavutil: 2009-03-08
API changes, most recent first:
2010-06-09 - r23551 - lavu 50.19.0 - av_compare_mod()
Add av_compare_mod() to libavutil/mathematics.h.
2010-06-05 - r23485 - lavu 50.18.0 - eval API
Make the eval API public.
......
......@@ -29,14 +29,6 @@ Michael's TODO list: (unordered) (if anyone wanna help with sth, just ask)
- more optimizations
- simper rate control
Francois' TODO list: (unordered, without any timeframe)
-------------------
- test MACE decoder against the openquicktime one as suggested by A'rpi
- BeOS audio input grabbing backend
- BeOS video input grabbing backend
- publish my BeOS libposix on BeBits so I can officially support ffserver :)
- check the whole code for thread-safety (global and init stuff)
Philip'a TODO list: (alphabetically ordered) (please help)
------------------
- Add a multi-ffm filetype so that feeds can be recorded into multiple files rather
......
......@@ -7,6 +7,16 @@
@sp 3
@end titlepage
@chapter Synopsis
The generic syntax is:
@example
@c man begin SYNOPSIS
ffmpeg [[infile options][@option{-i} @var{infile}]]... @{[outfile options] @var{outfile}@}...
@c man end
@end example
@chapter Description
@c man begin DESCRIPTION
......@@ -50,18 +60,7 @@ specified for the inputs.
@c man end DESCRIPTION
@chapter Invocation
@section Syntax
The generic syntax is:
@example
@c man begin SYNOPSIS
ffmpeg [[infile options][@option{-i} @var{infile}]]... @{[outfile options] @var{outfile}@}...
@c man end
@end example
@chapter Options
@c man begin OPTIONS
@include fftools-common-opts.texi
......
......@@ -7,6 +7,13 @@
@sp 3
@end titlepage
@chapter Synopsis
@example
@c man begin SYNOPSIS
ffplay [options] @file{input_file}
@c man end
@end example
@chapter Description
@c man begin DESCRIPTION
......@@ -16,15 +23,7 @@ libraries and the SDL library. It is mostly used as a testbed for the
various FFmpeg APIs.
@c man end
@chapter Invocation
@section Syntax
@example
@c man begin SYNOPSIS
ffplay [options] @file{input_file}
@c man end
@end example
@chapter Options
@c man begin OPTIONS
@include fftools-common-opts.texi
......
......@@ -7,6 +7,16 @@
@sp 3
@end titlepage
@chapter Synopsis
The generic syntax is:
@example
@c man begin SYNOPSIS
ffprobe [options] [@file{input_file}]
@c man end
@end example
@chapter Description
@c man begin DESCRIPTION
......@@ -45,18 +55,7 @@ are prefixed by the string ``TAG:''.
@c man end
@chapter Invocation
@section Syntax
The generic syntax is:
@example
@c man begin SYNOPSIS
ffprobe [options] [@file{input_file}]
@c man end
@end example
@chapter Options
@c man begin OPTIONS
@include fftools-common-opts.texi
......
......@@ -7,6 +7,15 @@
@sp 3
@end titlepage
@chapter Synopsys
The generic syntax is:
@example
@c man begin SYNOPSIS
ffserver [options]
@c man end
@end example
@chapter Description
@c man begin DESCRIPTION
......@@ -226,15 +235,7 @@ You use this by adding the ?date= to the end of the URL for the stream.
For example: @samp{http://localhost:8080/test.asf?date=2002-07-26T23:05:00}.
@c man end
@chapter Invocation
@section Syntax
@example
@c man begin SYNOPSIS
ffserver [options]
@c man end
@end example
@section Options
@chapter Options
@c man begin OPTIONS
@include fftools-common-opts.texi
......
All the numerical options, if not specified otherwise, accept in input
a string representing a number, which may contain one of the
International System number postfixes, for example 'K', 'M', 'G'.
If 'i' is appended after the postfix, powers of 2 are used instead of
powers of 10. The 'B' postfix multiplies the value for 8, and can be
appended after another postfix or used alone. This allows using for
example 'KB', 'MiB', 'G' and 'B' as postfix.
@section Generic options
These options are shared amongst the ff* tools.
......
......@@ -635,7 +635,7 @@ following image formats are supported:
@item QCELP / PureVoice @tab @tab X
@item QDesign Music Codec 2 @tab @tab X
@tab There are still some distortions.
@item RealAudio 1.0 (14.4K) @tab @tab X
@item RealAudio 1.0 (14.4K) @tab X @tab X
@tab Real 14400 bit/s codec
@item RealAudio 2.0 (28.8K) @tab @tab X
@tab Real 28800 bit/s codec
......@@ -708,7 +708,6 @@ performance on systems without hardware floating point support).
@multitable @columnfractions .4 .1 .1
@item Name @tab Input @tab Output
@item ALSA @tab X @tab X
@item BEOS audio @tab X @tab X
@item BKTR @tab X @tab
@item DV1394 @tab X @tab
@item JACK @tab X @tab
......@@ -725,10 +724,6 @@ performance on systems without hardware floating point support).
@chapter Platform Specific information
@section BeOS
BeOS support is broken in mysterious ways.
@section DOS
Using a cross-compiler is preferred for various reasons.
......
......@@ -26,6 +26,7 @@
$output = 0;
$skipping = 0;
%sects = ();
@sects_sequence = ();
$section = "";
@icstack = ();
@endwstack = ();
......@@ -99,15 +100,21 @@ while(<$inf>) {
next;
};
/^\@include\s+(.+)$/ and do {
push @instack, $inf;
$inf = gensym();
# Try cwd and $ibase.
open($inf, "<" . $1)
or open($inf, "<" . $ibase . "/" . $1)
or die "cannot open $1 or $ibase/$1: $!\n";
next;
};
# Look for blocks surrounded by @c man begin SECTION ... @c man end.
# This really oughta be @ifman ... @end ifman and the like, but such
# would require rev'ing all other Texinfo translators.
/^\@c\s+man\s+begin\s+([A-Z]+)\s+([A-Za-z0-9-]+)/ and do {
$output = 1 if exists $defs{$2};
$sect = $1;
next;
};
/^\@c\s+man\s+begin\s+([A-Z]+)/ and $sect = $1, $output = 1, next;
/^\@c\s+man\s+begin\s+([A-Za-z ]+)/ and $sect = $1, push (@sects_sequence, $sect), $output = 1, next;
/^\@c\s+man\s+end/ and do {
$sects{$sect} = "" unless exists $sects{$sect};
$sects{$sect} .= postprocess($section);
......@@ -224,17 +231,6 @@ while(<$inf>) {
# Single line command handlers.
/^\@include\s+(.+)$/ and do {
push @instack, $inf;
$inf = gensym();
# Try cwd and $ibase.
open($inf, "<" . $1)
or open($inf, "<" . $ibase . "/" . $1)
or die "cannot open $1 or $ibase/$1: $!\n";
next;
};
/^\@(?:section|unnumbered|unnumberedsec|center)\s+(.+)$/
and $_ = "\n=head2 $1\n";
/^\@subsection\s+(.+)$/
......@@ -303,8 +299,8 @@ die "No filename or title\n" unless defined $fn && defined $tl;
$sects{NAME} = "$fn \- $tl\n";
$sects{FOOTNOTES} .= "=back\n" if exists $sects{FOOTNOTES};
for $sect (qw(NAME SYNOPSIS DESCRIPTION OPTIONS EXAMPLES ENVIRONMENT FILES
BUGS NOTES FOOTNOTES SEEALSO AUTHORS COPYRIGHT)) {
unshift @sects_sequence, "NAME";
for $sect (@sects_sequence) {
if(exists $sects{$sect}) {
$head = $sect;
$head =~ s/SEEALSO/SEE ALSO/;
......
......@@ -540,10 +540,6 @@ static void term_init(void)
#ifdef SIGXCPU
signal(SIGXCPU, sigterm_handler);
#endif
#if CONFIG_BEOS_NETSERVER
fcntl(0, F_SETFL, fcntl(0, F_GETFL) | O_NONBLOCK);
#endif
}
/* read a key without blocking */
......@@ -552,7 +548,6 @@ static int read_key(void)
#if HAVE_TERMIOS_H
int n = 1;
unsigned char ch;
#if !CONFIG_BEOS_NETSERVER
struct timeval tv;
fd_set rfds;
......@@ -561,7 +556,6 @@ static int read_key(void)
tv.tv_sec = 0;
tv.tv_usec = 0;
n = select(1, &rfds, NULL, NULL, &tv);
#endif
if (n > 0) {
n = read(0, &ch, 1);
if (n == 1)
......@@ -814,6 +808,7 @@ need_realloc:
audio_buf_size= (allocated_for_size + isize*dec->channels - 1) / (isize*dec->channels);
audio_buf_size= (audio_buf_size*enc->sample_rate + dec->sample_rate) / dec->sample_rate;
audio_buf_size= audio_buf_size*2 + 10000; //safety factors for the deprecated resampling API
audio_buf_size= FFMAX(audio_buf_size, enc->frame_size);
audio_buf_size*= osize*enc->channels;
audio_out_size= FFMAX(audio_buf_size, enc->frame_size * osize * enc->channels);
......@@ -1833,17 +1828,17 @@ static int output_packet(AVInputStream *ist, int ist_index,
int osize = av_get_bits_per_sample_format(enc->sample_fmt) >> 3;
int fs_tmp = enc->frame_size;
av_fifo_generic_read(ost->fifo, samples, fifo_bytes, NULL);
av_fifo_generic_read(ost->fifo, audio_buf, fifo_bytes, NULL);
if (enc->codec->capabilities & CODEC_CAP_SMALL_LAST_FRAME) {
enc->frame_size = fifo_bytes / (osize * enc->channels);
} else { /* pad */
int frame_bytes = enc->frame_size*osize*enc->channels;
if (samples_size < frame_bytes)
if (allocated_audio_buf_size < frame_bytes)
av_exit(1);
memset((uint8_t*)samples+fifo_bytes, 0, frame_bytes - fifo_bytes);
memset(audio_buf+fifo_bytes, 0, frame_bytes - fifo_bytes);
}
ret = avcodec_encode_audio(enc, bit_buffer, bit_buffer_size, samples);
ret = avcodec_encode_audio(enc, bit_buffer, bit_buffer_size, (short *)audio_buf);
pkt.duration = av_rescale((int64_t)enc->frame_size*ost->st->time_base.den,
ost->st->time_base.num, enc->sample_rate);
enc->frame_size = fs_tmp;
......
......@@ -281,7 +281,8 @@ OBJS-$(CONFIG_QPEG_DECODER) += qpeg.o
OBJS-$(CONFIG_QTRLE_DECODER) += qtrle.o
OBJS-$(CONFIG_QTRLE_ENCODER) += qtrleenc.o
OBJS-$(CONFIG_R210_DECODER) += r210dec.o
OBJS-$(CONFIG_RA_144_DECODER) += ra144.o celp_filters.o
OBJS-$(CONFIG_RA_144_DECODER) += ra144dec.o ra144.o celp_filters.o
OBJS-$(CONFIG_RA_144_ENCODER) += ra144enc.o ra144.o celp_filters.o
OBJS-$(CONFIG_RA_288_DECODER) += ra288.o celp_math.o celp_filters.o
OBJS-$(CONFIG_RAWVIDEO_DECODER) += rawdec.o
OBJS-$(CONFIG_RAWVIDEO_ENCODER) += rawenc.o
......
......@@ -247,7 +247,7 @@ void avcodec_register_all(void)
REGISTER_ENCDEC (NELLYMOSER, nellymoser);
REGISTER_DECODER (QCELP, qcelp);
REGISTER_DECODER (QDM2, qdm2);
REGISTER_DECODER (RA_144, ra_144);
REGISTER_ENCDEC (RA_144, ra_144);
REGISTER_DECODER (RA_288, ra_288);
REGISTER_DECODER (SHORTEN, shorten);
REGISTER_DECODER (SIPR, sipr);
......
......@@ -30,7 +30,7 @@
#include "libavutil/avutil.h"
#define LIBAVCODEC_VERSION_MAJOR 52
#define LIBAVCODEC_VERSION_MINOR 76
#define LIBAVCODEC_VERSION_MINOR 77
#define LIBAVCODEC_VERSION_MICRO 0
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
......@@ -1138,8 +1138,10 @@ typedef struct AVCodecContext {
/**
* Pixel format, see PIX_FMT_xxx.
* May be set by the demuxer if known from headers.
* May be overriden by the decoder if it knows better.
* - encoding: Set by user.
* - decoding: Set by libavcodec.
* - decoding: Set by user if known, overridden by libavcodec if known
*/
enum PixelFormat pix_fmt;
......
......@@ -25,27 +25,32 @@
typedef struct H264BSFContext {
uint8_t length_size;
uint8_t first_idr;
uint8_t *sps_pps_data;
uint32_t size;
int extradata_parsed;
} H264BSFContext;
static void alloc_and_copy(uint8_t **poutbuf, int *poutbuf_size,
const uint8_t *sps_pps, uint32_t sps_pps_size,
const uint8_t *in, uint32_t in_size) {
static int alloc_and_copy(uint8_t **poutbuf, int *poutbuf_size,
const uint8_t *sps_pps, uint32_t sps_pps_size,
const uint8_t *in, uint32_t in_size) {
uint32_t offset = *poutbuf_size;
uint8_t nal_header_size = offset ? 3 : 4;
void *tmp;
*poutbuf_size += sps_pps_size+in_size+nal_header_size;
*poutbuf = av_realloc(*poutbuf, *poutbuf_size);
tmp = av_realloc(*poutbuf, *poutbuf_size);
if (!tmp)
return AVERROR(ENOMEM);
*poutbuf = tmp;
if (sps_pps)
memcpy(*poutbuf+offset, sps_pps, sps_pps_size);
memcpy(*poutbuf+sps_pps_size+nal_header_size+offset, in, in_size);
if (!offset)
if (!offset) {
AV_WB32(*poutbuf+sps_pps_size, 1);
else {
} else {
(*poutbuf+offset+sps_pps_size)[0] = (*poutbuf+offset+sps_pps_size)[1] = 0;
(*poutbuf+offset+sps_pps_size)[2] = 1;
}
return 0;
}
static int h264_mp4toannexb_filter(AVBitStreamFilterContext *bsfc,
......@@ -67,9 +72,9 @@ static int h264_mp4toannexb_filter(AVBitStreamFilterContext *bsfc,
}
/* retrieve sps and pps NAL units from extradata */
if (!ctx->sps_pps_data) {
if (!ctx->extradata_parsed) {
uint16_t unit_size;
uint32_t total_size = 0;
uint64_t total_size = 0;
uint8_t *out = NULL, unit_nb, sps_done = 0;
const uint8_t *extradata = avctx->extradata+4;
static const uint8_t nalu_header[4] = {0, 0, 0, 1};
......@@ -86,15 +91,21 @@ static int h264_mp4toannexb_filter(AVBitStreamFilterContext *bsfc,
sps_done++;
}
while (unit_nb--) {
void *tmp;
unit_size = AV_RB16(extradata);
total_size += unit_size+4;
if (extradata+2+unit_size > avctx->extradata+avctx->extradata_size) {
if (total_size > INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE ||
extradata+2+unit_size > avctx->extradata+avctx->extradata_size) {
av_free(out);
return AVERROR(EINVAL);
}
out = av_realloc(out, total_size);
if (!out)
tmp = av_realloc(out, total_size + FF_INPUT_BUFFER_PADDING_SIZE);
if (!tmp) {
av_free(out);
return AVERROR(ENOMEM);
}
out = tmp;
memcpy(out+total_size-unit_size-4, nalu_header, 4);
memcpy(out+total_size-unit_size, extradata+2, unit_size);
extradata += 2+unit_size;
......@@ -103,9 +114,12 @@ static int h264_mp4toannexb_filter(AVBitStreamFilterContext *bsfc,
unit_nb = *extradata++; /* number of pps unit(s) */
}
ctx->sps_pps_data = out;
ctx->size = total_size;
ctx->first_idr = 1;
memset(out + total_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
av_free(avctx->extradata);
avctx->extradata = out;
avctx->extradata_size = total_size;
ctx->first_idr = 1;
ctx->extradata_parsed = 1;
}
*poutbuf_size = 0;
......@@ -114,11 +128,11 @@ static int h264_mp4toannexb_filter(AVBitStreamFilterContext *bsfc,
if (buf + ctx->length_size > buf_end)
goto fail;
if (ctx->length_size == 1)
if (ctx->length_size == 1) {
nal_size = buf[0];
else if (ctx->length_size == 2)
} else if (ctx->length_size == 2) {
nal_size = AV_RB16(buf);
else
} else
nal_size = AV_RB32(buf);
buf += ctx->length_size;
......@@ -129,15 +143,16 @@ static int h264_mp4toannexb_filter(AVBitStreamFilterContext *bsfc,
/* prepend only to the first type 5 NAL unit of an IDR picture */
if (ctx->first_idr && unit_type == 5) {
alloc_and_copy(poutbuf, poutbuf_size,
ctx->sps_pps_data, ctx->size,
buf, nal_size);
if (alloc_and_copy(poutbuf, poutbuf_size,
avctx->extradata, avctx->extradata_size,
buf, nal_size) < 0)
goto fail;
ctx->first_idr = 0;
}
else {
alloc_and_copy(poutbuf, poutbuf_size,
NULL, 0,
buf, nal_size);
} else {
if (alloc_and_copy(poutbuf, poutbuf_size,
NULL, 0,
buf, nal_size) < 0)
goto fail;
if (!ctx->first_idr && unit_type == 1)
ctx->first_idr = 1;
}
......@@ -154,16 +169,9 @@ fail:
return AVERROR(EINVAL);
}
static void h264_mp4toannexb_close(AVBitStreamFilterContext *bsfc)
{
H264BSFContext *ctx = bsfc->priv_data;
av_freep(&ctx->sps_pps_data);
}
AVBitStreamFilter h264_mp4toannexb_bsf = {
"h264_mp4toannexb",
sizeof(H264BSFContext),
h264_mp4toannexb_filter,
h264_mp4toannexb_close,
};
......@@ -90,7 +90,8 @@ typedef struct {
*/
static int decode_gop_header(IVI5DecContext *ctx, AVCodecContext *avctx)
{
int result, i, p, tile_size, pic_size_indx, mb_size, blk_size, blk_size_changed = 0;
int result, i, p, tile_size, pic_size_indx, mb_size, blk_size;
int quant_mat, blk_size_changed = 0;
IVIBandDesc *band, *band1, *band2;
IVIPicConfig pic_conf;
......@@ -212,9 +213,21 @@ static int decode_gop_header(IVI5DecContext *ctx, AVCodecContext *avctx)
/* select dequant matrix according to plane and band number */
if (!p) {
band->quant_mat = (pic_conf.luma_bands > 1) ? i+1 : 0;
quant_mat = (pic_conf.luma_bands > 1) ? i+1 : 0;
} else {
band->quant_mat = 5;
quant_mat = 5;
}
if (band->blk_size == 8) {
band->intra_base = &ivi5_base_quant_8x8_intra[quant_mat][0];
band->inter_base = &ivi5_base_quant_8x8_inter[quant_mat][0];
band->intra_scale = &ivi5_scale_quant_8x8_intra[quant_mat][0];
band->inter_scale = &ivi5_scale_quant_8x8_inter[quant_mat][0];
} else {
band->intra_base = ivi5_base_quant_4x4_intra;
band->inter_base = ivi5_base_quant_4x4_inter;
band->intra_scale = ivi5_scale_quant_4x4_intra;
band->inter_scale = ivi5_scale_quant_4x4_inter;
}
if (get_bits(&ctx->gb, 2)) {
......@@ -234,7 +247,10 @@ static int decode_gop_header(IVI5DecContext *ctx, AVCodecContext *avctx)
band2->mb_size = band1->mb_size;
band2->blk_size = band1->blk_size;
band2->is_halfpel = band1->is_halfpel;
band2->quant_mat = band1->quant_mat;
band2->intra_base = band1->intra_base;
band2->inter_base = band1->inter_base;
band2->intra_scale = band1->intra_scale;
band2->inter_scale = band1->inter_scale;
band2->scan = band1->scan;
band2->inv_transform = band1->inv_transform;
band2->dc_transform = band1->dc_transform;
......@@ -570,18 +586,6 @@ static int decode_band(IVI5DecContext *ctx, int plane_num,
return -1;
}
if (band->blk_size == 8) {
band->intra_base = &ivi5_base_quant_8x8_intra[band->quant_mat][0];
band->inter_base = &ivi5_base_quant_8x8_inter[band->quant_mat][0];
band->intra_scale = &ivi5_scale_quant_8x8_intra[band->quant_mat][0];
band->inter_scale = &ivi5_scale_quant_8x8_inter[band->quant_mat][0];
} else {
band->intra_base = ivi5_base_quant_4x4_intra;
band->inter_base = ivi5_base_quant_4x4_inter;
band->intra_scale = ivi5_scale_quant_4x4_intra;
band->inter_scale = ivi5_scale_quant_4x4_inter;
}
band->rv_map = &ctx->rvmap_tabs[band->rvmap_sel];
/* apply corrections to the selected rvmap table if present */
......@@ -646,9 +650,8 @@ static int decode_band(IVI5DecContext *ctx, int plane_num,
* Switches buffers.
*
* @param ctx [in,out] ptr to the decoder context
* @param avctx [in] ptr to the AVCodecContext
*/
static void switch_buffers(IVI5DecContext *ctx, AVCodecContext *avctx)
static void switch_buffers(IVI5DecContext *ctx)
{
switch (ctx->prev_frame_type) {
case FRAMETYPE_INTRA:
......@@ -752,7 +755,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
return -1;
}
switch_buffers(ctx, avctx);
switch_buffers(ctx);
//START_TIMER;
......
......@@ -364,6 +364,8 @@ int ff_ivi_decode_blocks(GetBitContext *gb, IVIBandDesc *band, IVITile *tile)
base_tab = is_intra ? band->intra_base : band->inter_base;
scale_tab = is_intra ? band->intra_scale : band->inter_scale;
if (scale_tab)
quant = scale_tab[quant];
if (!is_intra) {
mv_x = mb->mv_x;
......@@ -415,7 +417,7 @@ int ff_ivi_decode_blocks(GetBitContext *gb, IVIBandDesc *band, IVITile *tile)
if (IVI_DEBUG && !val)
av_log(NULL, AV_LOG_ERROR, "Val = 0 encountered!\n");
q = (base_tab[pos] * scale_tab[quant]) >> 9;
q = (base_tab[pos] * quant) >> 9;
if (q > 1)
val = val * q + FFSIGN(val) * (((q ^ 1) - 1) >> 1);
trvec[pos] = val;
......
......@@ -75,6 +75,13 @@ extern const uint8_t ff_ivi_horizontal_scan_8x8[64];
extern const uint8_t ff_ivi_direct_scan_4x4[16];
/**
* Declare inverse transform function types
*/
typedef void (InvTransformPtr)(const int32_t *in, int16_t *out, uint32_t pitch, const uint8_t *flags);
typedef void (DCTransformPtr) (const int32_t *in, int16_t *out, uint32_t pitch, int blk_size);
/**
* run-value (RLE) table descriptor
*/
......@@ -152,8 +159,8 @@ typedef struct {
RVMapDesc *rv_map; ///< ptr to the RLE table for this band
int num_tiles; ///< number of tiles in this band
IVITile *tiles; ///< array of tile descriptors
void (*inv_transform)(const int32_t *in, int16_t *out, uint32_t pitch, const uint8_t *flags); ///< inverse transform function pointer
void (*dc_transform) (const int32_t *in, int16_t *out, uint32_t pitch, int blk_size); ///< dc transform function pointer, it may be NULL
InvTransformPtr *inv_transform;
DCTransformPtr *dc_transform;
int is_2d_trans; ///< 1 indicates that the two-dimensional inverse transform is used
int32_t checksum; ///< for debug purposes
int checksum_present;
......
......@@ -227,6 +227,10 @@ static av_cold int pcm_decode_init(AVCodecContext * avctx)
}
avctx->sample_fmt = avctx->codec->sample_fmts[0];
if (avctx->sample_fmt == SAMPLE_FMT_S32)
avctx->bits_per_raw_sample = av_get_bits_per_sample(avctx->codec->id);
return 0;
}
......
This diff is collapsed.
This diff is collapsed.
/*
* Real Audio 1.0 (14.4K)
*
* Copyright (c) 2008 Vitor Sessak
* Copyright (c) 2003 Nick Kurshev
* Based on public domain decoder at http://www.honeypot.net/audio
*
* 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
*/
#include "libavutil/intmath.h"
#include "avcodec.h"
#include "get_bits.h"
#include "ra144.h"
static av_cold int ra144_decode_init(AVCodecContext * avctx)
{
RA144Context *ractx = avctx->priv_data;
ractx->avctx = avctx;
ractx->lpc_coef[0] = ractx->lpc_tables[0];
ractx->lpc_coef[1] = ractx->lpc_tables[1];
avctx->sample_fmt = SAMPLE_FMT_S16;
return 0;
}
static void do_output_subblock(RA144Context *ractx, const uint16_t *lpc_coefs,
int gval, GetBitContext *gb)
{
int cba_idx = get_bits(gb, 7); // index of the adaptive CB, 0 if none
int gain = get_bits(gb, 8);
int cb1_idx = get_bits(gb, 7);
int cb2_idx = get_bits(gb, 7);
ff_subblock_synthesis(ractx, lpc_coefs, cba_idx, cb1_idx, cb2_idx, gval,
gain);
}
/** Uncompress one block (20 bytes -> 160*2 bytes). */
static int ra144_decode_frame(AVCodecContext * avctx, void *vdata,
int *data_size, AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
static const uint8_t sizes[10] = {6, 5, 5, 4, 4, 3, 3, 3, 3, 2};
unsigned int refl_rms[4]; // RMS of the reflection coefficients
uint16_t block_coefs[4][10]; // LPC coefficients of each sub-block
unsigned int lpc_refl[10]; // LPC reflection coefficients of the frame
int i, j;
int16_t *data = vdata;
unsigned int energy;
RA144Context *ractx = avctx->priv_data;
GetBitContext gb;
if (*data_size < 2*160)
return -1;
if(buf_size < 20) {
av_log(avctx, AV_LOG_ERROR,
"Frame too small (%d bytes). Truncated file?\n", buf_size);
*data_size = 0;
return buf_size;
}
init_get_bits(&gb, buf, 20 * 8);
for (i=0; i<10; i++)
lpc_refl[i] = ff_lpc_refl_cb[i][get_bits(&gb, sizes[i])];
ff_eval_coefs(ractx->lpc_coef[0], lpc_refl);
ractx->lpc_refl_rms[0] = ff_rms(lpc_refl);
energy = ff_energy_tab[get_bits(&gb, 5)];
refl_rms[0] = ff_interp(ractx, block_coefs[0], 1, 1, ractx->old_energy);
refl_rms[1] = ff_interp(ractx, block_coefs[1], 2,
energy <= ractx->old_energy,
ff_t_sqrt(energy*ractx->old_energy) >> 12);
refl_rms[2] = ff_interp(ractx, block_coefs[2], 3, 0, energy);
refl_rms[3] = ff_rescale_rms(ractx->lpc_refl_rms[0], energy);
ff_int_to_int16(block_coefs[3], ractx->lpc_coef[0]);
for (i=0; i < 4; i++) {
do_output_subblock(ractx, block_coefs[i], refl_rms[i], &gb);
for (j=0; j < BLOCKSIZE; j++)
*data++ = av_clip_int16(ractx->curr_sblock[j + 10] << 2);
}
ractx->old_energy = energy;
ractx->lpc_refl_rms[1] = ractx->lpc_refl_rms[0];
FFSWAP(unsigned int *, ractx->lpc_coef[0], ractx->lpc_coef[1]);
*data_size = 2*160;
return 20;
}
AVCodec ra_144_decoder =
{
"real_144",
AVMEDIA_TYPE_AUDIO,
CODEC_ID_RA_144,
sizeof(RA144Context),
ra144_decode_init,
NULL,
NULL,
ra144_decode_frame,
.long_name = NULL_IF_CONFIG_SMALL("RealAudio 1.0 (14.4K)"),
};
This diff is collapsed.
......@@ -77,7 +77,7 @@ static av_cold int raw_init_decoder(AVCodecContext *avctx)
avctx->pix_fmt = find_pix_fmt(pix_fmt_bps_mov, avctx->bits_per_coded_sample);
else if (avctx->codec_tag)
avctx->pix_fmt = find_pix_fmt(ff_raw_pix_fmt_tags, avctx->codec_tag);
else if (avctx->bits_per_coded_sample)
else if (avctx->pix_fmt == PIX_FMT_NONE && avctx->bits_per_coded_sample)
avctx->pix_fmt = find_pix_fmt(pix_fmt_bps_avi, avctx->bits_per_coded_sample);
context->length = avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height);
......
......@@ -25,9 +25,6 @@ OBJS-$(CONFIG_X11_GRAB_DEVICE_INDEV) += x11grab.o
# external libraries
OBJS-$(CONFIG_LIBDC1394_INDEV) += libdc1394.o
OBJS-$(CONFIG_AUDIO_BEOS_INDEV) += beosaudio.o
OBJS-$(CONFIG_AUDIO_BEOS_OUTDEV) += beosaudio.o
SKIPHEADERS-$(HAVE_ALSA_ASOUNDLIB_H) += alsa-audio.h
include $(SUBDIR)../subdir.mak
......@@ -40,7 +40,6 @@ void avdevice_register_all(void)
/* devices */
REGISTER_INOUTDEV (ALSA, alsa);
REGISTER_INOUTDEV (AUDIO_BEOS, audio_beos);
REGISTER_INDEV (BKTR, bktr);
REGISTER_INDEV (DV1394, dv1394);
REGISTER_INDEV (JACK, jack);
......
This diff is collapsed.
......@@ -34,6 +34,7 @@ char *av_get_token(const char **buf, const char *term)
char *out = av_malloc(strlen(*buf) + 1);
char *ret= out, *end= out;
const char *p = *buf;
if (!out) return NULL;
p += strspn(p, WHITESPACES);
while(*p && !strspn(p, term)) {
......
......@@ -34,11 +34,11 @@
* The normal \ and ' escaping is supported. Leading and trailing
* whitespaces are removed.
*
* @param term a 0-terminated list of terminating chars
* @param buf the buffer to parse, buf will be updated to point to the
* terminating char
* @param term a 0-terminated list of terminating chars
* @return the malloced unescaped string, which must be av_freed by
* the user
* the user, NULL in case of allocation failure
*/
char *av_get_token(const char **buf, const char *term);
......
......@@ -43,7 +43,7 @@ static int flac_read_header(AVFormatContext *s,
/* skip ID3v2 header if found */
ret = get_buffer(s->pb, buf, ID3v2_HEADER_SIZE);
if (ret == ID3v2_HEADER_SIZE && ff_id3v2_match(buf)) {
if (ret == ID3v2_HEADER_SIZE && ff_id3v2_match(buf, ID3v2_DEFAULT_MAGIC)) {
int len = ff_id3v2_tag_len(buf);
url_fseek(s->pb, len - ID3v2_HEADER_SIZE, SEEK_CUR);
} else {
......@@ -130,7 +130,7 @@ static int flac_probe(AVProbeData *p)
uint8_t *bufptr = p->buf;
uint8_t *end = p->buf + p->buf_size;
if(ff_id3v2_match(bufptr))
if(ff_id3v2_match(bufptr, ID3v2_DEFAULT_MAGIC))
bufptr += ff_id3v2_tag_len(bufptr);
if(bufptr > end-4 || memcmp(bufptr, "fLaC", 4)) return 0;
......
......@@ -371,6 +371,8 @@ static int http_read(URLContext *h, uint8_t *buf, int size)
if (ret != 0)
return ret;
}
if (!s->hd)
return AVERROR(EIO);
/* A size of zero can be used to force
* initializaton of the connection. */
......@@ -429,6 +431,8 @@ static int http_write(URLContext *h, const uint8_t *buf, int size)
if (ret != 0)
return ret;
}
if (!s->hd)
return AVERROR(EIO);
if (s->chunksize == -1) {
/* headers are sent without any special encoding */
......@@ -480,6 +484,14 @@ static int64_t http_seek(URLContext *h, int64_t off, int whence)
uint8_t old_buf[BUFFER_SIZE];
int old_buf_size;
if (!s->init) {
int ret = http_open_cnx(h);
if (ret != 0)
return ret;
}
if (!s->hd)
return AVERROR(EIO);
if (whence == AVSEEK_SIZE)
return s->filesize;
else if ((s->filesize == -1 && whence == SEEK_END) || h->is_streamed)
......
......@@ -22,12 +22,13 @@
#include "id3v2.h"
#include "id3v1.h"
#include "libavutil/avstring.h"
#include "libavutil/intreadwrite.h"
int ff_id3v2_match(const uint8_t *buf)
int ff_id3v2_match(const uint8_t *buf, const char * magic)
{
return buf[0] == 'I' &&
buf[1] == 'D' &&
buf[2] == '3' &&
return buf[0] == magic[0] &&
buf[1] == magic[1] &&
buf[2] == magic[2] &&
buf[3] != 0xff &&
buf[4] != 0xff &&
(buf[6] & 0x80) == 0 &&
......@@ -48,7 +49,7 @@ int ff_id3v2_tag_len(const uint8_t * buf)
return len;
}
void ff_id3v2_read(AVFormatContext *s)
void ff_id3v2_read(AVFormatContext *s, const char *magic)
{
int len, ret;
uint8_t buf[ID3v2_HEADER_SIZE];
......@@ -56,7 +57,7 @@ void ff_id3v2_read(AVFormatContext *s)
ret = get_buffer(s->pb, buf, ID3v2_HEADER_SIZE);
if (ret != ID3v2_HEADER_SIZE)
return;
if (ff_id3v2_match(buf)) {
if (ff_id3v2_match(buf, magic)) {
/* parse ID3v2 header */
len = ((buf[6] & 0x7f) << 21) |
((buf[7] & 0x7f) << 14) |
......
......@@ -28,11 +28,18 @@
#define ID3v2_HEADER_SIZE 10
/**
* Default magic bytes for ID3v2 header: "ID3"
*/
#define ID3v2_DEFAULT_MAGIC "ID3"
/**
* Detects ID3v2 Header.
* @buf must be ID3v2_HEADER_SIZE byte long
* @buf must be ID3v2_HEADER_SIZE byte long
* @magic magic bytes to identify the header, machine byte order.
* If in doubt, use ID3v2_DEFAULT_MAGIC.
*/
int ff_id3v2_match(const uint8_t *buf);
int ff_id3v2_match(const uint8_t *buf, const char *magic);
/**
* Gets the length of an ID3v2 tag.
......@@ -50,7 +57,7 @@ void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t flags)
/**
* Read an ID3v2 tag
*/
void ff_id3v2_read(AVFormatContext *s);
void ff_id3v2_read(AVFormatContext *s, const char *magic);
extern const AVMetadataConv ff_id3v2_metadata_conv[];
......
This diff is collapsed.
......@@ -42,7 +42,7 @@ static int mp3_read_probe(AVProbeData *p)
AVCodecContext avctx;
buf0 = p->buf;
if(ff_id3v2_match(buf0)) {
if(ff_id3v2_match(buf0, ID3v2_DEFAULT_MAGIC)) {
buf0 += ff_id3v2_tag_len(buf0);
}
end = p->buf + p->buf_size - sizeof(uint32_t);
......@@ -148,7 +148,7 @@ static int mp3_read_header(AVFormatContext *s,
// lcm of all mp3 sample rates
av_set_pts_info(st, 64, 1, 14112000);
ff_id3v2_read(s);
ff_id3v2_read(s, ID3v2_DEFAULT_MAGIC);
off = url_ftell(s->pb);
if (!av_metadata_get(s->metadata, "", NULL, AV_METADATA_IGNORE_SUFFIX))
......
......@@ -45,7 +45,7 @@ typedef struct {
static int mpc_probe(AVProbeData *p)
{
const uint8_t *d = p->buf;
if (ff_id3v2_match(d)) {
if (ff_id3v2_match(d, ID3v2_DEFAULT_MAGIC)) {
d += ff_id3v2_tag_len(d);
}
if (d+3 < p->buf+p->buf_size)
......@@ -67,7 +67,7 @@ static int mpc_read_header(AVFormatContext *s, AVFormatParameters *ap)
if (url_fseek(s->pb, pos, SEEK_SET) < 0)
return -1;
ret = get_buffer(s->pb, buf, ID3v2_HEADER_SIZE);
if (ret != ID3v2_HEADER_SIZE || !ff_id3v2_match(buf)) {
if (ret != ID3v2_HEADER_SIZE || !ff_id3v2_match(buf, ID3v2_DEFAULT_MAGIC)) {
av_log(s, AV_LOG_ERROR, "Not a Musepack file\n");
return -1;
}
......@@ -82,7 +82,7 @@ static int mpc_read_header(AVFormatContext *s, AVFormatParameters *ap)
/* read ID3 tags */
if (url_fseek(s->pb, pos, SEEK_SET) < 0)
return -1;
ff_id3v2_read(s);
ff_id3v2_read(s, ID3v2_DEFAULT_MAGIC);
get_le24(s->pb);
}
c->ver = get_byte(s->pb);
......
......@@ -363,7 +363,7 @@ ogg_packet (AVFormatContext * s, int *str, int *dstart, int *dsize, int64_t *fpo
#endif
if (os->granule == -1)
av_log(s, AV_LOG_WARNING, "Page at %lld is missing granule\n", os->page_pos);
av_log(s, AV_LOG_WARNING, "Page at %"PRId64" is missing granule\n", os->page_pos);
ogg->curidx = idx;
os->incomplete = 0;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -40,7 +40,7 @@
#define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c)
#define LIBAVUTIL_VERSION_MAJOR 50
#define LIBAVUTIL_VERSION_MINOR 18
#define LIBAVUTIL_VERSION_MINOR 19
#define LIBAVUTIL_VERSION_MICRO 0
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment