提交 28d37384 编写于 作者: M Michael Niedermayer

Merge remote-tracking branch 'qatar/master'

* qatar/master:
  Add LATM demuxer
  avplay: flush audio decoder with empty packets at EOF if the decoder has CODEC_CAP_DELAY set.
  8svx/iff: fix decoding of compressed stereo 8svx files.
  8svx: log an error message if output buffer is too small
  8svx: check packet size before reading the initial sample value.
  8svx: output 8-bit samples instead of 16-bit.
  8svx: split delta decoding into a separate function.
  mp4: Don't read an empty Decoder Config Descriptor
  fate.sh: Ignore errors from rm command during cleanup.
  fate.sh: Run git-pull in quiet mode to avoid console spam.
  Apple ProRes decoder
  rtmp: Make the input FLV parser handle data cut at any point
  rv34: Check for invalid slices offsets
  eval: test isnan(sqrt(-1)) instead of just sqrt(-1)

Conflicts:
	Changelog
	libavcodec/8svx.c
	libavcodec/proresdec.c
	libavcodec/version.h
	libavformat/iff.c
	libavformat/version.h
	tests/ref/fate/eval
Merged-by: NMichael Niedermayer <michaelni@gmx.at>
......@@ -47,7 +47,7 @@ easier to use. The changes are:
- ashowinfo filter added
- Windows Media Image decoder
- amovie source added
- LATM muxer
- LATM muxer/demuxer
- Speex encoder via libspeex
- JSON output in ffprobe
- WTV muxer
......@@ -58,6 +58,7 @@ easier to use. The changes are:
- aconvert audio filter added
- audio support to lavfi input device added
- libcdio-paranoia input device for audio CD grabbing
- Apple ProRes decoder
version 0.8:
......
......@@ -1415,7 +1415,7 @@ nellymoser_decoder_select="mdct sinewin"
nellymoser_encoder_select="mdct sinewin"
png_decoder_select="zlib"
png_encoder_select="zlib"
prores_decoder_deps="version2 gpl"
prores_gpl_decoder_deps="version2 gpl"
qcelp_decoder_select="lsp"
qdm2_decoder_select="mdct rdft mpegaudiodsp"
ra_144_encoder_select="lpc"
......
......@@ -347,6 +347,7 @@ following image formats are supported:
@tab Used in Chinese MP3 players.
@item ANSI/ASCII art @tab @tab X
@item Apple MJPEG-B @tab @tab X
@item Apple ProRes @tab @tab X
@item Apple QuickDraw @tab @tab X
@tab fourcc: qdrw
@item Asus v1 @tab X @tab X
......
......@@ -1994,10 +1994,15 @@ static int audio_decode_frame(VideoState *is, double *pts_ptr)
AVCodecContext *dec= is->audio_st->codec;
int n, len1, data_size;
double pts;
int new_packet = 0;
int flush_complete = 0;
for(;;) {
/* NOTE: the audio packet can contain several frames */
while (pkt_temp->size > 0) {
while (pkt_temp->size > 0 || (!pkt_temp->data && new_packet)) {
if (flush_complete)
break;
new_packet = 0;
data_size = sizeof(is->audio_buf1);
len1 = avcodec_decode_audio3(dec,
(int16_t *)is->audio_buf1, &data_size,
......@@ -2010,8 +2015,13 @@ static int audio_decode_frame(VideoState *is, double *pts_ptr)
pkt_temp->data += len1;
pkt_temp->size -= len1;
if (data_size <= 0)
if (data_size <= 0) {
/* stop sending empty packets if the decoder is finished */
if (!pkt_temp->data && dec->codec->capabilities & CODEC_CAP_DELAY)
flush_complete = 1;
continue;
}
if (dec->sample_fmt != is->audio_src_fmt) {
if (is->reformat_ctx)
......@@ -2072,12 +2082,11 @@ static int audio_decode_frame(VideoState *is, double *pts_ptr)
}
/* read next packet */
if (packet_queue_get(&is->audioq, pkt, 1) < 0)
if ((new_packet = packet_queue_get(&is->audioq, pkt, 1)) < 0)
return -1;
if(pkt->data == flush_pkt.data){
if (pkt->data == flush_pkt.data)
avcodec_flush_buffers(dec);
continue;
}
pkt_temp->data = pkt->data;
pkt_temp->size = pkt->size;
......@@ -2508,6 +2517,14 @@ static int read_thread(void *arg)
pkt->stream_index= is->video_stream;
packet_queue_put(&is->videoq, pkt);
}
if (is->audio_stream >= 0 &&
is->audio_st->codec->codec->capabilities & CODEC_CAP_DELAY) {
av_init_packet(pkt);
pkt->data = NULL;
pkt->size = 0;
pkt->stream_index = is->audio_stream;
packet_queue_put(&is->audioq, pkt);
}
SDL_Delay(10);
if(is->audioq.size + is->videoq.size + is->subtitleq.size ==0){
if(loop!=1 && (!loop || --loop)){
......
......@@ -121,6 +121,10 @@ static int eightsvx_decode_frame(AVCodecContext *avctx, void *data, int *data_si
int buf_size = avpkt->size;
int n = esc->samples_size;
if (buf_size < 2) {
av_log(avctx, AV_LOG_ERROR, "packet size is too small\n");
return AVERROR(EINVAL);
}
if (!(deinterleaved_samples = av_mallocz(n)))
return AVERROR(ENOMEM);
......
......@@ -309,7 +309,8 @@ OBJS-$(CONFIG_PNG_DECODER) += png.o pngdec.o
OBJS-$(CONFIG_PNG_ENCODER) += png.o pngenc.o
OBJS-$(CONFIG_PPM_DECODER) += pnmdec.o pnm.o
OBJS-$(CONFIG_PPM_ENCODER) += pnmenc.o pnm.o
OBJS-$(CONFIG_PRORES_DECODER) += proresdec.o
OBJS-$(CONFIG_PRORES_GPL_DECODER) += proresdec_gpl.o
OBJS-$(CONFIG_PRORES_LGPL_DECODER) += proresdec_lgpl.o
OBJS-$(CONFIG_PTX_DECODER) += ptx.o
OBJS-$(CONFIG_QCELP_DECODER) += qcelpdec.o celp_math.o \
celp_filters.o acelp_vectors.o \
......
......@@ -172,7 +172,8 @@ void avcodec_register_all(void)
REGISTER_DECODER (PICTOR, pictor);
REGISTER_ENCDEC (PNG, png);
REGISTER_ENCDEC (PPM, ppm);
REGISTER_DECODER (PRORES, prores);
REGISTER_DECODER (PRORES_GPL, prores_gpl);
REGISTER_DECODER (PRORES_LGPL, prores_lgpl);
REGISTER_DECODER (PTX, ptx);
REGISTER_DECODER (QDRAW, qdraw);
REGISTER_DECODER (QPEG, qpeg);
......
此差异已折叠。
......@@ -21,7 +21,7 @@
#define AVCODEC_VERSION_H
#define LIBAVCODEC_VERSION_MAJOR 53
#define LIBAVCODEC_VERSION_MINOR 16
#define LIBAVCODEC_VERSION_MINOR 17
#define LIBAVCODEC_VERSION_MICRO 0
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
......
......@@ -115,6 +115,7 @@ 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_LATM_DEMUXER) += rawdec.o
OBJS-$(CONFIG_LATM_MUXER) += latmenc.o
OBJS-$(CONFIG_LMLM4_DEMUXER) += lmlm4.o
OBJS-$(CONFIG_LOAS_DEMUXER) += loasdec.o
......
......@@ -116,7 +116,7 @@ void av_register_all(void)
REGISTER_DEMUXER (IV8, iv8);
REGISTER_MUXDEMUX (IVF, ivf);
REGISTER_DEMUXER (JV, jv);
REGISTER_MUXER (LATM, latm);
REGISTER_MUXDEMUX (LATM, latm);
REGISTER_DEMUXER (LMLM4, lmlm4);
REGISTER_DEMUXER (LOAS, loas);
REGISTER_DEMUXER (LXF, lxf);
......
......@@ -85,7 +85,6 @@ typedef struct {
uint64_t body_pos;
uint32_t body_size;
uint32_t sent_bytes;
uint32_t audio_frame_count;
svx8_compression_type svx8_compression;
bitmap_compression_type bitmap_compression; ///< delta compression method used
unsigned bpp; ///< bits per plane to decode (differs from bits_per_coded_sample if HAM)
......@@ -313,7 +312,7 @@ static int iff_read_packet(AVFormatContext *s,
int ret;
if(iff->sent_bytes >= iff->body_size)
return AVERROR(EIO);
return AVERROR_EOF;
if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
ret = av_get_packet(pb, pkt, iff->body_size);
......
......@@ -425,7 +425,7 @@ int ff_mp4_read_dec_config_descr(AVFormatContext *fc, AVStream *st, AVIOContext
len = ff_mp4_read_descr(fc, pb, &tag);
if (tag == MP4DecSpecificDescrTag) {
av_dlog(fc, "Specific MPEG4 header len=%d\n", len);
if((uint64_t)len > (1<<30))
if (!len || (uint64_t)len > (1<<30))
return -1;
av_free(st->codec->extradata);
st->codec->extradata = av_mallocz(len + FF_INPUT_BUFFER_PADDING_SIZE);
......
......@@ -199,6 +199,18 @@ AVInputFormat ff_gsm_demuxer = {
};
#endif
#if CONFIG_LATM_DEMUXER
AVInputFormat ff_latm_demuxer = {
.name = "latm",
.long_name = NULL_IF_CONFIG_SMALL("raw LOAS/LATM"),
.read_header = ff_raw_audio_read_header,
.read_packet = ff_raw_read_partial_packet,
.flags= AVFMT_GENERIC_INDEX,
.extensions = "latm",
.value = CODEC_ID_AAC_LATM,
};
#endif
#if CONFIG_MJPEG_DEMUXER
FF_DEF_RAWVIDEO_DEMUXER(mjpeg, "raw MJPEG video", NULL, "mjpg,mjpeg", CODEC_ID_MJPEG)
#endif
......
......@@ -72,6 +72,8 @@ typedef struct RTMPContext {
uint32_t bytes_read; ///< number of bytes read from server
uint32_t last_bytes_read; ///< number of bytes read last reported to server
int skip_bytes; ///< number of bytes to skip from the input FLV stream in the next write call
uint8_t flv_header[11]; ///< partial incoming flv packet header
int flv_header_bytes; ///< number of initialized bytes in flv_header
} RTMPContext;
#define PLAYER_KEY_OPEN_PART_LEN 30 ///< length of partial key used for first client digest signing
......@@ -880,6 +882,7 @@ static int rtmp_open(URLContext *s, const char *uri, int flags)
rt->flv_size = 0;
rt->flv_data = NULL;
rt->flv_off = 0;
rt->skip_bytes = 13;
}
s->max_packet_size = rt->stream->max_packet_size;
......@@ -926,34 +929,29 @@ static int rtmp_write(URLContext *s, const uint8_t *buf, int size)
uint32_t ts;
const uint8_t *buf_temp = buf;
if (rt->skip_bytes) {
int skip = FFMIN(rt->skip_bytes, size);
buf_temp += skip;
size_temp -= skip;
rt->skip_bytes -= skip;
if (size_temp <= 0)
return size;
}
if (!rt->flv_off && size_temp < 11) {
av_log(s, AV_LOG_DEBUG, "FLV packet too small %d\n", size);
return 0;
}
do {
if (!rt->flv_off) {
//skip flv header
if (buf_temp[0] == 'F' && buf_temp[1] == 'L' && buf_temp[2] == 'V') {
buf_temp += 9 + 4;
size_temp -= 9 + 4;
}
if (rt->skip_bytes) {
int skip = FFMIN(rt->skip_bytes, size_temp);
buf_temp += skip;
size_temp -= skip;
rt->skip_bytes -= skip;
continue;
}
if (rt->flv_header_bytes < 11) {
const uint8_t *header = rt->flv_header;
int copy = FFMIN(11 - rt->flv_header_bytes, size_temp);
bytestream_get_buffer(&buf_temp, rt->flv_header + rt->flv_header_bytes, copy);
rt->flv_header_bytes += copy;
size_temp -= copy;
if (rt->flv_header_bytes < 11)
break;
pkttype = bytestream_get_byte(&buf_temp);
pktsize = bytestream_get_be24(&buf_temp);
ts = bytestream_get_be24(&buf_temp);
ts |= bytestream_get_byte(&buf_temp) << 24;
bytestream_get_be24(&buf_temp);
size_temp -= 11;
pkttype = bytestream_get_byte(&header);
pktsize = bytestream_get_be24(&header);
ts = bytestream_get_be24(&header);
ts |= bytestream_get_byte(&header) << 24;
bytestream_get_be24(&header);
rt->flv_size = pktsize;
//force 12bytes header
......@@ -984,18 +982,13 @@ static int rtmp_write(URLContext *s, const uint8_t *buf, int size)
}
if (rt->flv_off == rt->flv_size) {
if (size_temp < 4) {
rt->skip_bytes = 4 - size_temp;
buf_temp += size_temp;
size_temp = 0;
} else {
bytestream_get_be32(&buf_temp);
size_temp -= 4;
}
rt->skip_bytes = 4;
ff_rtmp_packet_write(rt->stream, &rt->out_pkt, rt->chunk_size, rt->prev_pkt[1]);
ff_rtmp_packet_destroy(&rt->out_pkt);
rt->flv_size = 0;
rt->flv_off = 0;
rt->flv_header_bytes = 0;
}
} while (buf_temp - buf < size);
return size;
......
......@@ -24,7 +24,7 @@
#include "libavutil/avutil.h"
#define LIBAVFORMAT_VERSION_MAJOR 53
#define LIBAVFORMAT_VERSION_MINOR 12
#define LIBAVFORMAT_VERSION_MINOR 13
#define LIBAVFORMAT_VERSION_MICRO 0
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
......
......@@ -644,7 +644,7 @@ int main(int argc, char **argv)
"ceil(123.123)",
"ceil(-123.123)",
"sqrt(1764)",
"sqrt(-1)",
"isnan(sqrt(-1))",
"not(1)",
"not(NAN)",
"not(0)",
......
......@@ -35,7 +35,7 @@ checkout(){
update()(
cd ${src} || return
case "$repo" in
git:*) git pull ;;
git:*) git pull --quiet ;;
esac
)
......@@ -70,7 +70,7 @@ fate()(
)
clean(){
rm -r ${build} ${inst}
rm -rf ${build} ${inst}
}
report(){
......
......@@ -136,8 +136,8 @@ Evaluating 'ceil(-123.123)'
Evaluating 'sqrt(1764)'
'sqrt(1764)' -> 42.000000
Evaluating 'sqrt(-1)'
'sqrt(-1)' -> nan
Evaluating 'isnan(sqrt(-1))'
'isnan(sqrt(-1))' -> 1.000000
Evaluating 'not(1)'
'not(1)' -> 0.000000
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册