Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

FFmpeg resync to SHA1:f218121a4d79f9aab45526f3d1655ec2cc8de0d1

  • Loading branch information...
commit ed69ea820b717cbdfd17ec10c6d78e63f6b6d789 1 parent cc72081
@jyavenard jyavenard authored
Showing with 465 additions and 179 deletions.
  1. +2 −2 mythtv/configure
  2. +1 −0  mythtv/external/FFmpeg/README.sync
  3. +3 −3 mythtv/external/FFmpeg/configure
  4. +1 −0  mythtv/external/FFmpeg/ffmpeg.c
  5. +1 −1  mythtv/external/FFmpeg/libavcodec/8svx.c
  6. +8 −8 mythtv/external/FFmpeg/libavcodec/dnxhdenc.c
  7. +5 −0 mythtv/external/FFmpeg/libavcodec/gif.c
  8. +15 −12 mythtv/external/FFmpeg/libavcodec/h264.c
  9. +6 −6 mythtv/external/FFmpeg/libavcodec/h264.h
  10. +0 −5 mythtv/external/FFmpeg/libavcodec/h264data.h
  11. +2 −1  mythtv/external/FFmpeg/libavcodec/libmp3lame.c
  12. +5 −0 mythtv/external/FFmpeg/libavcodec/mjpegenc.c
  13. +4 −0 mythtv/external/FFmpeg/libavcodec/mpeg4videodec.c
  14. +2 −1  mythtv/external/FFmpeg/libavcodec/qdm2.c
  15. +5 −0 mythtv/external/FFmpeg/libavcodec/sgienc.c
  16. +20 −18 mythtv/external/FFmpeg/libavcodec/vp8.c
  17. +12 −7 mythtv/external/FFmpeg/libavfilter/af_amix.c
  18. +111 −0 mythtv/external/FFmpeg/libavfilter/bufferqueue.h
  19. +2 −0  mythtv/external/FFmpeg/libavfilter/sink_buffer.c
  20. +154 −71 mythtv/external/FFmpeg/libavfilter/vf_overlay.c
  21. +10 −3 mythtv/external/FFmpeg/libavformat/avio.c
  22. +0 −3  mythtv/external/FFmpeg/libavformat/dv.c
  23. +37 −17 mythtv/external/FFmpeg/libavformat/http.c
  24. +5 −2 mythtv/external/FFmpeg/libavformat/jacosubdec.c
  25. +12 −2 mythtv/external/FFmpeg/libavformat/mxfenc.c
  26. +2 −2 mythtv/external/FFmpeg/libavformat/oggparsevorbis.c
  27. +8 −0 mythtv/external/FFmpeg/libavformat/tcp.c
  28. +2 −1  mythtv/external/FFmpeg/libavformat/url.h
  29. +1 −1  mythtv/external/FFmpeg/libavutil/avutil.h
  30. +18 −0 mythtv/external/FFmpeg/libavutil/log.h
  31. +3 −3 mythtv/external/FFmpeg/libswresample/swresample.c
  32. +7 −5 mythtv/external/FFmpeg/tests/fate/acodec.mak
  33. +1 −1  mythtv/external/FFmpeg/tests/md5.sh
  34. +0 −4 mythtv/external/FFmpeg/tests/ref/fate/acodec-ra144
View
4 mythtv/configure
@@ -2017,9 +2017,9 @@ avformat_deps="avcodec"
postproc_deps="gpl"
# programs
-ffmpeg_deps="avcodec avfilter avformat swscale swresample
+ffmpeg_deps="avcodec avfilter avformat swscale swresample"
+ffmpeg_select="buffersink_filter format_filter aformat_filter
setpts_filter"
-ffmpeg_select="buffersink_filter format_filter aformat_filter"
ffplay_deps="avcodec avformat swscale swresample sdl"
ffplay_select="buffersink_filter rdft"
ffprobe_deps="avcodec avformat"
View
1  mythtv/external/FFmpeg/README.sync
@@ -3,6 +3,7 @@ This code was resynced upstream to:
git://source.ffmpeg.org/ffmpeg.git at SHA1 d3db8988d on March 31, 2012 (Beirdo)
git://source.ffmpeg.org/ffmpeg.git at SHA1 ea5dab58e on May 23, 2012 (jya)
git://source.ffmpeg.org/ffmpeg.git at SHA1 cc4d80c on June 1st, 2012 (jya)
+git://source.ffmpeg.org/ffmpeg.git at SHA1 f218121 on June 1st, 2012 (jya)
List of files modified from original FFmpeg:
Makefile
View
6 mythtv/external/FFmpeg/configure
@@ -1709,9 +1709,9 @@ avformat_deps="avcodec"
postproc_deps="gpl"
# programs
-ffmpeg_deps="avcodec avfilter avformat swscale swresample
- setpts_filter"
-ffmpeg_select="buffersink_filter format_filter aformat_filter"
+ffmpeg_deps="avcodec avfilter avformat swscale swresample"
+ffmpeg_select="buffersink_filter format_filter aformat_filter
+ setpts_filter"
ffplay_deps="avcodec avformat swscale swresample sdl"
ffplay_select="buffersink_filter rdft"
ffprobe_deps="avcodec avformat"
View
1  mythtv/external/FFmpeg/ffmpeg.c
@@ -1499,6 +1499,7 @@ void av_noreturn exit_program(int ret)
output_streams[i]->bitstream_filters = NULL;
av_freep(&output_streams[i]->filtered_frame);
+ av_freep(&output_streams[i]->avfilter);
av_freep(&output_streams[i]);
}
for (i = 0; i < nb_input_files; i++) {
View
2  mythtv/external/FFmpeg/libavcodec/8svx.c
@@ -47,7 +47,7 @@ typedef struct EightSvxContext {
/* buffer used to store the whole audio decoded/interleaved chunk,
* which is sent with the first packet */
uint8_t *samples;
- size_t samples_size;
+ int64_t samples_size;
int samples_idx;
} EightSvxContext;
View
16 mythtv/external/FFmpeg/libavcodec/dnxhdenc.c
@@ -127,7 +127,7 @@ static int dnxhd_init_vlc(DNXHDEncContext *ctx)
if (ctx->cid_table->ac_level[j] >> 1 == alevel &&
(!offset || (ctx->cid_table->ac_flags[j] & 1) && offset) &&
(!run || (ctx->cid_table->ac_flags[j] & 2) && run)) {
- assert(!ctx->vlc_codes[index]);
+ av_assert1(!ctx->vlc_codes[index]);
if (alevel) {
ctx->vlc_codes[index] = (ctx->cid_table->ac_codes[j]<<1)|(sign&1);
ctx->vlc_bits [index] = ctx->cid_table->ac_bits[j]+1;
@@ -138,7 +138,7 @@ static int dnxhd_init_vlc(DNXHDEncContext *ctx)
break;
}
}
- assert(!alevel || j < 257);
+ av_assert0(!alevel || j < 257);
if (offset) {
ctx->vlc_codes[index] = (ctx->vlc_codes[index]<<ctx->cid_table->index_bits)|offset;
ctx->vlc_bits [index]+= ctx->cid_table->index_bits;
@@ -147,7 +147,7 @@ static int dnxhd_init_vlc(DNXHDEncContext *ctx)
}
for (i = 0; i < 62; i++) {
int run = ctx->cid_table->run[i];
- assert(run < 63);
+ av_assert0(run < 63);
ctx->run_codes[run] = ctx->cid_table->run_codes[i];
ctx->run_bits [run] = ctx->cid_table->run_bits[i];
}
@@ -542,7 +542,7 @@ static int dnxhd_calc_bits_thread(AVCodecContext *avctx, void *arg, int jobnr, i
if (diff < 0) nbits = av_log2_16bit(-2*diff);
else nbits = av_log2_16bit( 2*diff);
- assert(nbits < ctx->cid_table->bit_depth + 4);
+ av_assert1(nbits < ctx->cid_table->bit_depth + 4);
dc_bits += ctx->cid_table->dc_bits[nbits] + nbits;
ctx->m.last_dc[n] = block[0];
@@ -810,13 +810,13 @@ static void radix_count(const RCCMPEntry *data, int size, int buckets[RADIX_PASS
buckets[j][get_bucket(v, 0)]++;
v >>= BUCKET_BITS;
}
- assert(!v);
+ av_assert1(!v);
}
for (j = 0; j < RADIX_PASSES; j++) {
int offset = size;
for (i = NBUCKETS - 1; i >= 0; i--)
buckets[j][i] = offset -= buckets[j][i];
- assert(!buckets[j][0]);
+ av_assert1(!buckets[j][0]);
}
}
@@ -941,12 +941,12 @@ static int dnxhd_encode_picture(AVCodecContext *avctx, AVPacket *pkt,
for (i = 0; i < ctx->m.mb_height; i++) {
AV_WB32(ctx->msip + i * 4, offset);
offset += ctx->slice_size[i];
- assert(!(ctx->slice_size[i] & 3));
+ av_assert1(!(ctx->slice_size[i] & 3));
}
avctx->execute2(avctx, dnxhd_encode_thread, buf, NULL, ctx->m.mb_height);
- assert(640 + offset + 4 <= ctx->cid_table->coding_unit_size);
+ av_assert1(640 + offset + 4 <= ctx->cid_table->coding_unit_size);
memset(buf + 640 + offset, 0, ctx->cid_table->coding_unit_size - 4 - offset - 640);
AV_WB32(buf + ctx->cid_table->coding_unit_size - 4, 0x600DC0DE); // EOF
View
5 mythtv/external/FFmpeg/libavcodec/gif.c
@@ -145,6 +145,11 @@ static av_cold int gif_encode_init(AVCodecContext *avctx)
{
GIFContext *s = avctx->priv_data;
+ if (avctx->width > 65535 || avctx->height > 65535) {
+ av_log(avctx, AV_LOG_ERROR, "GIF does not support resolutions above 65535x65535\n");
+ return -1;
+ }
+
avctx->coded_frame = &s->picture;
s->lzw = av_mallocz(ff_lzw_encode_state_size);
if (!s->lzw)
View
27 mythtv/external/FFmpeg/libavcodec/h264.c
@@ -2719,19 +2719,19 @@ static void init_scan_tables(H264Context *h)
#undef T
}
if (h->sps.transform_bypass) { // FIXME same ugly
- h->zigzag_scan_q0 = zigzag_scan;
- h->zigzag_scan8x8_q0 = ff_zigzag_direct;
- h->zigzag_scan8x8_cavlc_q0 = zigzag_scan8x8_cavlc;
- h->field_scan_q0 = field_scan;
- h->field_scan8x8_q0 = field_scan8x8;
- h->field_scan8x8_cavlc_q0 = field_scan8x8_cavlc;
+ memcpy(h->zigzag_scan_q0 , zigzag_scan , sizeof(h->zigzag_scan_q0 ));
+ memcpy(h->zigzag_scan8x8_q0 , ff_zigzag_direct , sizeof(h->zigzag_scan8x8_q0 ));
+ memcpy(h->zigzag_scan8x8_cavlc_q0 , zigzag_scan8x8_cavlc , sizeof(h->zigzag_scan8x8_cavlc_q0));
+ memcpy(h->field_scan_q0 , field_scan , sizeof(h->field_scan_q0 ));
+ memcpy(h->field_scan8x8_q0 , field_scan8x8 , sizeof(h->field_scan8x8_q0 ));
+ memcpy(h->field_scan8x8_cavlc_q0 , field_scan8x8_cavlc , sizeof(h->field_scan8x8_cavlc_q0 ));
} else {
- h->zigzag_scan_q0 = h->zigzag_scan;
- h->zigzag_scan8x8_q0 = h->zigzag_scan8x8;
- h->zigzag_scan8x8_cavlc_q0 = h->zigzag_scan8x8_cavlc;
- h->field_scan_q0 = h->field_scan;
- h->field_scan8x8_q0 = h->field_scan8x8;
- h->field_scan8x8_cavlc_q0 = h->field_scan8x8_cavlc;
+ memcpy(h->zigzag_scan_q0 , h->zigzag_scan , sizeof(h->zigzag_scan_q0 ));
+ memcpy(h->zigzag_scan8x8_q0 , h->zigzag_scan8x8 , sizeof(h->zigzag_scan8x8_q0 ));
+ memcpy(h->zigzag_scan8x8_cavlc_q0 , h->zigzag_scan8x8_cavlc , sizeof(h->zigzag_scan8x8_cavlc_q0));
+ memcpy(h->field_scan_q0 , h->field_scan , sizeof(h->field_scan_q0 ));
+ memcpy(h->field_scan8x8_q0 , h->field_scan8x8 , sizeof(h->field_scan8x8_q0 ));
+ memcpy(h->field_scan8x8_cavlc_q0 , h->field_scan8x8_cavlc , sizeof(h->field_scan8x8_cavlc_q0 ));
}
}
@@ -4399,6 +4399,9 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size)
init_get_bits(&hx->inter_gb, ptr, bit_length);
hx->inter_gb_ptr = &hx->inter_gb;
+ av_log(h->s.avctx, AV_LOG_ERROR, "Partitioned H.264 support is incomplete\n");
+ return AVERROR_PATCHWELCOME;
+
if (hx->redundant_pic_count == 0 &&
hx->intra_gb_ptr &&
hx->s.data_partitioning &&
View
12 mythtv/external/FFmpeg/libavcodec/h264.h
@@ -421,12 +421,12 @@ typedef struct H264Context {
uint8_t field_scan[16];
uint8_t field_scan8x8[64];
uint8_t field_scan8x8_cavlc[64];
- const uint8_t *zigzag_scan_q0;
- const uint8_t *zigzag_scan8x8_q0;
- const uint8_t *zigzag_scan8x8_cavlc_q0;
- const uint8_t *field_scan_q0;
- const uint8_t *field_scan8x8_q0;
- const uint8_t *field_scan8x8_cavlc_q0;
+ uint8_t zigzag_scan_q0[16];
+ uint8_t zigzag_scan8x8_q0[64];
+ uint8_t zigzag_scan8x8_cavlc_q0[64];
+ uint8_t field_scan_q0[16];
+ uint8_t field_scan8x8_q0[64];
+ uint8_t field_scan8x8_cavlc_q0[64];
int x264_build;
View
5 mythtv/external/FFmpeg/libavcodec/h264data.h
@@ -57,7 +57,6 @@ static const uint8_t zigzag_scan[16+1] = {
1 + 1 * 4, 2 + 0 * 4, 3 + 0 * 4, 2 + 1 * 4,
1 + 2 * 4, 0 + 3 * 4, 1 + 3 * 4, 2 + 2 * 4,
3 + 1 * 4, 3 + 2 * 4, 2 + 3 * 4, 3 + 3 * 4,
- 0,
};
static const uint8_t field_scan[16+1] = {
@@ -65,7 +64,6 @@ static const uint8_t field_scan[16+1] = {
0 + 3 * 4, 1 + 1 * 4, 1 + 2 * 4, 1 + 3 * 4,
2 + 0 * 4, 2 + 1 * 4, 2 + 2 * 4, 2 + 3 * 4,
3 + 0 * 4, 3 + 1 * 4, 3 + 2 * 4, 3 + 3 * 4,
- 0,
};
static const uint8_t luma_dc_zigzag_scan[16] = {
@@ -112,7 +110,6 @@ static const uint8_t zigzag_scan8x8_cavlc[64+1] = {
1 + 4 * 8, 2 + 4 * 8, 6 + 0 * 8, 4 + 3 * 8,
0 + 7 * 8, 4 + 4 * 8, 7 + 2 * 8, 3 + 6 * 8,
5 + 5 * 8, 6 + 5 * 8, 6 + 6 * 8, 7 + 7 * 8,
- 0,
};
static const uint8_t field_scan8x8[64+1] = {
@@ -132,7 +129,6 @@ static const uint8_t field_scan8x8[64+1] = {
7 + 0 * 8, 7 + 1 * 8, 6 + 4 * 8, 6 + 5 * 8,
6 + 6 * 8, 6 + 7 * 8, 7 + 2 * 8, 7 + 3 * 8,
7 + 4 * 8, 7 + 5 * 8, 7 + 6 * 8, 7 + 7 * 8,
- 0,
};
static const uint8_t field_scan8x8_cavlc[64+1] = {
@@ -152,7 +148,6 @@ static const uint8_t field_scan8x8_cavlc[64+1] = {
1 + 7 * 8, 3 + 2 * 8, 2 + 7 * 8, 4 + 2 * 8,
3 + 7 * 8, 5 + 2 * 8, 4 + 7 * 8, 5 + 4 * 8,
6 + 3 * 8, 6 + 5 * 8, 7 + 3 * 8, 7 + 7 * 8,
- 0,
};
typedef struct IMbInfo {
View
3  mythtv/external/FFmpeg/libavcodec/libmp3lame.c
@@ -304,7 +304,8 @@ AVCodec ff_libmp3lame_encoder = {
AV_SAMPLE_FMT_NONE },
.supported_samplerates = libmp3lame_sample_rates,
.channel_layouts = (const uint64_t[]) { AV_CH_LAYOUT_MONO,
- AV_CH_LAYOUT_STEREO },
+ AV_CH_LAYOUT_STEREO,
+ 0},
.long_name = NULL_IF_CONFIG_SMALL("libmp3lame MP3 (MPEG audio layer 3)"),
.priv_class = &libmp3lame_class,
.defaults = libmp3lame_defaults,
View
5 mythtv/external/FFmpeg/libavcodec/mjpegenc.c
@@ -48,6 +48,11 @@ av_cold int ff_mjpeg_encode_init(MpegEncContext *s)
{
MJpegContext *m;
+ if (s->width > 65500 || s->height > 65500) {
+ av_log(s, AV_LOG_ERROR, "JPEG does not support resolutions above 65500x65500\n");
+ return -1;
+ }
+
m = av_malloc(sizeof(MJpegContext));
if (!m)
return -1;
View
4 mythtv/external/FFmpeg/libavcodec/mpeg4videodec.c
@@ -2055,6 +2055,10 @@ static int decode_vop_header(MpegEncContext *s, GetBitContext *gb){
if(s->pict_type == AV_PICTURE_TYPE_B)
skip_bits_long(gb, s->cplx_estimation_trash_b);
+ if(get_bits_left(gb) < 3) {
+ av_log(s->avctx, AV_LOG_ERROR, "Header truncated\n");
+ return -1;
+ }
s->intra_dc_threshold= ff_mpeg4_dc_threshold[ get_bits(gb, 3) ];
if(!s->progressive_sequence){
s->top_field_first= get_bits1(gb);
View
3  mythtv/external/FFmpeg/libavcodec/qdm2.c
@@ -1363,7 +1363,8 @@ static void qdm2_fft_decode_tones (QDM2Context *q, int duration, GetBitContext *
if (q->superblocktype_2_3) {
while ((n = qdm2_get_vlc(gb, &vlc_tab_fft_tone_offset[local_int_8], 1, 2)) < 2) {
if (get_bits_left(gb)<0) {
- av_log(0, AV_LOG_ERROR, "overread in qdm2_fft_decode_tones()\n");
+ if(local_int_4 < q->group_size)
+ av_log(0, AV_LOG_ERROR, "overread in qdm2_fft_decode_tones()\n");
return;
}
offset = 1;
View
5 mythtv/external/FFmpeg/libavcodec/sgienc.c
@@ -36,6 +36,11 @@ static av_cold int encode_init(AVCodecContext *avctx)
{
SgiContext *s = avctx->priv_data;
+ if (avctx->width > 65535 || avctx->height > 65535) {
+ av_log(avctx, AV_LOG_ERROR, "SGI does not support resolutions above 65535x65535\n");
+ return -1;
+ }
+
avcodec_get_frame_defaults(&s->picture);
avctx->coded_frame = &s->picture;
View
38 mythtv/external/FFmpeg/libavcodec/vp8.c
@@ -708,56 +708,58 @@ void decode_mb_mode(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y, uint8_
* @return 0 if no coeffs were decoded
* otherwise, the index of the last coeff decoded plus one
*/
-static int decode_block_coeffs_internal(VP56RangeCoder *c, DCTELEM block[16],
+static int decode_block_coeffs_internal(VP56RangeCoder *r, DCTELEM block[16],
uint8_t probs[16][3][NUM_DCT_TOKENS-1],
int i, uint8_t *token_prob, int16_t qmul[2])
{
+ VP56RangeCoder c = *r;
goto skip_eob;
do {
int coeff;
- if (!vp56_rac_get_prob_branchy(c, token_prob[0])) // DCT_EOB
- return i;
+ if (!vp56_rac_get_prob_branchy(&c, token_prob[0])) // DCT_EOB
+ break;
skip_eob:
- if (!vp56_rac_get_prob_branchy(c, token_prob[1])) { // DCT_0
+ if (!vp56_rac_get_prob_branchy(&c, token_prob[1])) { // DCT_0
if (++i == 16)
- return i; // invalid input; blocks should end with EOB
+ break; // invalid input; blocks should end with EOB
token_prob = probs[i][0];
goto skip_eob;
}
- if (!vp56_rac_get_prob_branchy(c, token_prob[2])) { // DCT_1
+ if (!vp56_rac_get_prob_branchy(&c, token_prob[2])) { // DCT_1
coeff = 1;
token_prob = probs[i+1][1];
} else {
- if (!vp56_rac_get_prob_branchy(c, token_prob[3])) { // DCT 2,3,4
- coeff = vp56_rac_get_prob_branchy(c, token_prob[4]);
+ if (!vp56_rac_get_prob_branchy(&c, token_prob[3])) { // DCT 2,3,4
+ coeff = vp56_rac_get_prob_branchy(&c, token_prob[4]);
if (coeff)
- coeff += vp56_rac_get_prob(c, token_prob[5]);
+ coeff += vp56_rac_get_prob(&c, token_prob[5]);
coeff += 2;
} else {
// DCT_CAT*
- if (!vp56_rac_get_prob_branchy(c, token_prob[6])) {
- if (!vp56_rac_get_prob_branchy(c, token_prob[7])) { // DCT_CAT1
- coeff = 5 + vp56_rac_get_prob(c, vp8_dct_cat1_prob[0]);
+ if (!vp56_rac_get_prob_branchy(&c, token_prob[6])) {
+ if (!vp56_rac_get_prob_branchy(&c, token_prob[7])) { // DCT_CAT1
+ coeff = 5 + vp56_rac_get_prob(&c, vp8_dct_cat1_prob[0]);
} else { // DCT_CAT2
coeff = 7;
- coeff += vp56_rac_get_prob(c, vp8_dct_cat2_prob[0]) << 1;
- coeff += vp56_rac_get_prob(c, vp8_dct_cat2_prob[1]);
+ coeff += vp56_rac_get_prob(&c, vp8_dct_cat2_prob[0]) << 1;
+ coeff += vp56_rac_get_prob(&c, vp8_dct_cat2_prob[1]);
}
} else { // DCT_CAT3 and up
- int a = vp56_rac_get_prob(c, token_prob[8]);
- int b = vp56_rac_get_prob(c, token_prob[9+a]);
+ int a = vp56_rac_get_prob(&c, token_prob[8]);
+ int b = vp56_rac_get_prob(&c, token_prob[9+a]);
int cat = (a<<1) + b;
coeff = 3 + (8<<cat);
- coeff += vp8_rac_get_coeff(c, ff_vp8_dct_cat_prob[cat]);
+ coeff += vp8_rac_get_coeff(&c, ff_vp8_dct_cat_prob[cat]);
}
}
token_prob = probs[i+1][2];
}
- block[zigzag_scan[i]] = (vp8_rac_get(c) ? -coeff : coeff) * qmul[!!i];
+ block[zigzag_scan[i]] = (vp8_rac_get(&c) ? -coeff : coeff) * qmul[!!i];
} while (++i < 16);
+ *r = c;
return i;
}
#endif
View
19 mythtv/external/FFmpeg/libavfilter/af_amix.c
@@ -389,6 +389,10 @@ static int request_frame(AVFilterLink *outlink)
int ret;
int wanted_samples, available_samples;
+ ret = calc_active_inputs(s);
+ if (ret < 0)
+ return ret;
+
if (s->input_state[0] == INPUT_OFF) {
ret = request_samples(ctx, 1);
if (ret < 0)
@@ -419,15 +423,16 @@ static int request_frame(AVFilterLink *outlink)
av_assert0(s->frame_list->nb_frames > 0);
wanted_samples = frame_list_next_frame_size(s->frame_list);
- ret = request_samples(ctx, wanted_samples);
- if (ret < 0)
- return ret;
-
- ret = calc_active_inputs(s);
- if (ret < 0)
- return ret;
if (s->active_inputs > 1) {
+ ret = request_samples(ctx, wanted_samples);
+ if (ret < 0)
+ return ret;
+
+ ret = calc_active_inputs(s);
+ if (ret < 0)
+ return ret;
+
available_samples = get_available_samples(s);
if (!available_samples)
return 0;
View
111 mythtv/external/FFmpeg/libavfilter/bufferqueue.h
@@ -0,0 +1,111 @@
+/*
+ * Generic buffer queue
+ * Copyright (c) 2012 Nicolas George
+ *
+ * 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
+ */
+
+#ifndef AVFILTER_BUFFERQUEUE_H
+#define AVFILTER_BUFFERQUEUE_H
+
+/**
+ * FFBufQueue: simple AVFilterBufferRef queue API
+ *
+ * Note: this API is not thread-safe. Concurrent access to the same queue
+ * must be protected by a mutex or any synchronization mechanism.
+ */
+
+/**
+ * Maximum size of the queue.
+ *
+ * This value can be overridden by definying it before including this
+ * header.
+ * Powers of 2 are recommended.
+ */
+#ifndef FF_BUFQUEUE_SIZE
+#define FF_BUFQUEUE_SIZE 32
+#endif
+
+#include "avfilter.h"
+#include "libavutil/avassert.h"
+
+/**
+ * Structure holding the queue
+ */
+struct FFBufQueue {
+ AVFilterBufferRef *queue[FF_BUFQUEUE_SIZE];
+ unsigned short head;
+ unsigned short available; /**< number of available buffers */
+};
+
+#define BUCKET(i) queue->queue[(queue->head + (i)) % FF_BUFQUEUE_SIZE]
+
+/**
+ * Add a buffer to the queue.
+ *
+ * If the queue is already full, then the current last buffer is dropped
+ * (and unrefed) with a warning before adding the new buffer.
+ */
+static inline void ff_bufqueue_add(void *log, struct FFBufQueue *queue,
+ AVFilterBufferRef *buf)
+{
+ if (queue->available == FF_BUFQUEUE_SIZE) {
+ av_log(log, AV_LOG_WARNING, "Buffer queue overflow, dropping.\n");
+ avfilter_unref_buffer(BUCKET(--queue->available));
+ }
+ BUCKET(queue->available++) = buf;
+}
+
+/**
+ * Get a buffer from the queue without altering it.
+ *
+ * Buffer with index 0 is the first buffer in the queue.
+ * Return NULL if the queue has not enough buffers.
+ */
+static inline AVFilterBufferRef *ff_bufqueue_peek(struct FFBufQueue *queue,
+ unsigned index)
+{
+ return index < queue->available ? BUCKET(index) : NULL;
+}
+
+/**
+ * Get the first buffer from the queue and remove it.
+ *
+ * Do not use on an empty queue.
+ */
+static inline AVFilterBufferRef *ff_bufqueue_get(struct FFBufQueue *queue)
+{
+ AVFilterBufferRef *ret = queue->queue[queue->head];
+ av_assert0(queue->available);
+ queue->available--;
+ queue->queue[queue->head] = NULL;
+ queue->head = (queue->head + 1) % FF_BUFQUEUE_SIZE;
+ return ret;
+}
+
+/**
+ * Unref and remove all buffers from the queue.
+ */
+static inline void ff_bufqueue_discard_all(struct FFBufQueue *queue)
+{
+ while (queue->available)
+ avfilter_unref_buffer(ff_bufqueue_get(queue));
+}
+
+#undef BUCKET
+
+#endif /* AVFILTER_BUFFERQUEUE_H */
View
2  mythtv/external/FFmpeg/libavfilter/sink_buffer.c
@@ -23,6 +23,7 @@
* buffer video sink
*/
+#include "libavutil/avassert.h"
#include "libavutil/fifo.h"
#include "avfilter.h"
#include "buffersink.h"
@@ -98,6 +99,7 @@ static void end_frame(AVFilterLink *inlink)
AVFilterContext *ctx = inlink->dst;
BufferSinkContext *buf = inlink->dst->priv;
+ av_assert1(inlink->cur_buf);
if (av_fifo_space(buf->fifo) < sizeof(AVFilterBufferRef *)) {
/* realloc fifo size */
if (av_fifo_realloc2(buf->fifo, av_fifo_size(buf->fifo) * 2) < 0) {
View
225 mythtv/external/FFmpeg/libavfilter/vf_overlay.c
@@ -36,6 +36,7 @@
#include "libavutil/mathematics.h"
#include "libavutil/timestamp.h"
#include "internal.h"
+#include "bufferqueue.h"
#include "drawutils.h"
static const char *const var_names[] = {
@@ -71,6 +72,8 @@ typedef struct {
int x, y; ///< position of overlayed picture
int allow_packed_rgb;
+ uint8_t frame_requested;
+ uint8_t overlay_eof;
uint8_t main_is_packed_rgb;
uint8_t main_rgba_map[4];
uint8_t main_has_alpha;
@@ -78,7 +81,9 @@ typedef struct {
uint8_t overlay_rgba_map[4];
uint8_t overlay_has_alpha;
- AVFilterBufferRef *overpicref, *overpicref_next;
+ AVFilterBufferRef *overpicref;
+ struct FFBufQueue queue_main;
+ struct FFBufQueue queue_over;
int main_pix_step[4]; ///< steps per pixel for each plane of the main output
int overlay_pix_step[4]; ///< steps per pixel for each plane of the overlay
@@ -149,8 +154,8 @@ static av_cold void uninit(AVFilterContext *ctx)
if (over->overpicref)
avfilter_unref_buffer(over->overpicref);
- if (over->overpicref_next)
- avfilter_unref_buffer(over->overpicref_next);
+ ff_bufqueue_discard_all(&over->queue_main);
+ ff_bufqueue_discard_all(&over->queue_over);
}
static int query_formats(AVFilterContext *ctx)
@@ -304,51 +309,6 @@ static AVFilterBufferRef *get_video_buffer(AVFilterLink *link, int perms, int w,
return avfilter_get_video_buffer(link->dst->outputs[0], perms, w, h);
}
-static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref)
-{
- AVFilterBufferRef *outpicref = avfilter_ref_buffer(inpicref, ~0);
- AVFilterContext *ctx = inlink->dst;
- OverlayContext *over = ctx->priv;
- av_unused AVFilterLink *outlink = ctx->outputs[0];
-
- inlink->dst->outputs[0]->out_buf = outpicref;
- outpicref->pts = av_rescale_q(outpicref->pts, ctx->inputs[MAIN]->time_base,
- ctx->outputs[0]->time_base);
-
- if (!over->overpicref || over->overpicref->pts < outpicref->pts) {
- if (!over->overpicref_next)
- avfilter_request_frame(ctx->inputs[OVERLAY]);
-
- if (over->overpicref && over->overpicref_next &&
- over->overpicref_next->pts <= outpicref->pts) {
- avfilter_unref_buffer(over->overpicref);
- over->overpicref = over->overpicref_next;
- over->overpicref_next = NULL;
- }
- }
-
- av_dlog(ctx, "main_pts:%s main_pts_time:%s",
- av_ts2str(outpicref->pts), av_ts2timestr(outpicref->pts, &outlink->time_base));
- if (over->overpicref)
- av_dlog(ctx, " over_pts:%s over_pts_time:%s",
- av_ts2str(over->overpicref->pts), av_ts2timestr(over->overpicref->pts, &outlink->time_base));
- av_dlog(ctx, "\n");
-
- avfilter_start_frame(inlink->dst->outputs[0], outpicref);
-}
-
-static void start_frame_overlay(AVFilterLink *inlink, AVFilterBufferRef *inpicref)
-{
- AVFilterContext *ctx = inlink->dst;
- OverlayContext *over = ctx->priv;
-
- inpicref->pts = av_rescale_q(inpicref->pts, ctx->inputs[OVERLAY]->time_base,
- ctx->outputs[0]->time_base);
-
- if (!over->overpicref) over->overpicref = inpicref;
- else over->overpicref_next = inpicref;
-}
-
// divide by 255 and round to nearest
// apply a fast variant: (X+127)/255 = ((X+127)*257+257)>>16 = ((X+128)*257)>>16
#define FAST_DIV255(x) ((((x) + 128) * 257) >> 16)
@@ -483,16 +443,100 @@ static void blend_slice(AVFilterContext *ctx,
}
}
-static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
+static int try_start_frame(AVFilterContext *ctx, AVFilterBufferRef *mainpic)
{
- AVFilterContext *ctx = inlink->dst;
+ OverlayContext *over = ctx->priv;
+ AVFilterLink *outlink = ctx->outputs[0];
+ AVFilterBufferRef *next_overpic, *outpicref;
+
+ /* Discard obsolete overlay frames: if there is a next frame with pts is
+ * before the main frame, we can drop the current overlay. */
+ while (1) {
+ next_overpic = ff_bufqueue_peek(&over->queue_over, 0);
+ if (!next_overpic || next_overpic->pts > mainpic->pts)
+ break;
+ ff_bufqueue_get(&over->queue_over);
+ avfilter_unref_buffer(over->overpicref);
+ over->overpicref = next_overpic;
+ }
+ /* If there is no next frame and no EOF and the overlay frame is before
+ * the main frame, we can not know yet if it will be superseded. */
+ if (!over->queue_over.available && !over->overlay_eof &&
+ (!over->overpicref || over->overpicref->pts < mainpic->pts))
+ return AVERROR(EAGAIN);
+ /* At this point, we know that the current overlay frame extends to the
+ * time of the main frame. */
+ outlink->out_buf = outpicref = avfilter_ref_buffer(mainpic, ~0);
+
+ av_dlog(ctx, "main_pts:%s main_pts_time:%s",
+ av_ts2str(outpicref->pts), av_ts2timestr(outpicref->pts, &outlink->time_base));
+ if (over->overpicref)
+ av_dlog(ctx, " over_pts:%s over_pts_time:%s",
+ av_ts2str(over->overpicref->pts), av_ts2timestr(over->overpicref->pts, &outlink->time_base));
+ av_dlog(ctx, "\n");
+
+ avfilter_start_frame(ctx->outputs[0], avfilter_ref_buffer(outpicref, ~0));
+ over->frame_requested = 0;
+ return 0;
+}
+
+static int try_start_next_frame(AVFilterContext *ctx)
+{
+ OverlayContext *over = ctx->priv;
+ AVFilterBufferRef *next_mainpic = ff_bufqueue_peek(&over->queue_main, 0);
+ if (!next_mainpic || try_start_frame(ctx, next_mainpic) < 0)
+ return AVERROR(EAGAIN);
+ avfilter_unref_buffer(ff_bufqueue_get(&over->queue_main));
+ return 0;
+}
+
+static int try_push_frame(AVFilterContext *ctx)
+{
+ OverlayContext *over = ctx->priv;
AVFilterLink *outlink = ctx->outputs[0];
AVFilterBufferRef *outpicref = outlink->out_buf;
+
+ if (try_start_next_frame(ctx) < 0)
+ return AVERROR(EAGAIN);
+ outpicref = outlink->out_buf;
+ if (over->overpicref)
+ blend_slice(ctx, outpicref, over->overpicref, over->x, over->y,
+ over->overpicref->video->w, over->overpicref->video->h,
+ 0, outpicref->video->w, outpicref->video->h);
+ avfilter_draw_slice(outlink, 0, outpicref->video->h, +1);
+ avfilter_unref_bufferp(&outlink->out_buf);
+ avfilter_end_frame(outlink);
+ return 0;
+}
+
+static void flush_frames(AVFilterContext *ctx)
+{
+ while (!try_push_frame(ctx));
+}
+
+static void start_frame_main(AVFilterLink *inlink, AVFilterBufferRef *inpicref)
+{
+ AVFilterContext *ctx = inlink->dst;
+ OverlayContext *over = ctx->priv;
+
+ flush_frames(ctx);
+ inpicref->pts = av_rescale_q(inpicref->pts, ctx->inputs[MAIN]->time_base,
+ ctx->outputs[0]->time_base);
+ if (try_start_frame(ctx, inpicref) < 0)
+ ff_bufqueue_add(ctx, &over->queue_main, inpicref);
+}
+
+static void draw_slice_main(AVFilterLink *inlink, int y, int h, int slice_dir)
+{
+ AVFilterContext *ctx = inlink->dst;
OverlayContext *over = ctx->priv;
+ AVFilterLink *outlink = ctx->outputs[0];
+ AVFilterBufferRef *outpicref = outlink->out_buf;
+ if (!outpicref)
+ return;
if (over->overpicref &&
- !(over->x >= outpicref->video->w || over->y >= outpicref->video->h ||
- y+h < over->y || y >= over->y + over->overpicref->video->h)) {
+ y + h > over->y && y < over->y + over->overpicref->video->h) {
blend_slice(ctx, outpicref, over->overpicref, over->x, over->y,
over->overpicref->video->w, over->overpicref->video->h,
y, outpicref->video->w, h);
@@ -500,28 +544,67 @@ static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
avfilter_draw_slice(outlink, y, h, slice_dir);
}
-static void end_frame(AVFilterLink *inlink)
+static void end_frame_main(AVFilterLink *inlink)
{
- avfilter_end_frame(inlink->dst->outputs[0]);
- avfilter_unref_buffer(inlink->cur_buf);
-}
+ AVFilterContext *ctx = inlink->dst;
+ AVFilterLink *outlink = ctx->outputs[0];
+ AVFilterBufferRef *outpicref = outlink->out_buf;
+ flush_frames(ctx);
-static void null_draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) { }
+ if (!outpicref)
+ return;
+ avfilter_unref_bufferp(&inlink->cur_buf);
+ avfilter_unref_bufferp(&outlink->out_buf);
+ avfilter_end_frame(ctx->outputs[0]);
+}
-static void null_end_frame(AVFilterLink *inlink) { }
+static void start_frame_over(AVFilterLink *inlink, AVFilterBufferRef *inpicref)
+{
+}
-static int poll_frame(AVFilterLink *link)
+static void end_frame_over(AVFilterLink *inlink)
{
- AVFilterContext *s = link->src;
- OverlayContext *over = s->priv;
- int ret = avfilter_poll_frame(s->inputs[OVERLAY]);
+ AVFilterContext *ctx = inlink->dst;
+ OverlayContext *over = ctx->priv;
+ AVFilterBufferRef *inpicref = inlink->cur_buf;
- if (ret == AVERROR_EOF)
- ret = !!over->overpicref;
+ flush_frames(ctx);
+ inpicref->pts = av_rescale_q(inpicref->pts, ctx->inputs[OVERLAY]->time_base,
+ ctx->outputs[0]->time_base);
+ ff_bufqueue_add(ctx, &over->queue_over, inpicref);
+ try_push_frame(ctx);
+}
- return ret && avfilter_poll_frame(s->inputs[MAIN]);
+static int request_frame(AVFilterLink *outlink)
+{
+ AVFilterContext *ctx = outlink->src;
+ OverlayContext *over = ctx->priv;
+ int input, ret;
+
+ if (!try_push_frame(ctx))
+ return 0;
+ over->frame_requested = 1;
+ while (over->frame_requested) {
+ /* TODO if we had a frame duration, we could guess more accurately */
+ input = !over->overlay_eof && (over->queue_main.available ||
+ over->queue_over.available < 2) ?
+ OVERLAY : MAIN;
+ ret = avfilter_request_frame(ctx->inputs[input]);
+ /* EOF on main is reported immediately */
+ if (ret == AVERROR_EOF && input == OVERLAY) {
+ over->overlay_eof = 1;
+ if (!try_start_next_frame(ctx))
+ return 0;
+ ret = 0; /* continue requesting frames on main */
+ }
+ if (ret < 0)
+ return ret;
+ }
+ return 0;
}
+static void null_draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) { }
+
AVFilter avfilter_vf_overlay = {
.name = "overlay",
.description = NULL_IF_CONFIG_SMALL("Overlay a video source on top of the input."),
@@ -535,25 +618,25 @@ AVFilter avfilter_vf_overlay = {
.inputs = (const AVFilterPad[]) {{ .name = "main",
.type = AVMEDIA_TYPE_VIDEO,
- .start_frame = start_frame,
.get_video_buffer= get_video_buffer,
.config_props = config_input_main,
- .draw_slice = draw_slice,
- .end_frame = end_frame,
+ .start_frame = start_frame_main,
+ .draw_slice = draw_slice_main,
+ .end_frame = end_frame_main,
.min_perms = AV_PERM_READ,
.rej_perms = AV_PERM_REUSE2|AV_PERM_PRESERVE, },
{ .name = "overlay",
.type = AVMEDIA_TYPE_VIDEO,
- .start_frame = start_frame_overlay,
.config_props = config_input_overlay,
+ .start_frame = start_frame_over,
.draw_slice = null_draw_slice,
- .end_frame = null_end_frame,
+ .end_frame = end_frame_over,
.min_perms = AV_PERM_READ,
.rej_perms = AV_PERM_REUSE2, },
{ .name = NULL}},
.outputs = (const AVFilterPad[]) {{ .name = "default",
.type = AVMEDIA_TYPE_VIDEO,
.config_props = config_output,
- .poll_frame = poll_frame },
+ .request_frame = request_frame, },
{ .name = NULL}},
};
View
13 mythtv/external/FFmpeg/libavformat/avio.c
@@ -315,8 +315,9 @@ int64_t ffurl_seek(URLContext *h, int64_t pos, int whence)
return ret;
}
-int ffurl_close(URLContext *h)
+int ffurl_closep(URLContext **hh)
{
+ URLContext *h= *hh;
int ret = 0;
if (!h) return 0; /* can happen when ffurl_open fails */
@@ -329,12 +330,18 @@ int ffurl_close(URLContext *h)
if (h->prot->priv_data_size) {
if (h->prot->priv_data_class)
av_opt_free(h->priv_data);
- av_free(h->priv_data);
+ av_freep(&h->priv_data);
}
- av_free(h);
+ av_freep(hh);
return ret;
}
+int ffurl_close(URLContext *h)
+{
+ return ffurl_closep(&h);
+}
+
+
int avio_check(const char *url, int flags)
{
URLContext *h;
View
3  mythtv/external/FFmpeg/libavformat/dv.c
@@ -273,9 +273,6 @@ static int dv_extract_video_info(DVDemuxContext *c, uint8_t* frame)
avpriv_set_pts_info(c->vst, 64, c->sys->time_base.num,
c->sys->time_base.den);
avctx->time_base= c->sys->time_base;
- if (!avctx->width)
- avcodec_set_dimensions(avctx, c->sys->width, c->sys->height);
- avctx->pix_fmt = c->sys->pix_fmt;
/* finding out SAR is a little bit messy */
vsc_pack = dv_extract_pack(frame, dv_video_control);
View
54 mythtv/external/FFmpeg/libavformat/http.c
@@ -55,6 +55,8 @@ typedef struct {
int end_chunked_post; /**< A flag which indicates if the end of chunked encoding has been sent. */
int end_header; /**< A flag which indicates we have finished to read POST reply. */
int multiple_requests; /**< A flag which indicates if we use persistent connections. */
+ uint8_t *post_data;
+ int post_datalen;
} HTTPContext;
#define OFFSET(x) offsetof(HTTPContext, x)
@@ -66,6 +68,7 @@ static const AVOption options[] = {
{"headers", "custom HTTP headers, can override built in default headers", OFFSET(headers), AV_OPT_TYPE_STRING, { 0 }, 0, 0, D|E },
{"user-agent", "override User-Agent header", OFFSET(user_agent), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC},
{"multiple_requests", "use persistent connections", OFFSET(multiple_requests), AV_OPT_TYPE_INT, {.dbl = 0}, 0, 1, D|E },
+{"post_data", "custom HTTP post data", OFFSET(post_data), AV_OPT_TYPE_BINARY, .flags = D|E },
{NULL}
};
#define HTTP_CLASS(flavor)\
@@ -160,7 +163,8 @@ static int http_open_cnx(URLContext *h)
if (s->http_code == 401) {
if ((cur_auth_type == HTTP_AUTH_NONE || s->auth_state.stale) &&
s->auth_state.auth_type != HTTP_AUTH_NONE && attempts < 4) {
- ffurl_close(hd);
+ ffurl_closep(&hd);
+ s->hd = NULL;
goto redo;
} else
goto fail;
@@ -168,7 +172,8 @@ static int http_open_cnx(URLContext *h)
if (s->http_code == 407) {
if ((cur_proxy_auth_type == HTTP_AUTH_NONE || s->proxy_auth_state.stale) &&
s->proxy_auth_state.auth_type != HTTP_AUTH_NONE && attempts < 4) {
- ffurl_close(hd);
+ ffurl_closep(&hd);
+ s->hd = NULL;
goto redo;
} else
goto fail;
@@ -176,7 +181,8 @@ static int http_open_cnx(URLContext *h)
if ((s->http_code == 301 || s->http_code == 302 || s->http_code == 303 || s->http_code == 307)
&& location_changed == 1) {
/* url moved, get next */
- ffurl_close(hd);
+ ffurl_closep(&hd);
+ s->hd = NULL;
if (redirects++ >= MAX_REDIRECTS)
return AVERROR(EIO);
/* Restart the authentication process with the new target, which
@@ -189,7 +195,7 @@ static int http_open_cnx(URLContext *h)
return 0;
fail:
if (hd)
- ffurl_close(hd);
+ ffurl_closep(&hd);
s->hd = NULL;
return AVERROR(EIO);
}
@@ -227,7 +233,7 @@ static int http_getc(HTTPContext *s)
if (s->buf_ptr >= s->buf_end) {
len = ffurl_read(s->hd, s->buffer, BUFFER_SIZE);
if (len < 0) {
- return AVERROR(EIO);
+ return len;
} else if (len == 0) {
return -1;
} else {
@@ -247,7 +253,7 @@ static int http_get_line(HTTPContext *s, char *line, int line_size)
for(;;) {
ch = http_getc(s);
if (ch < 0)
- return AVERROR(EIO);
+ return ch;
if (ch == '\n') {
/* process line */
if (q > line && q[-1] == '\r')
@@ -354,8 +360,8 @@ static int http_read_header(URLContext *h, int *new_location)
int err = 0;
for (;;) {
- if (http_get_line(s, line, sizeof(line)) < 0)
- return AVERROR(EIO);
+ if ((err = http_get_line(s, line, sizeof(line))) < 0)
+ return err;
av_dlog(NULL, "header='%s'\n", line);
@@ -385,6 +391,14 @@ static int http_connect(URLContext *h, const char *path, const char *local_path,
/* send http header */
post = h->flags & AVIO_FLAG_WRITE;
+
+ if (s->post_data) {
+ /* force POST method and disable chunked encoding when
+ * custom HTTP post data is set */
+ post = 1;
+ s->chunked_post = 0;
+ }
+
method = post ? "POST" : "GET";
authstr = ff_http_auth_create_response(&s->auth_state, auth, local_path,
method);
@@ -416,6 +430,9 @@ static int http_connect(URLContext *h, const char *path, const char *local_path,
if (!has_header(s->headers, "\r\nHost: "))
len += av_strlcatf(headers + len, sizeof(headers) - len,
"Host: %s\r\n", hoststr);
+ if (!has_header(s->headers, "\r\nContent-Length: ") && s->post_data)
+ len += av_strlcatf(headers + len, sizeof(headers) - len,
+ "Content-Length: %d\r\n", s->post_datalen);
/* now add in custom headers */
if (s->headers)
@@ -437,8 +454,12 @@ static int http_connect(URLContext *h, const char *path, const char *local_path,
av_freep(&authstr);
av_freep(&proxyauthstr);
- if (ffurl_write(s->hd, s->buffer, strlen(s->buffer)) < 0)
- return AVERROR(EIO);
+ if ((err = ffurl_write(s->hd, s->buffer, strlen(s->buffer))) < 0)
+ return err;
+
+ if (s->post_data)
+ if ((err = ffurl_write(s->hd, s->post_data, s->post_datalen)) < 0)
+ return err;
/* init input buffer */
s->buf_ptr = s->buffer;
@@ -449,7 +470,7 @@ static int http_connect(URLContext *h, const char *path, const char *local_path,
s->willclose = 0;
s->end_chunked_post = 0;
s->end_header = 0;
- if (post) {
+ if (post && !s->post_data) {
/* Pretend that it did work. We didn't read any header yet, since
* we've still to send the POST data, but the code calling this
* function will check http_code after we return. */
@@ -512,8 +533,8 @@ static int http_read(URLContext *h, uint8_t *buf, int size)
for(;;) {
do {
- if (http_get_line(s, line, sizeof(line)) < 0)
- return AVERROR(EIO);
+ if ((err = http_get_line(s, line, sizeof(line))) < 0)
+ return err;
} while (!*line); /* skip CR LF from last chunk */
s->chunksize = strtoll(line, NULL, 16);
@@ -584,7 +605,7 @@ static int http_close(URLContext *h)
}
if (s->hd)
- ffurl_close(s->hd);
+ ffurl_closep(&s->hd);
return ret;
}
@@ -666,7 +687,7 @@ static int http_proxy_close(URLContext *h)
{
HTTPContext *s = h->priv_data;
if (s->hd)
- ffurl_close(s->hd);
+ ffurl_closep(&s->hd);
return 0;
}
@@ -737,8 +758,7 @@ static int http_proxy_open(URLContext *h, const char *uri, int flags)
if (s->http_code == 407 &&
(cur_auth_type == HTTP_AUTH_NONE || s->proxy_auth_state.stale) &&
s->proxy_auth_state.auth_type != HTTP_AUTH_NONE && attempts < 2) {
- ffurl_close(s->hd);
- s->hd = NULL;
+ ffurl_closep(&s->hd);
goto redo;
}
View
7 mythtv/external/FFmpeg/libavformat/jacosubdec.c
@@ -63,10 +63,13 @@ static int jacosub_probe(AVProbeData *p)
ptr += 3; /* skip UTF-8 BOM */
while (ptr < ptr_end) {
- if (timed_line(ptr))
- return AVPROBE_SCORE_MAX / 2;
while (jss_whitespace(*ptr))
ptr++;
+ if (*ptr != '#' && *ptr != '\n') {
+ if (timed_line(ptr))
+ return AVPROBE_SCORE_MAX/2 + 1;
+ return 0;
+ }
ptr += strcspn(ptr, "\n") + 1;
}
return 0;
View
14 mythtv/external/FFmpeg/libavformat/mxfenc.c
@@ -44,8 +44,10 @@
#include "internal.h"
#include "mxf.h"
-static const int NTSC_samples_per_frame[] = { 1602, 1601, 1602, 1601, 1602, 0 };
-static const int PAL_samples_per_frame[] = { 1920, 0 };
+static const int NTSC_samples_per_frame[] = { 1602, 1601, 1602, 1601, 1602, 0 };
+static const int NTSC_60_samples_per_frame[] = { 801, 801, 801, 801, 800, 0 };
+static const int PAL_samples_per_frame[] = { 1920, 0 };
+static const int PAL_50_samples_per_frame[] = { 960, 0 };
extern AVOutputFormat ff_mxf_d10_muxer;
@@ -1423,10 +1425,18 @@ static int mxf_write_header(AVFormatContext *s)
samples_per_frame = PAL_samples_per_frame;
mxf->time_base = (AVRational){ 1, 25 };
mxf->timecode_base = 25;
+ } else if (fabs(av_q2d(st->codec->time_base) - 1/50.0) < 0.0001) {
+ samples_per_frame = PAL_50_samples_per_frame;
+ mxf->time_base = (AVRational){ 1, 50 };
+ mxf->timecode_base = 50;
} else if (fabs(av_q2d(st->codec->time_base) - 1001/30000.0) < 0.0001) {
samples_per_frame = NTSC_samples_per_frame;
mxf->time_base = (AVRational){ 1001, 30000 };
mxf->timecode_base = 30;
+ } else if (fabs(av_q2d(st->codec->time_base) - 1001/60000.0) < 0.0001) {
+ samples_per_frame = NTSC_60_samples_per_frame;
+ mxf->time_base = (AVRational){ 1001, 60000 };
+ mxf->timecode_base = 60;
} else {
av_log(s, AV_LOG_ERROR, "unsupported video frame rate\n");
return -1;
View
4 mythtv/external/FFmpeg/libavformat/oggparsevorbis.c
@@ -203,12 +203,12 @@ vorbis_header (AVFormatContext * s, int idx)
int pkt_type = os->buf[os->pstart];
if (!(pkt_type & 1))
- return 0;
+ return os->private ? 0 : -1;
if (!os->private) {
os->private = av_mallocz(sizeof(struct oggvorbis_private));
if (!os->private)
- return 0;
+ return -1;
}
if (os->psize < 1 || pkt_type > 5)
View
8 mythtv/external/FFmpeg/libavformat/tcp.c
@@ -84,8 +84,16 @@ static int tcp_open(URLContext *h, const char *uri, int flags)
if (listen_socket) {
int fd1;
ret = bind(fd, cur_ai->ai_addr, cur_ai->ai_addrlen);
+ if (ret) {
+ ret = ff_neterrno();
+ goto fail1;
+ }
listen(fd, 1);
fd1 = accept(fd, NULL, NULL);
+ if (fd1 < 0) {
+ ret = ff_neterrno();
+ goto fail1;
+ }
closesocket(fd);
fd = fd1;
ff_socket_nonblock(fd, 1);
View
3  mythtv/external/FFmpeg/libavformat/url.h
@@ -179,11 +179,12 @@ int64_t ffurl_seek(URLContext *h, int64_t pos, int whence);
/**
* Close the resource accessed by the URLContext h, and free the
- * memory used by it.
+ * memory used by it. Also set the URLContext pointer to NULL.
*
* @return a negative value if an error condition occurred, 0
* otherwise
*/
+int ffurl_closep(URLContext **h);
int ffurl_close(URLContext *h);
/**
View
2  mythtv/external/FFmpeg/libavutil/avutil.h
@@ -153,7 +153,7 @@
*/
#define LIBAVUTIL_VERSION_MAJOR 51
-#define LIBAVUTIL_VERSION_MINOR 55
+#define LIBAVUTIL_VERSION_MINOR 56
#define LIBAVUTIL_VERSION_MICRO 100
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
View
18 mythtv/external/FFmpeg/libavutil/log.h
@@ -25,6 +25,18 @@
#include "avutil.h"
#include "attributes.h"
+typedef enum {
+ AV_CLASS_CATEGORY_NA = 0,
+ AV_CLASS_CATEGORY_INPUT,
+ AV_CLASS_CATEGORY_OUTPUT,
+ AV_CLASS_CATEGORY_MUXER,
+ AV_CLASS_CATEGORY_DEMUXER,
+ AV_CLASS_CATEGORY_ENCODER,
+ AV_CLASS_CATEGORY_DECODER,
+ AV_CLASS_CATEGORY_FILTER,
+ AV_CLASS_CATEGORY_BITSTREAM_FILTER,
+}AVClassCategory;
+
/**
* Describe the class of an AVClass context structure. That is an
* arbitrary struct of which the first field is a pointer to an
@@ -86,6 +98,12 @@ typedef struct AVClass {
* child_class_next iterates over _all possible_ children.
*/
const struct AVClass* (*child_class_next)(const struct AVClass *prev);
+
+ /**
+ * Category used for visualization (like color)
+ * available since version (51 << 16 | 56 << 8 | 100)
+ */
+ AVClassCategory category;
} AVClass;
/* av_log API */
View
6 mythtv/external/FFmpeg/libswresample/swresample.c
@@ -84,9 +84,9 @@ static const AVOption options[]={
, OFFSET(min_compensation),AV_OPT_TYPE_FLOAT ,{.dbl=FLT_MAX }, 0 , FLT_MAX , PARAM },
{"min_hard_comp" , "Minimum difference between timestamps and audio data (in seconds) to trigger padding/trimming the data."
, OFFSET(min_hard_compensation),AV_OPT_TYPE_FLOAT ,{.dbl=0.1 }, 0 , INT_MAX , PARAM },
-{"comp_duration" , "Duration (in seconds) over which data is stretched/squeezeed to make it match the timestamps."
+{"comp_duration" , "Duration (in seconds) over which data is stretched/squeezed to make it match the timestamps."
, OFFSET(soft_compensation_duration),AV_OPT_TYPE_FLOAT ,{.dbl=1 }, 0 , INT_MAX , PARAM },
-{"max_soft_comp" , "Maximum factor by which data is stretched/squeezeed to make it match the timestamps."
+{"max_soft_comp" , "Maximum factor by which data is stretched/squeezed to make it match the timestamps."
, OFFSET(max_soft_compensation),AV_OPT_TYPE_FLOAT ,{.dbl=0 }, INT_MIN, INT_MAX , PARAM },
{0}
@@ -226,7 +226,7 @@ int swr_init(struct SwrContext *s){
}else if(av_get_planar_sample_fmt(s->in_sample_fmt) <= AV_SAMPLE_FMT_FLTP){
s->int_sample_fmt= AV_SAMPLE_FMT_FLTP;
}else{
- av_log(s, AV_LOG_DEBUG, "Using double precission mode\n");
+ av_log(s, AV_LOG_DEBUG, "Using double precision mode\n");
s->int_sample_fmt= AV_SAMPLE_FMT_DBLP;
}
}
View
12 mythtv/external/FFmpeg/tests/fate/acodec.mak
@@ -68,11 +68,13 @@ fate-acodec-g723_1: ENCOPTS = -b:a 6.3k
fate-acodec-g723_1: CMP_SHIFT = 8
FATE_ACODEC += fate-acodec-ra144
-fate-acodec-ra144: FMT = rm
-fate-acodec-ra144: CODEC = real_144
-fate-acodec-ra144: ENCOPTS = -ac 1
-fate-acodec-ra144: DECOPTS = -ac 2
-fate-acodec-ra144: CMP_SHIFT = -640
+fate-acodec-ra144: tests/data/asynth-8000-1.wav
+fate-acodec-ra144: SRC = tests/data/asynth-8000-1.wav
+fate-acodec-ra144: CMD = enc_dec_pcm rm wav s16le $(SRC) -c:a real_144
+fate-acodec-ra144: REF = $(SRC)
+fate-acodec-ra144: CMP = stddev
+fate-acodec-ra144: CMP_TARGET = 4777
+fate-acodec-ra144: CMP_SHIFT = -320
FATE_ACODEC += fate-acodec-roqaudio
fate-acodec-roqaudio: FMT = roq
View
2  mythtv/external/FFmpeg/tests/md5.sh
@@ -5,7 +5,7 @@ if [ X"$(echo | md5sum 2> /dev/null)" != X ]; then
elif [ X"$(echo | command md5 2> /dev/null)" != X ]; then
do_md5sum() { command md5 $1 | sed 's#MD5 (\(.*\)) = \(.*\)#\2 *\1#'; }
elif [ -x /sbin/md5 ]; then
- do_md5sum() { /sbin/md5 -r $1 | sed 's# \**\./# *./#'; }
+ do_md5sum() { /sbin/md5 -r $1 | sed 's/\([0-9a-f]\) [ *]*/\1 */'; }
elif openssl version >/dev/null 2>&1; then
do_md5sum() { openssl md5 $1 | sed 's/MD5(\(.*\))= \(.*\)/\2 *\1/'; }
else
View
4 mythtv/external/FFmpeg/tests/ref/fate/acodec-ra144
@@ -1,4 +0,0 @@
-d6740bee5e20fa665e6c94298125b834 *tests/data/fate/acodec-ra144.rm
-53227 tests/data/fate/acodec-ra144.rm
-16d1a0d6cae06cf8a4db009d0fe7a952 *tests/data/fate/acodec-ra144.out.wav
-stddev: 5696.26 PSNR: 21.22 MAXDIFF:44956 bytes: 1058400/ 1058560
Please sign in to comment.
Something went wrong with that request. Please try again.