Permalink
Browse files

FFmpeg resync to FFmpeg release/1.1 at SHA1 fc7071cb53ded2e332947ce21…

…45b587c5bdcd075

Conflict in libavcodec/mpegaudio_parser.c
  • Loading branch information...
1 parent cc2f9dd commit 0770c5d1a0674f158f3b6d8a9ee7c8c818dec68a @jyavenard jyavenard committed Mar 30, 2013
Showing with 303 additions and 190 deletions.
  1. +2 −1 mythtv/external/FFmpeg/MAINTAINERS
  2. +1 −0 mythtv/external/FFmpeg/README.sync
  3. +1 −1 mythtv/external/FFmpeg/RELEASE
  4. +1 −1 mythtv/external/FFmpeg/VERSION
  5. +1 −1 mythtv/external/FFmpeg/doc/Doxyfile
  6. +19 −3 mythtv/external/FFmpeg/libavcodec/aacsbr.c
  7. +4 −1 mythtv/external/FFmpeg/libavcodec/atrac3.c
  8. +1 −1 mythtv/external/FFmpeg/libavcodec/dnxhddec.c
  9. +1 −0 mythtv/external/FFmpeg/libavcodec/dpxenc.c
  10. +15 −0 mythtv/external/FFmpeg/libavcodec/eamad.c
  11. +6 −0 mythtv/external/FFmpeg/libavcodec/h264.c
  12. +1 −1 mythtv/external/FFmpeg/libavcodec/libmp3lame.c
  13. +1 −1 mythtv/external/FFmpeg/libavcodec/libx264.c
  14. +4 −1 mythtv/external/FFmpeg/libavcodec/mjpegdec.c
  15. +6 −2 mythtv/external/FFmpeg/libavcodec/mpegaudio_parser.c
  16. +36 −31 mythtv/external/FFmpeg/libavcodec/msrledec.c
  17. +1 −3 mythtv/external/FFmpeg/libavcodec/png.c
  18. +1 −1 mythtv/external/FFmpeg/libavcodec/psymodel.c
  19. +127 −114 mythtv/external/FFmpeg/libavcodec/shorten.c
  20. +1 −1 mythtv/external/FFmpeg/libavcodec/vmdav.c
  21. +5 −0 mythtv/external/FFmpeg/libavcodec/wmadec.c
  22. +10 −2 mythtv/external/FFmpeg/libavcodec/wmaprodec.c
  23. +1 −1 mythtv/external/FFmpeg/libavcodec/xxan.c
  24. +2 −1 mythtv/external/FFmpeg/libavfilter/vf_gradfun.c
  25. +6 −4 mythtv/external/FFmpeg/libavfilter/vf_hqdn3d.c
  26. +3 −5 mythtv/external/FFmpeg/libavformat/flacdec.c
  27. +3 −0 mythtv/external/FFmpeg/libavformat/flvenc.c
  28. +2 −0 mythtv/external/FFmpeg/libavformat/hls.c
  29. +3 −0 mythtv/external/FFmpeg/libavformat/iff.c
  30. +3 −0 mythtv/external/FFmpeg/libavformat/movenc.c
  31. +4 −2 mythtv/external/FFmpeg/libavformat/mp3dec.c
  32. +11 −3 mythtv/external/FFmpeg/libavformat/mpegts.c
  33. +13 −0 mythtv/external/FFmpeg/libavformat/rmdec.c
  34. +1 −1 mythtv/external/FFmpeg/libavformat/utils.c
  35. +1 −2 mythtv/external/FFmpeg/libavutil/lzo.c
  36. +2 −2 mythtv/external/FFmpeg/tests/ref/lavf-fate/mp3
  37. +3 −3 mythtv/external/FFmpeg/tests/ref/lavf/dpx
View
3 mythtv/external/FFmpeg/MAINTAINERS
@@ -445,10 +445,11 @@ x86 Michael Niedermayer
Releases
========
+1.2 Michael Niedermayer
1.1 Michael Niedermayer
1.0 Michael Niedermayer
-0.11 Michael Niedermayer
+If you want to maintain an older release, please contact us
GnuPG Fingerprints of maintainers and contributors
View
1 mythtv/external/FFmpeg/README.sync
@@ -8,6 +8,7 @@ git://source.ffmpeg.org/ffmpeg.git at SHA1 59d765e3 on December 12th, 2012 (jya)
git://source.ffmpeg.org/ffmpeg.git at SHA1 553c9c77 on December 16th, 2012 (jya) (release/1.0 branch)
git://source.ffmpeg.org/ffmpeg.git at SHA1 057051b8 on February 17th, 2013 (jya) (release/1.1 branch)
git://source.ffmpeg.org/ffmpeg.git at SHA1 7c8beec4 on March 7th, 2013 (jya) (release/1.1 branch)
+git://source.ffmpeg.org/ffmpeg.git at SHA1 fc7071cb on March 30th, 2013 (jya) (release/1.1 branch)
List of files modified from original FFmpeg:
Makefile
View
2 mythtv/external/FFmpeg/RELEASE
@@ -1 +1 @@
-1.1.3
+1.1.4
View
2 mythtv/external/FFmpeg/VERSION
@@ -1 +1 @@
-1.1.3
+1.1.4
View
2 mythtv/external/FFmpeg/doc/Doxyfile
@@ -31,7 +31,7 @@ PROJECT_NAME = FFmpeg
# This could be handy for archiving the generated documentation or
# if some version control system is used.
-PROJECT_NUMBER = 1.1.3
+PROJECT_NUMBER = 1.1.4
# With the PROJECT_LOGO tag one can specify an logo or icon that is included
# in the documentation. The maximum height of the logo should not exceed 55
View
22 mythtv/external/FFmpeg/libavcodec/aacsbr.c
@@ -1121,7 +1121,12 @@ static void sbr_dequant(SpectralBandReplication *sbr, int id_aac)
for (k = 0; k < sbr->n[sbr->data[0].bs_freq_res[e]]; k++) {
float temp1 = exp2f(sbr->data[0].env_facs[e][k] * alpha + 7.0f);
float temp2 = exp2f((pan_offset - sbr->data[1].env_facs[e][k]) * alpha);
- float fac = temp1 / (1.0f + temp2);
+ float fac;
+ if (temp1 > 1E20) {
+ av_log(NULL, AV_LOG_ERROR, "envelope scalefactor overflow in dequant\n");
+ temp1 = 1;
+ }
+ fac = temp1 / (1.0f + temp2);
sbr->data[0].env_facs[e][k] = fac;
sbr->data[1].env_facs[e][k] = fac * temp2;
}
@@ -1130,7 +1135,12 @@ static void sbr_dequant(SpectralBandReplication *sbr, int id_aac)
for (k = 0; k < sbr->n_q; k++) {
float temp1 = exp2f(NOISE_FLOOR_OFFSET - sbr->data[0].noise_facs[e][k] + 1);
float temp2 = exp2f(12 - sbr->data[1].noise_facs[e][k]);
- float fac = temp1 / (1.0f + temp2);
+ float fac;
+ if (temp1 > 1E20) {
+ av_log(NULL, AV_LOG_ERROR, "envelope scalefactor overflow in dequant\n");
+ temp1 = 1;
+ }
+ fac = temp1 / (1.0f + temp2);
sbr->data[0].noise_facs[e][k] = fac;
sbr->data[1].noise_facs[e][k] = fac * temp2;
}
@@ -1139,9 +1149,15 @@ static void sbr_dequant(SpectralBandReplication *sbr, int id_aac)
for (ch = 0; ch < (id_aac == TYPE_CPE) + 1; ch++) {
float alpha = sbr->data[ch].bs_amp_res ? 1.0f : 0.5f;
for (e = 1; e <= sbr->data[ch].bs_num_env; e++)
- for (k = 0; k < sbr->n[sbr->data[ch].bs_freq_res[e]]; k++)
+ for (k = 0; k < sbr->n[sbr->data[ch].bs_freq_res[e]]; k++){
sbr->data[ch].env_facs[e][k] =
exp2f(alpha * sbr->data[ch].env_facs[e][k] + 6.0f);
+ if (sbr->data[ch].env_facs[e][k] > 1E20) {
+ av_log(NULL, AV_LOG_ERROR, "envelope scalefactor overflow in dequant\n");
+ sbr->data[ch].env_facs[e][k] = 1;
+ }
+ }
+
for (e = 1; e <= sbr->data[ch].bs_num_noise; e++)
for (k = 0; k < sbr->n_q; k++)
sbr->data[ch].noise_facs[e][k] =
View
5 mythtv/external/FFmpeg/libavcodec/atrac3.c
@@ -165,7 +165,10 @@ static int decode_bytes(const uint8_t *input, uint8_t *out, int bytes)
off = (intptr_t)input & 3;
buf = (const uint32_t *)(input - off);
- c = av_be2ne32((0x537F6103 >> (off * 8)) | (0x537F6103 << (32 - (off * 8))));
+ if (off)
+ c = av_be2ne32((0x537F6103U >> (off * 8)) | (0x537F6103U << (32 - (off * 8))));
+ else
+ c = av_be2ne32(0x537F6103U);
bytes += 3 + off;
for (i = 0; i < bytes / 4; i++)
output[i] = c ^ buf[i];
View
2 mythtv/external/FFmpeg/libavcodec/dnxhddec.c
@@ -406,7 +406,7 @@ static int dnxhd_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
*picture = ctx->picture;
*got_frame = 1;
- return buf_size;
+ return avpkt->size;
}
static av_cold int dnxhd_decode_close(AVCodecContext *avctx)
View
1 mythtv/external/FFmpeg/libavcodec/dpxenc.c
@@ -212,6 +212,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
buf[803] = s->bits_per_component;
write16(buf + 804, (s->bits_per_component == 10 || s->bits_per_component == 12) ?
1 : 0); /* packing method */
+ write32(buf + 808, HEADER_SIZE); /* data offset */
/* Image source information header */
write32(buf + 1628, avctx->sample_aspect_ratio.num);
View
15 mythtv/external/FFmpeg/libavcodec/eamad.c
@@ -276,6 +276,21 @@ static int decode_frame(AVCodecContext *avctx,
}
}
+ if (inter && !s->last_frame.data[0]) {
+ int ret;
+ av_log(avctx, AV_LOG_WARNING, "Missing reference frame.\n");
+ s->last_frame.reference = 1;
+ ret = ff_get_buffer(avctx, &s->last_frame);
+ if (ret < 0)
+ return ret;
+ memset(s->last_frame.data[0], 0, s->last_frame.height *
+ s->last_frame.linesize[0]);
+ memset(s->last_frame.data[1], 0x80, s->last_frame.height / 2 *
+ s->last_frame.linesize[1]);
+ memset(s->last_frame.data[2], 0x80, s->last_frame.height / 2 *
+ s->last_frame.linesize[2]);
+ }
+
av_fast_padded_malloc(&s->bitstream_buf, &s->bitstream_buf_size,
buf_end - buf);
if (!s->bitstream_buf)
View
6 mythtv/external/FFmpeg/libavcodec/h264.c
@@ -2443,6 +2443,12 @@ static int h264_set_parameter_from_sps(H264Context *h)
if (s->avctx->has_b_frames < 2)
s->avctx->has_b_frames = !s->low_delay;
+ if (h->sps.bit_depth_luma != h->sps.bit_depth_chroma) {
+ av_log_missing_feature(s->avctx,
+ "Different bit depth between chroma and luma", 1);
+ return AVERROR_PATCHWELCOME;
+ }
+
if (s->avctx->bits_per_raw_sample != h->sps.bit_depth_luma ||
h->cur_chroma_format_idc != h->sps.chroma_format_idc) {
if (s->avctx->codec &&
View
2 mythtv/external/FFmpeg/libavcodec/libmp3lame.c
@@ -218,7 +218,7 @@ static int mp3lame_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
}
} else {
lame_result = lame_encode_flush(s->gfp, s->buffer + s->buffer_index,
- BUFFER_SIZE - s->buffer_index);
+ s->buffer_size - s->buffer_index);
}
if (lame_result < 0) {
if (lame_result == -1) {
View
2 mythtv/external/FFmpeg/libavcodec/libx264.c
@@ -174,7 +174,7 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame,
frame->pict_type == AV_PICTURE_TYPE_P ? X264_TYPE_P :
frame->pict_type == AV_PICTURE_TYPE_B ? X264_TYPE_B :
X264_TYPE_AUTO;
- if (x4->params.b_tff != frame->top_field_first) {
+ if (x4->params.b_interlaced && x4->params.b_tff != frame->top_field_first) {
x4->params.b_tff = frame->top_field_first;
x264_encoder_reconfig(x4->enc, &x4->params);
}
View
5 mythtv/external/FFmpeg/libavcodec/mjpegdec.c
@@ -740,7 +740,9 @@ static void handle_rstn(MJpegDecodeContext *s, int nb_components)
i = 8 + ((-get_bits_count(&s->gb)) & 7);
/* skip RSTn */
- if (s->restart_count == 0 && show_bits(&s->gb, i) == (1 << i) - 1) {
+ if (s->restart_count == 0) {
+ if( show_bits(&s->gb, i) == (1 << i) - 1
+ || show_bits(&s->gb, i) == 0xFF) {
int pos = get_bits_count(&s->gb);
align_get_bits(&s->gb);
while (get_bits_left(&s->gb) >= 8 && show_bits(&s->gb, 8) == 0xFF)
@@ -750,6 +752,7 @@ static void handle_rstn(MJpegDecodeContext *s, int nb_components)
s->last_dc[i] = 1024;
} else
skip_bits_long(&s->gb, pos - get_bits_count(&s->gb));
+ }
}
}
}
View
8 mythtv/external/FFmpeg/libavcodec/mpegaudio_parser.c
@@ -30,6 +30,7 @@ typedef struct MpegAudioParseContext {
int frame_size;
uint32_t header;
int header_count;
+ int no_bitrate;
} MpegAudioParseContext;
#define MPA_HEADER_SIZE 4
@@ -77,11 +78,14 @@ static int mpegaudio_parse(AVCodecParserContext *s1,
s->header_count++;
s->frame_size = ret-4;
- if (s->header_count > 1 || avctx->sample_rate == 0) {
+ if (s->header_count > 0 || avctx->sample_rate == 0) {
avctx->sample_rate= sr;
avctx->channels = channels;
s1->duration = frame_size;
- avctx->bit_rate = bit_rate;
+ if (s->no_bitrate || !avctx->bit_rate) {
+ s->no_bitrate = 1;
+ avctx->bit_rate += (bit_rate - avctx->bit_rate) / s->header_count;
+ }
}
break;
}
View
67 mythtv/external/FFmpeg/libavcodec/msrledec.c
@@ -138,7 +138,8 @@ static int msrle_decode_8_16_24_32(AVCodecContext *avctx, AVPicture *pic,
unsigned int width= FFABS(pic->linesize[0]) / (depth >> 3);
output = pic->data[0] + (avctx->height - 1) * pic->linesize[0];
- output_end = pic->data[0] + avctx->height * pic->linesize[0];
+ output_end = output + FFABS(pic->linesize[0]);
+
while (bytestream2_get_bytes_left(gb) > 0) {
p1 = bytestream2_get_byteu(gb);
if(p1 == 0) { //Escape code
@@ -155,6 +156,7 @@ static int msrle_decode_8_16_24_32(AVCodecContext *avctx, AVPicture *pic,
}
}
output = pic->data[0] + line * pic->linesize[0];
+ output_end = output + FFABS(pic->linesize[0]);
pos = 0;
continue;
} else if(p2 == 1) { //End-of-picture
@@ -169,11 +171,11 @@ static int msrle_decode_8_16_24_32(AVCodecContext *avctx, AVPicture *pic,
return -1;
}
output = pic->data[0] + line * pic->linesize[0] + pos * (depth >> 3);
+ output_end = pic->data[0] + line * pic->linesize[0] + FFABS(pic->linesize[0]);
continue;
}
// Copy data
- if ((pic->linesize[0] > 0 && output + p2 * (depth >> 3) > output_end) ||
- (pic->linesize[0] < 0 && output + p2 * (depth >> 3) < output_end)) {
+ if (output + p2 * (depth >> 3) > output_end) {
bytestream2_skip(gb, 2 * (depth >> 3));
continue;
} else if (bytestream2_get_bytes_left(gb) < p2 * (depth >> 3)) {
@@ -203,36 +205,39 @@ static int msrle_decode_8_16_24_32(AVCodecContext *avctx, AVPicture *pic,
pos += p2;
} else { //run of pixels
uint8_t pix[3]; //original pixel
- switch(depth){
- case 8: pix[0] = bytestream2_get_byte(gb);
- break;
- case 16: pix16 = bytestream2_get_le16(gb);
- break;
- case 24: pix[0] = bytestream2_get_byte(gb);
- pix[1] = bytestream2_get_byte(gb);
- pix[2] = bytestream2_get_byte(gb);
- break;
- case 32: pix32 = bytestream2_get_le32(gb);
- break;
- }
- if ((pic->linesize[0] > 0 && output + p1 * (depth >> 3) > output_end) ||
- (pic->linesize[0] < 0 && output + p1 * (depth >> 3) < output_end))
+ if (output + p1 * (depth >> 3) > output_end)
continue;
- for(i = 0; i < p1; i++) {
- switch(depth){
- case 8: *output++ = pix[0];
- break;
- case 16: *(uint16_t*)output = pix16;
- output += 2;
- break;
- case 24: *output++ = pix[0];
- *output++ = pix[1];
- *output++ = pix[2];
- break;
- case 32: *(uint32_t*)output = pix32;
- output += 4;
- break;
+
+ switch(depth){
+ case 8:
+ pix[0] = bytestream2_get_byte(gb);
+ for(i = 0; i < p1; i++)
+ *output++ = pix[0];
+ break;
+ case 16:
+ pix16 = bytestream2_get_le16(gb);
+ for(i = 0; i < p1; i++) {
+ *(uint16_t*)output = pix16;
+ output += 2;
+ }
+ break;
+ case 24:
+ pix[0] = bytestream2_get_byte(gb);
+ pix[1] = bytestream2_get_byte(gb);
+ pix[2] = bytestream2_get_byte(gb);
+ for(i = 0; i < p1; i++) {
+ *output++ = pix[0];
+ *output++ = pix[1];
+ *output++ = pix[2];
+ }
+ break;
+ case 32:
+ pix32 = bytestream2_get_le32(gb);
+ for(i = 0; i < p1; i++) {
+ *(uint32_t*)output = pix32;
+ output += 4;
}
+ break;
}
pos += p1;
}
View
4 mythtv/external/FFmpeg/libavcodec/png.c
@@ -38,9 +38,7 @@ static const uint8_t ff_png_pass_xshift[NB_PASSES] = {
void *ff_png_zalloc(void *opaque, unsigned int items, unsigned int size)
{
- if(items >= UINT_MAX / size)
- return NULL;
- return av_malloc(items * size);
+ return av_mallocz_array(items, size);
}
void ff_png_zfree(void *opaque, void *ptr)
View
2 mythtv/external/FFmpeg/libavcodec/psymodel.c
@@ -106,7 +106,7 @@ av_cold struct FFPsyPreprocessContext* ff_psy_preprocess_init(AVCodecContext *av
if (!cutoff_coeff && avctx->codec_id == AV_CODEC_ID_AAC)
cutoff_coeff = 2.0 * AAC_CUTOFF(avctx) / avctx->sample_rate;
- if (cutoff_coeff)
+ if (cutoff_coeff && cutoff_coeff < 0.98)
ctx->fcoeffs = ff_iir_filter_init_coeffs(avctx, FF_FILTER_TYPE_BUTTERWORTH,
FF_FILTER_MODE_LOWPASS, FILT_ORDER,
cutoff_coeff, 0.0, 0.0);
View
241 mythtv/external/FFmpeg/libavcodec/shorten.c
@@ -88,7 +88,7 @@ typedef struct ShortenContext {
GetBitContext gb;
int min_framesize, max_framesize;
- int channels;
+ unsigned channels;
int32_t *decoded[MAX_CHANNELS];
int32_t *decoded_base[MAX_CHANNELS];
@@ -113,10 +113,10 @@ typedef struct ShortenContext {
int got_quit_command;
} ShortenContext;
-static av_cold int shorten_decode_init(AVCodecContext * avctx)
+static av_cold int shorten_decode_init(AVCodecContext *avctx)
{
ShortenContext *s = avctx->priv_data;
- s->avctx = avctx;
+ s->avctx = avctx;
avcodec_get_frame_defaults(&s->frame);
avctx->coded_frame = &s->frame;
@@ -130,17 +130,20 @@ static int allocate_buffers(ShortenContext *s)
int *coeffs;
void *tmp_ptr;
- for (chan=0; chan<s->channels; chan++) {
- if(FFMAX(1, s->nmean) >= UINT_MAX/sizeof(int32_t)){
+ for (chan = 0; chan < s->channels; chan++) {
+ if (FFMAX(1, s->nmean) >= UINT_MAX / sizeof(int32_t)) {
av_log(s->avctx, AV_LOG_ERROR, "nmean too large\n");
return AVERROR_INVALIDDATA;
}
- if(s->blocksize + s->nwrap >= UINT_MAX/sizeof(int32_t) || s->blocksize + s->nwrap <= (unsigned)s->nwrap){
- av_log(s->avctx, AV_LOG_ERROR, "s->blocksize + s->nwrap too large\n");
+ if (s->blocksize + s->nwrap >= UINT_MAX / sizeof(int32_t) ||
+ s->blocksize + s->nwrap <= (unsigned)s->nwrap) {
+ av_log(s->avctx, AV_LOG_ERROR,
+ "s->blocksize + s->nwrap too large\n");
return AVERROR_INVALIDDATA;
}
- tmp_ptr = av_realloc(s->offset[chan], sizeof(int32_t)*FFMAX(1, s->nmean));
+ tmp_ptr =
+ av_realloc(s->offset[chan], sizeof(int32_t) * FFMAX(1, s->nmean));
if (!tmp_ptr)
return AVERROR(ENOMEM);
s->offset[chan] = tmp_ptr;
@@ -150,7 +153,7 @@ static int allocate_buffers(ShortenContext *s)
if (!tmp_ptr)
return AVERROR(ENOMEM);
s->decoded_base[chan] = tmp_ptr;
- for (i=0; i<s->nwrap; i++)
+ for (i = 0; i < s->nwrap; i++)
s->decoded_base[chan][i] = 0;
s->decoded[chan] = s->decoded_base[chan] + s->nwrap;
}
@@ -163,15 +166,13 @@ static int allocate_buffers(ShortenContext *s)
return 0;
}
-
static inline unsigned int get_uint(ShortenContext *s, int k)
{
if (s->version != 0)
k = get_ur_golomb_shorten(&s->gb, ULONGSIZE);
return get_ur_golomb_shorten(&s->gb, k);
}
-
static void fix_bitshift(ShortenContext *s, int32_t *buffer)
{
int i;
@@ -181,26 +182,24 @@ static void fix_bitshift(ShortenContext *s, int32_t *buffer)
buffer[i] <<= s->bitshift;
}
-
static int init_offset(ShortenContext *s)
{
int32_t mean = 0;
- int chan, i;
+ int chan, i;
int nblock = FFMAX(1, s->nmean);
/* initialise offset */
- switch (s->internal_ftype)
- {
- case TYPE_U8:
- s->avctx->sample_fmt = AV_SAMPLE_FMT_U8P;
- mean = 0x80;
- break;
- case TYPE_S16HL:
- case TYPE_S16LH:
- s->avctx->sample_fmt = AV_SAMPLE_FMT_S16P;
- break;
- default:
- av_log(s->avctx, AV_LOG_ERROR, "unknown audio type\n");
- return AVERROR_PATCHWELCOME;
+ switch (s->internal_ftype) {
+ case TYPE_U8:
+ s->avctx->sample_fmt = AV_SAMPLE_FMT_U8P;
+ mean = 0x80;
+ break;
+ case TYPE_S16HL:
+ case TYPE_S16LH:
+ s->avctx->sample_fmt = AV_SAMPLE_FMT_S16P;
+ break;
+ default:
+ av_log(s->avctx, AV_LOG_ERROR, "unknown audio type\n");
+ return AVERROR_PATCHWELCOME;
}
for (chan = 0; chan < s->channels; chan++)
@@ -216,21 +215,21 @@ static int decode_wave_header(AVCodecContext *avctx, const uint8_t *header,
short wave_format;
const uint8_t *end= header + header_size;
- if (bytestream_get_le32(&header) != MKTAG('R','I','F','F')) {
+ if (bytestream_get_le32(&header) != MKTAG('R', 'I', 'F', 'F')) {
av_log(avctx, AV_LOG_ERROR, "missing RIFF tag\n");
return AVERROR_INVALIDDATA;
}
- header += 4; /* chunk size */;
+ header += 4; /* chunk size */
- if (bytestream_get_le32(&header) != MKTAG('W','A','V','E')) {
+ if (bytestream_get_le32(&header) != MKTAG('W', 'A', 'V', 'E')) {
av_log(avctx, AV_LOG_ERROR, "missing WAVE tag\n");
return AVERROR_INVALIDDATA;
}
- while (bytestream_get_le32(&header) != MKTAG('f','m','t',' ')) {
- len = bytestream_get_le32(&header);
- if(len<0 || end - header - 8 < len)
+ while (bytestream_get_le32(&header) != MKTAG('f', 'm', 't', ' ')) {
+ len = bytestream_get_le32(&header);
+ if (len<0 || end - header - 8 < len)
return AVERROR_INVALIDDATA;
header += len;
}
@@ -244,11 +243,11 @@ static int decode_wave_header(AVCodecContext *avctx, const uint8_t *header,
wave_format = bytestream_get_le16(&header);
switch (wave_format) {
- case WAVE_FORMAT_PCM:
- break;
- default:
- av_log(avctx, AV_LOG_ERROR, "unsupported wave format\n");
- return AVERROR_PATCHWELCOME;
+ case WAVE_FORMAT_PCM:
+ break;
+ default:
+ av_log(avctx, AV_LOG_ERROR, "unsupported wave format\n");
+ return AVERROR(ENOSYS);
}
header += 2; // skip channels (already got from shorten header)
@@ -260,7 +259,7 @@ static int decode_wave_header(AVCodecContext *avctx, const uint8_t *header,
if (bps != 16 && bps != 8) {
av_log(avctx, AV_LOG_ERROR, "unsupported number of bits per sample: %d\n", bps);
- return AVERROR_INVALIDDATA;
+ return AVERROR(ENOSYS);
}
len -= 16;
@@ -286,19 +285,20 @@ static int decode_subframe_lpc(ShortenContext *s, int command, int channel,
/* read/validate prediction order */
pred_order = get_ur_golomb_shorten(&s->gb, LPCQSIZE);
if (pred_order > s->nwrap) {
- av_log(s->avctx, AV_LOG_ERROR, "invalid pred_order %d\n", pred_order);
+ av_log(s->avctx, AV_LOG_ERROR, "invalid pred_order %d\n",
+ pred_order);
return AVERROR(EINVAL);
}
/* read LPC coefficients */
- for (i=0; i<pred_order; i++)
+ for (i = 0; i < pred_order; i++)
s->coeffs[i] = get_sr_golomb_shorten(&s->gb, LPCQUANT);
coeffs = s->coeffs;
qshift = LPCQUANT;
} else {
/* fixed LPC coeffs */
pred_order = command;
- coeffs = fixed_coeffs[pred_order-1];
+ coeffs = fixed_coeffs[pred_order - 1];
qshift = 0;
}
@@ -309,11 +309,12 @@ static int decode_subframe_lpc(ShortenContext *s, int command, int channel,
/* decode residual and do LPC prediction */
init_sum = pred_order ? (command == FN_QLPC ? s->lpcqoffset : 0) : coffset;
- for (i=0; i < s->blocksize; i++) {
+ for (i = 0; i < s->blocksize; i++) {
sum = init_sum;
- for (j=0; j<pred_order; j++)
- sum += coeffs[j] * s->decoded[channel][i-j-1];
- s->decoded[channel][i] = get_sr_golomb_shorten(&s->gb, residual_size) + (sum >> qshift);
+ for (j = 0; j < pred_order; j++)
+ sum += coeffs[j] * s->decoded[channel][i - j - 1];
+ s->decoded[channel][i] = get_sr_golomb_shorten(&s->gb, residual_size) +
+ (sum >> qshift);
}
/* add offset to current samples */
@@ -334,14 +335,18 @@ static int read_header(ShortenContext *s)
return AVERROR_INVALIDDATA;
}
- s->lpcqoffset = 0;
- s->blocksize = DEFAULT_BLOCK_SIZE;
- s->nmean = -1;
- s->version = get_bits(&s->gb, 8);
+ s->lpcqoffset = 0;
+ s->blocksize = DEFAULT_BLOCK_SIZE;
+ s->nmean = -1;
+ s->version = get_bits(&s->gb, 8);
s->internal_ftype = get_uint(s, TYPESIZE);
s->channels = get_uint(s, CHANSIZE);
- if (s->channels <= 0 || s->channels > MAX_CHANNELS) {
+ if (!s->channels) {
+ av_log(s->avctx, AV_LOG_ERROR, "No channels reported\n");
+ return AVERROR_INVALIDDATA;
+ }
+ if (s->channels > MAX_CHANNELS) {
av_log(s->avctx, AV_LOG_ERROR, "too many channels: %d\n", s->channels);
s->channels = 0;
return AVERROR_INVALIDDATA;
@@ -350,23 +355,24 @@ static int read_header(ShortenContext *s)
/* get blocksize if version > 0 */
if (s->version > 0) {
- int skip_bytes, blocksize;
+ int skip_bytes;
+ unsigned blocksize;
blocksize = get_uint(s, av_log2(DEFAULT_BLOCK_SIZE));
if (!blocksize || blocksize > MAX_BLOCKSIZE) {
- av_log(s->avctx, AV_LOG_ERROR, "invalid or unsupported block size: %d\n",
+ av_log(s->avctx, AV_LOG_ERROR,
+ "invalid or unsupported block size: %d\n",
blocksize);
return AVERROR(EINVAL);
}
s->blocksize = blocksize;
- maxnlpc = get_uint(s, LPCQSIZE);
+ maxnlpc = get_uint(s, LPCQSIZE);
s->nmean = get_uint(s, 0);
skip_bytes = get_uint(s, NSKIPSIZE);
- for (i=0; i<skip_bytes; i++) {
+ for (i = 0; i < skip_bytes; i++)
skip_bits(&s->gb, 8);
- }
}
s->nwrap = FFMAX(NWRAP, maxnlpc);
@@ -380,17 +386,20 @@ static int read_header(ShortenContext *s)
s->lpcqoffset = V2LPCQOFFSET;
if (get_ur_golomb_shorten(&s->gb, FNSIZE) != FN_VERBATIM) {
- av_log(s->avctx, AV_LOG_ERROR, "missing verbatim section at beginning of stream\n");
+ av_log(s->avctx, AV_LOG_ERROR,
+ "missing verbatim section at beginning of stream\n");
return AVERROR_INVALIDDATA;
}
s->header_size = get_ur_golomb_shorten(&s->gb, VERBATIM_CKSIZE_SIZE);
- if (s->header_size >= OUT_BUFFER_SIZE || s->header_size < CANONICAL_HEADER_SIZE) {
- av_log(s->avctx, AV_LOG_ERROR, "header is wrong size: %d\n", s->header_size);
+ if (s->header_size >= OUT_BUFFER_SIZE ||
+ s->header_size < CANONICAL_HEADER_SIZE) {
+ av_log(s->avctx, AV_LOG_ERROR, "header is wrong size: %d\n",
+ s->header_size);
return AVERROR_INVALIDDATA;
}
- for (i=0; i<s->header_size; i++)
+ for (i = 0; i < s->header_size; i++)
s->header[i] = (char)get_ur_golomb_shorten(&s->gb, VERBATIM_BYTE_SIZE);
if ((ret = decode_wave_header(s->avctx, s->header, s->header_size)) < 0)
@@ -408,15 +417,15 @@ static int shorten_decode_frame(AVCodecContext *avctx, void *data,
int *got_frame_ptr, AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
- int buf_size = avpkt->size;
- ShortenContext *s = avctx->priv_data;
+ int buf_size = avpkt->size;
+ ShortenContext *s = avctx->priv_data;
int i, input_buf_size = 0;
int ret;
/* allocate internal bitstream buffer */
- if(s->max_framesize == 0){
+ if (s->max_framesize == 0) {
void *tmp_ptr;
- s->max_framesize= 8192; // should hopefully be enough for the first header
+ s->max_framesize = 8192; // should hopefully be enough for the first header
tmp_ptr = av_fast_realloc(s->bitstream, &s->allocated_bitstream_size,
s->max_framesize);
if (!tmp_ptr) {
@@ -427,29 +436,32 @@ static int shorten_decode_frame(AVCodecContext *avctx, void *data,
}
/* append current packet data to bitstream buffer */
- if(1 && s->max_framesize){//FIXME truncated
- buf_size= FFMIN(buf_size, s->max_framesize - s->bitstream_size);
- input_buf_size= buf_size;
-
- if(s->bitstream_index + s->bitstream_size + buf_size > s->allocated_bitstream_size){
- memmove(s->bitstream, &s->bitstream[s->bitstream_index], s->bitstream_size);
- s->bitstream_index=0;
+ if (1 && s->max_framesize) { //FIXME truncated
+ buf_size = FFMIN(buf_size, s->max_framesize - s->bitstream_size);
+ input_buf_size = buf_size;
+
+ if (s->bitstream_index + s->bitstream_size + buf_size >
+ s->allocated_bitstream_size) {
+ memmove(s->bitstream, &s->bitstream[s->bitstream_index],
+ s->bitstream_size);
+ s->bitstream_index = 0;
}
if (buf)
- memcpy(&s->bitstream[s->bitstream_index + s->bitstream_size], buf, buf_size);
- buf= &s->bitstream[s->bitstream_index];
- buf_size += s->bitstream_size;
- s->bitstream_size= buf_size;
+ memcpy(&s->bitstream[s->bitstream_index + s->bitstream_size], buf,
+ buf_size);
+ buf = &s->bitstream[s->bitstream_index];
+ buf_size += s->bitstream_size;
+ s->bitstream_size = buf_size;
/* do not decode until buffer has at least max_framesize bytes or
- the end of the file has been reached */
+ * the end of the file has been reached */
if (buf_size < s->max_framesize && avpkt->data) {
*got_frame_ptr = 0;
return input_buf_size;
}
}
/* init and position bitstream reader */
- init_get_bits(&s->gb, buf, buf_size*8);
+ init_get_bits(&s->gb, buf, buf_size * 8);
skip_bits(&s->gb, s->bitindex);
/* process header or next subblock */
@@ -471,7 +483,7 @@ static int shorten_decode_frame(AVCodecContext *avctx, void *data,
unsigned int cmd;
int len;
- if (get_bits_left(&s->gb) < 3+FNSIZE) {
+ if (get_bits_left(&s->gb) < 3 + FNSIZE) {
*got_frame_ptr = 0;
break;
}
@@ -487,32 +499,32 @@ static int shorten_decode_frame(AVCodecContext *avctx, void *data,
if (!is_audio_command[cmd]) {
/* process non-audio command */
switch (cmd) {
- case FN_VERBATIM:
- len = get_ur_golomb_shorten(&s->gb, VERBATIM_CKSIZE_SIZE);
- while (len--) {
- get_ur_golomb_shorten(&s->gb, VERBATIM_BYTE_SIZE);
- }
- break;
- case FN_BITSHIFT:
- s->bitshift = get_ur_golomb_shorten(&s->gb, BITSHIFTSIZE);
- break;
- case FN_BLOCKSIZE: {
- int blocksize = get_uint(s, av_log2(s->blocksize));
- if (blocksize > s->blocksize) {
- av_log(avctx, AV_LOG_ERROR, "Increasing block size is not supported\n");
- return AVERROR_PATCHWELCOME;
- }
- if (!blocksize || blocksize > MAX_BLOCKSIZE) {
- av_log(avctx, AV_LOG_ERROR, "invalid or unsupported "
- "block size: %d\n", blocksize);
- return AVERROR(EINVAL);
- }
- s->blocksize = blocksize;
- break;
+ case FN_VERBATIM:
+ len = get_ur_golomb_shorten(&s->gb, VERBATIM_CKSIZE_SIZE);
+ while (len--)
+ get_ur_golomb_shorten(&s->gb, VERBATIM_BYTE_SIZE);
+ break;
+ case FN_BITSHIFT:
+ s->bitshift = get_ur_golomb_shorten(&s->gb, BITSHIFTSIZE);
+ break;
+ case FN_BLOCKSIZE: {
+ unsigned blocksize = get_uint(s, av_log2(s->blocksize));
+ if (blocksize > s->blocksize) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Increasing block size is not supported\n");
+ return AVERROR_PATCHWELCOME;
+ }
+ if (!blocksize || blocksize > MAX_BLOCKSIZE) {
+ av_log(avctx, AV_LOG_ERROR, "invalid or unsupported "
+ "block size: %d\n", blocksize);
+ return AVERROR(EINVAL);
}
- case FN_QUIT:
- s->got_quit_command = 1;
- break;
+ s->blocksize = blocksize;
+ break;
+ }
+ case FN_QUIT:
+ s->got_quit_command = 1;
+ break;
}
if (cmd == FN_BLOCKSIZE || cmd == FN_QUIT) {
*got_frame_ptr = 0;
@@ -538,7 +550,7 @@ static int shorten_decode_frame(AVCodecContext *avctx, void *data,
coffset = s->offset[channel][0];
else {
int32_t sum = (s->version < 2) ? 0 : s->nmean / 2;
- for (i=0; i<s->nmean; i++)
+ for (i = 0; i < s->nmean; i++)
sum += s->offset[channel][i];
coffset = sum / s->nmean;
if (s->version >= 2)
@@ -547,21 +559,22 @@ static int shorten_decode_frame(AVCodecContext *avctx, void *data,
/* decode samples for this channel */
if (cmd == FN_ZERO) {
- for (i=0; i<s->blocksize; i++)
+ for (i = 0; i < s->blocksize; i++)
s->decoded[channel][i] = 0;
} else {
- if ((ret = decode_subframe_lpc(s, cmd, channel, residual_size, coffset)) < 0)
+ if ((ret = decode_subframe_lpc(s, cmd, channel,
+ residual_size, coffset)) < 0)
return ret;
}
/* update means with info from the current block */
if (s->nmean > 0) {
int32_t sum = (s->version < 2) ? 0 : s->blocksize / 2;
- for (i=0; i<s->blocksize; i++)
+ for (i = 0; i < s->blocksize; i++)
sum += s->decoded[channel][i];
- for (i=1; i<s->nmean; i++)
- s->offset[channel][i-1] = s->offset[channel][i];
+ for (i = 1; i < s->nmean; i++)
+ s->offset[channel][i - 1] = s->offset[channel][i];
if (s->version < 2)
s->offset[channel][s->nmean - 1] = sum / s->blocksize;
@@ -570,11 +583,11 @@ static int shorten_decode_frame(AVCodecContext *avctx, void *data,
}
/* copy wrap samples for use with next block */
- for (i=-s->nwrap; i<0; i++)
+ for (i = -s->nwrap; i < 0; i++)
s->decoded[channel][i] = s->decoded[channel][i + s->blocksize];
/* shift samples to add in unused zero bits which were removed
- during encoding */
+ * during encoding */
fix_bitshift(s, s->decoded[channel]);
/* if this is the last channel in the block, output the samples */
@@ -617,12 +630,12 @@ static int shorten_decode_frame(AVCodecContext *avctx, void *data,
*got_frame_ptr = 0;
finish_frame:
- s->bitindex = get_bits_count(&s->gb) - 8*((get_bits_count(&s->gb))/8);
- i= (get_bits_count(&s->gb))/8;
+ s->bitindex = get_bits_count(&s->gb) - 8 * (get_bits_count(&s->gb) / 8);
+ i = get_bits_count(&s->gb) / 8;
if (i > buf_size) {
av_log(s->avctx, AV_LOG_ERROR, "overread: %d\n", i - buf_size);
- s->bitstream_size=0;
- s->bitstream_index=0;
+ s->bitstream_size = 0;
+ s->bitstream_index = 0;
return AVERROR_INVALIDDATA;
}
if (s->bitstream_size) {
View
2 mythtv/external/FFmpeg/libavcodec/vmdav.c
@@ -624,7 +624,7 @@ static int vmdaudio_decode_frame(AVCodecContext *avctx, void *data,
/* decode audio chunks */
if (audio_chunks > 0) {
buf_end = buf + buf_size;
- while ( buf_end - buf >= s->chunk_size) {
+ while (buf_end - buf >= s->chunk_size) {
if (s->out_bps == 2) {
decode_audio_s16(output_samples_s16, buf, s->chunk_size,
avctx->channels);
View
5 mythtv/external/FFmpeg/libavcodec/wmadec.c
@@ -72,6 +72,11 @@ static int wma_decode_init(AVCodecContext * avctx)
int i, flags2;
uint8_t *extradata;
+ if (!avctx->block_align) {
+ av_log(avctx, AV_LOG_ERROR, "block_align is not set\n");
+ return AVERROR(EINVAL);
+ }
+
s->avctx = avctx;
/* extract flag infos */
View
12 mythtv/external/FFmpeg/libavcodec/wmaprodec.c
@@ -280,6 +280,11 @@ static av_cold int decode_init(AVCodecContext *avctx)
int log2_max_num_subframes;
int num_possible_block_sizes;
+ if (!avctx->block_align) {
+ av_log(avctx, AV_LOG_ERROR, "block_align is not set\n");
+ return AVERROR(EINVAL);
+ }
+
s->avctx = avctx;
ff_dsputil_init(&s->dsp, avctx);
avpriv_float_dsp_init(&s->fdsp, avctx->flags & CODEC_FLAG_BITEXACT);
@@ -1515,8 +1520,11 @@ static int decode_packet(AVCodecContext *avctx, void *data,
s->packet_done = 0;
/** sanity check for the buffer length */
- if (buf_size < avctx->block_align)
- return 0;
+ if (buf_size < avctx->block_align) {
+ av_log(avctx, AV_LOG_ERROR, "Input packet too small (%d < %d)\n",
+ buf_size, avctx->block_align);
+ return AVERROR_INVALIDDATA;
+ }
s->next_packet_start = buf_size - avctx->block_align;
buf_size = avctx->block_align;
View
2 mythtv/external/FFmpeg/libavcodec/xxan.c
@@ -315,7 +315,7 @@ static int xan_decode_frame_type0(AVCodecContext *avctx)
int dec_size;
bytestream2_seek(&s->gb, 8 + corr_off, SEEK_SET);
- dec_size = xan_unpack(s, s->scratch_buffer, s->buffer_size);
+ dec_size = xan_unpack(s, s->scratch_buffer, s->buffer_size / 2);
if (dec_size < 0)
dec_size = 0;
else
View
3 mythtv/external/FFmpeg/libavfilter/vf_gradfun.c
@@ -201,12 +201,13 @@ static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *in)
GradFunContext *gf = inlink->dst->priv;
AVFilterLink *outlink = inlink->dst->outputs[0];
AVFilterBufferRef *out;
- int p, direct = 0;
+ int p, direct;
if (in->perms & AV_PERM_WRITE) {
direct = 1;
out = in;
} else {
+ direct = 0;
out = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
if (!out) {
avfilter_unref_bufferp(&in);
View
10 mythtv/external/FFmpeg/libavfilter/vf_hqdn3d.c
@@ -50,9 +50,10 @@ void ff_hqdn3d_row_10_x86(uint8_t *src, uint8_t *dst, uint16_t *line_ant, uint16
void ff_hqdn3d_row_16_x86(uint8_t *src, uint8_t *dst, uint16_t *line_ant, uint16_t *frame_ant, ptrdiff_t w, int16_t *spatial, int16_t *temporal);
#define LUT_BITS (depth==16 ? 8 : 4)
-#define LOAD(x) (((depth==8 ? src[x] : AV_RN16A(src+(x)*2)) << (16-depth)) + (((1<<(16-depth))-1)>>1))
-#define STORE(x,val) (depth==8 ? dst[x] = (val) >> (16-depth)\
- : AV_WN16A(dst+(x)*2, (val) >> (16-depth)))
+#define LOAD(x) (((depth == 8 ? src[x] : AV_RN16A(src + (x) * 2)) << (16 - depth))\
+ + (((1 << (16 - depth)) - 1) >> 1))
+#define STORE(x,val) (depth == 8 ? dst[x] = (val) >> (16 - depth) : \
+ AV_WN16A(dst + (x) * 2, (val) >> (16 - depth)))
av_always_inline
static uint32_t lowpass(int prev, int cur, int16_t *coef, int depth)
@@ -327,12 +328,13 @@ static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *in)
AVFilterLink *outlink = inlink->dst->outputs[0];
AVFilterBufferRef *out;
- int direct = 0, c;
+ int direct, c;
if (in->perms & AV_PERM_WRITE) {
direct = 1;
out = in;
} else {
+ direct = 0;
out = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
if (!out) {
avfilter_unref_bufferp(&in);
View
8 mythtv/external/FFmpeg/libavformat/flacdec.c
@@ -277,11 +277,9 @@ static int flac_read_header(AVFormatContext *s)
static int flac_probe(AVProbeData *p)
{
- const uint8_t *bufptr = p->buf;
- const uint8_t *end = p->buf + p->buf_size;
-
- if(bufptr > end-4 || memcmp(bufptr, "fLaC", 4)) return 0;
- else return AVPROBE_SCORE_MAX/2;
+ if (p->buf_size < 4 || memcmp(p->buf, "fLaC", 4))
+ return 0;
+ return AVPROBE_SCORE_MAX/2;
}
AVInputFormat ff_flac_demuxer = {
View
3 mythtv/external/FFmpeg/libavformat/flvenc.c
@@ -493,10 +493,13 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt)
return ret;
} else if (enc->codec_id == AV_CODEC_ID_AAC && pkt->size > 2 &&
(AV_RB16(pkt->data) & 0xfff0) == 0xfff0) {
+ if (!s->streams[pkt->stream_index]->nb_frames) {
av_log(s, AV_LOG_ERROR, "Malformed AAC bitstream detected: "
"use audio bitstream filter 'aac_adtstoasc' to fix it "
"('-bsf:a aac_adtstoasc' option with ffmpeg)\n");
return AVERROR_INVALIDDATA;
+ }
+ av_log(s, AV_LOG_WARNING, "aac bitstream error\n");
}
if (flv->delay == AV_NOPTS_VALUE)
View
2 mythtv/external/FFmpeg/libavformat/hls.c
@@ -560,12 +560,14 @@ static int hls_read_header(AVFormatContext *s)
/* Create new AVStreams for each stream in this variant */
for (j = 0; j < v->ctx->nb_streams; j++) {
AVStream *st = avformat_new_stream(s, NULL);
+ AVStream *ist = v->ctx->streams[j];
if (!st) {
ret = AVERROR(ENOMEM);
goto fail;
}
ff_program_add_stream_index(s, i, stream_offset + j);
st->id = i;
+ avpriv_set_pts_info(st, ist->pts_wrap_bits, ist->time_base.num, ist->time_base.den);
avcodec_copy_context(st->codec, v->ctx->streams[j]->codec);
if (v->bandwidth)
av_dict_set(&st->metadata, "variant_bitrate", bitrate_str,
View
3 mythtv/external/FFmpeg/libavformat/iff.c
@@ -249,6 +249,8 @@ static int iff_read_header(AVFormatContext *s)
break;
case ID_CMAP:
+ if (data_size > INT_MAX - IFF_EXTRA_VIDEO_SIZE - FF_INPUT_BUFFER_PADDING_SIZE)
+ return AVERROR_INVALIDDATA;
st->codec->extradata_size = data_size + IFF_EXTRA_VIDEO_SIZE;
st->codec->extradata = av_malloc(data_size + IFF_EXTRA_VIDEO_SIZE + FF_INPUT_BUFFER_PADDING_SIZE);
if (!st->codec->extradata)
@@ -409,6 +411,7 @@ static int iff_read_header(AVFormatContext *s)
if (!st->codec->extradata)
return AVERROR(ENOMEM);
}
+ av_assert0(st->codec->extradata_size >= IFF_EXTRA_VIDEO_SIZE);
buf = st->codec->extradata;
bytestream_put_be16(&buf, IFF_EXTRA_VIDEO_SIZE);
bytestream_put_byte(&buf, iff->bitmap_compression);
View
3 mythtv/external/FFmpeg/libavformat/movenc.c
@@ -3178,8 +3178,11 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
}
} else if (enc->codec_id == AV_CODEC_ID_AAC && pkt->size > 2 &&
(AV_RB16(pkt->data) & 0xfff0) == 0xfff0) {
+ if (!s->streams[pkt->stream_index]->nb_frames) {
av_log(s, AV_LOG_ERROR, "malformated aac bitstream, use -absf aac_adtstoasc\n");
return -1;
+ }
+ av_log(s, AV_LOG_WARNING, "aac bitstream error\n");
} else {
avio_write(pb, pkt->data, size);
}
View
6 mythtv/external/FFmpeg/libavformat/mp3dec.c
@@ -120,6 +120,7 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base)
const int64_t xing_offtbl[2][2] = {{32, 17}, {17,9}};
MPADecodeHeader c;
int vbrtag_size = 0;
+ int is_cbr;
v = avio_rb32(s->pb);
if(ff_mpa_check_header(v) < 0)
@@ -135,7 +136,8 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base)
/* Check for Xing / Info tag */
avio_skip(s->pb, xing_offtbl[c.lsf == 1][c.nb_channels == 1]);
v = avio_rb32(s->pb);
- if(v == MKBETAG('X', 'i', 'n', 'g') || v == MKBETAG('I', 'n', 'f', 'o')) {
+ is_cbr = v == MKBETAG('I', 'n', 'f', 'o');
+ if (v == MKBETAG('X', 'i', 'n', 'g') || is_cbr) {
v = avio_rb32(s->pb);
if(v & XING_FLAG_FRAMES)
frames = avio_rb32(s->pb);
@@ -180,7 +182,7 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base)
if(frames)
st->duration = av_rescale_q(frames, (AVRational){spf, c.sample_rate},
st->time_base);
- if(size && frames)
+ if (size && frames && !is_cbr)
st->codec->bit_rate = av_rescale(size, 8 * c.sample_rate, frames * (int64_t)spf);
return 0;
View
14 mythtv/external/FFmpeg/libavformat/mpegts.c
@@ -208,9 +208,6 @@ static void clear_program(MpegTSContext *ts, unsigned int programid)
static void clear_programs(MpegTSContext *ts)
{
- int i;
- for(i=0; i<ts->nb_prg; i++)
- clear_avprogram(ts, ts->prg[i].id);
av_freep(&ts->prg);
ts->nb_prg=0;
}
@@ -1634,6 +1631,17 @@ static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
add_pid_to_pmt(ts, sid, pmt_pid);
}
}
+
+ if (sid < 0) {
+ int i,j;
+ for (j=0; j<ts->stream->nb_programs; j++) {
+ for (i=0; i<ts->nb_prg; i++)
+ if (ts->prg[i].id == ts->stream->programs[j]->id)
+ break;
+ if (i==ts->nb_prg)
+ clear_avprogram(ts, ts->stream->programs[j]->id);
+ }
+ }
}
static void sdt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len)
View
13 mythtv/external/FFmpeg/libavformat/rmdec.c
@@ -995,6 +995,18 @@ static int64_t rm_read_dts(AVFormatContext *s, int stream_index,
return dts;
}
+static int rm_read_seek(AVFormatContext *s, int stream_index,
+ int64_t pts, int flags)
+{
+ RMDemuxContext *rm = s->priv_data;
+
+ if (ff_seek_frame_binary(s, stream_index, pts, flags) < 0)
+ return -1;
+ rm->audio_pkt_cnt = 0;
+ return 0;
+}
+
+
AVInputFormat ff_rm_demuxer = {
.name = "rm",
.long_name = NULL_IF_CONFIG_SMALL("RealMedia"),
@@ -1004,6 +1016,7 @@ AVInputFormat ff_rm_demuxer = {
.read_packet = rm_read_packet,
.read_close = rm_read_close,
.read_timestamp = rm_read_dts,
+ .read_seek = rm_read_seek,
};
AVInputFormat ff_rdt_demuxer = {
View
2 mythtv/external/FFmpeg/libavformat/utils.c
@@ -643,7 +643,7 @@ int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputForma
goto fail;
if (id3v2_extra_meta) {
- if (!strcmp(s->iformat->name, "mp3")) {
+ if (!strcmp(s->iformat->name, "mp3") || !strcmp(s->iformat->name, "aac")) {
if((ret = ff_id3v2_parse_apic(s, &id3v2_extra_meta)) < 0)
goto fail;
} else
View
3 mythtv/external/FFmpeg/libavutil/lzo.c
@@ -110,9 +110,8 @@ static inline void copy(LZOContext *c, int cnt)
*/
static inline void copy_backptr(LZOContext *c, int back, int cnt)
{
- register const uint8_t *src = &c->out[-back];
register uint8_t *dst = c->out;
- if (src < c->out_start || src > dst) {
+ if (dst - c->out_start < back) {
c->error |= AV_LZO_INVALID_BACKPTR;
return;
}
View
4 mythtv/external/FFmpeg/tests/ref/lavf-fate/mp3
@@ -1,3 +1,3 @@
-40a4e41ae74ec8dacdf02402831a6a58 *./tests/data/lavf-fate/lavf.mp3
-97230 ./tests/data/lavf-fate/lavf.mp3
+7fcf80c2059b5c058a6cdd2e2f798b6c *./tests/data/lavf-fate/lavf.mp3
+96366 ./tests/data/lavf-fate/lavf.mp3
./tests/data/lavf-fate/lavf.mp3 CRC=0x6c9850fe
View
6 mythtv/external/FFmpeg/tests/ref/lavf/dpx
@@ -1,9 +1,9 @@
-808ea110635774252439722a48329d61 *./tests/data/images/dpx/02.dpx
+d2f0b4e854fda2d3b3bee84cef80593c *./tests/data/images/dpx/02.dpx
./tests/data/images/dpx/%02d.dpx CRC=0x6da01946
305792 ./tests/data/images/dpx/02.dpx
-5e1a777fa3f4094c9c4dd989cf9e8e8b *./tests/data/images/dpx/02.dpx
+075963c3c08978b6a20555ba09161434 *./tests/data/images/dpx/02.dpx
./tests/data/images/dpx/%02d.dpx CRC=0xe5b9c023
609920 ./tests/data/images/dpx/02.dpx
-13dc41b1e1e36399a5e1f8b7e3344a81 *./tests/data/images/dpx/02.dpx
+b9f22728f8ff393bf30cf6cbd624fa95 *./tests/data/images/dpx/02.dpx
./tests/data/images/dpx/%02d.dpx CRC=0xf0a1c097
407168 ./tests/data/images/dpx/02.dpx

0 comments on commit 0770c5d

Please sign in to comment.