Compare commits
75 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b006b2f4f5 | |||
| dadf58908c | |||
| ee8d38191f | |||
| f00a9f0003 | |||
| 1489e67072 | |||
| 2ff4257e64 | |||
| 461907760f | |||
| d7826b8b9b | |||
| 57211d8a5f | |||
| 3daa086b2e | |||
| 6f2aa8adbf | |||
| 28ef8eaeef | |||
| 3e57b37ddb | |||
| 04c74a339f | |||
| ece68a0363 | |||
| 95f8701c32 | |||
| 5af4171304 | |||
| 3e36cba430 | |||
| d369cc83aa | |||
| ac6b2fecf4 | |||
| bca27b0480 | |||
| c287efcc44 | |||
| aa1af0d6ca | |||
| 302d2591dc | |||
| 10ac44198d | |||
| 7590a125f5 | |||
| ff08767817 | |||
| bc1e72c38e | |||
| 20c121c007 | |||
| 5f95b300c1 | |||
| 68e48ed72e | |||
| 97ec20a20a | |||
| 553c9c77cc | |||
| f44c73f5bb | |||
| 59d765e30c | |||
| dad5b9560a | |||
| 41bcde6021 | |||
| e432bd071c | |||
| 08d75bf545 | |||
| 19de5478f0 | |||
| 3ac97550ce | |||
| a875a9a833 | |||
| 73487f7dee | |||
| c389ae543a | |||
| 15526ac69f | |||
| 9929991da7 | |||
| 1b0c1df3b9 | |||
| e31ace670e | |||
| e74cd2f470 | |||
| 528700dd58 | |||
| e34369e8ec | |||
| 74241de7ed | |||
| 38e8f78c04 | |||
| c82d6e05da | |||
| c8833a13cf | |||
| 28bf685bfc | |||
| c51c5f83c1 | |||
| 12fb647994 | |||
| c8c9740ee1 | |||
| e0884eadf6 | |||
| 112d4c400f | |||
| 0b9be54e97 | |||
| 18817d4b80 | |||
| 9d9d16b33f | |||
| 8b170ee5d8 | |||
| 86c8ab1fd8 | |||
| 8c103410a6 | |||
| 5bd5bb9e56 | |||
| e2935721e0 | |||
| ce433996d7 | |||
| e21a53b6eb | |||
| 7a67a70efa | |||
| 3be4f230c6 | |||
| 9913ecc68d | |||
| 09c79d50d8 |
@@ -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.0
|
||||
PROJECT_NUMBER = 1.0.2
|
||||
|
||||
# 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
|
||||
|
||||
@@ -1921,6 +1921,9 @@ showspectrum_filter_deps="avcodec"
|
||||
super2xsai_filter_deps="gpl"
|
||||
tinterlace_filter_deps="gpl"
|
||||
yadif_filter_deps="gpl"
|
||||
pixfmts_super2xsai_test_deps="super2xsai_filter"
|
||||
tinterlace_merge_test_deps="tinterlace_filter"
|
||||
tinterlace_pad_test_deps="tinterlace_filter"
|
||||
|
||||
# libraries
|
||||
avdevice_deps="avcodec avformat"
|
||||
@@ -1947,18 +1950,16 @@ doc_deps_any="manpages htmlpages podpages txtpages"
|
||||
# tests
|
||||
colormatrix1_test_deps="colormatrix_filter"
|
||||
colormatrix2_test_deps="colormatrix_filter"
|
||||
flashsv2_test_deps="zlib"
|
||||
mpg_test_deps="mpeg1system_muxer mpegps_demuxer"
|
||||
mpng_test_deps="zlib"
|
||||
png_test_deps="zlib"
|
||||
pp_test_deps="mp_filter"
|
||||
pp2_test_deps="mp_filter"
|
||||
pp3_test_deps="mp_filter"
|
||||
pp4_test_deps="mp_filter"
|
||||
pp5_test_deps="mp_filter"
|
||||
pp6_test_deps="mp_filter"
|
||||
seek_flashsv_flv_test_deps="zlib"
|
||||
seek_lavf_mxf_d10_test_deps="mxf_d10_test"
|
||||
zlib_test_deps="zlib"
|
||||
zmbv_test_deps="zlib"
|
||||
|
||||
test_deps(){
|
||||
suf1=$1
|
||||
@@ -3731,7 +3732,7 @@ pod2man --help > /dev/null 2>&1 && enable pod2man || disable pod2man
|
||||
check_header linux/fb.h
|
||||
check_header linux/videodev.h
|
||||
check_header linux/videodev2.h
|
||||
check_struct linux/videodev2.h "struct v4l2_frmivalenum" discrete
|
||||
check_code cc linux/videodev2.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_safe struct_v4l2_frmivalenum_discrete
|
||||
|
||||
check_header sys/videoio.h
|
||||
|
||||
|
||||
@@ -1636,6 +1636,7 @@ loop_end:
|
||||
ost = new_attachment_stream(o, oc, -1);
|
||||
ost->stream_copy = 0;
|
||||
ost->attachment_filename = o->attachments[i];
|
||||
ost->finished = 1;
|
||||
ost->st->codec->extradata = attachment;
|
||||
ost->st->codec->extradata_size = len;
|
||||
|
||||
|
||||
@@ -1617,7 +1617,7 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c
|
||||
"video_size=%dx%d:pix_fmt=%d:time_base=%d/%d:pixel_aspect=%d/%d",
|
||||
codec->width, codec->height, codec->pix_fmt,
|
||||
is->video_st->time_base.num, is->video_st->time_base.den,
|
||||
codec->sample_aspect_ratio.num, codec->sample_aspect_ratio.den);
|
||||
codec->sample_aspect_ratio.num, FFMAX(codec->sample_aspect_ratio.den, 1));
|
||||
|
||||
if ((ret = avfilter_graph_create_filter(&filt_src,
|
||||
avfilter_get_by_name("buffer"),
|
||||
|
||||
+4
-2
@@ -2034,7 +2034,7 @@ static void compute_status(HTTPContext *c)
|
||||
char cpuperc[10];
|
||||
char cpuused[64];
|
||||
|
||||
if (fscanf(pid_stat, "%10s %64s", cpuperc,
|
||||
if (fscanf(pid_stat, "%9s %63s", cpuperc,
|
||||
cpuused) == 2) {
|
||||
avio_printf(pb, "Currently using %s%% of the cpu. Total time used %s.\n",
|
||||
cpuperc, cpuused);
|
||||
@@ -2937,12 +2937,14 @@ static int prepare_sdp_description(FFStream *stream, uint8_t **pbuffer,
|
||||
{
|
||||
AVFormatContext *avc;
|
||||
AVStream *avs = NULL;
|
||||
AVOutputFormat *rtp_format = av_guess_format("rtp", NULL, NULL);
|
||||
int i;
|
||||
|
||||
avc = avformat_alloc_context();
|
||||
if (avc == NULL) {
|
||||
if (avc == NULL || !rtp_format) {
|
||||
return -1;
|
||||
}
|
||||
avc->oformat = rtp_format;
|
||||
av_dict_set(&avc->metadata, "title",
|
||||
stream->title[0] ? stream->title : "No Title", 0);
|
||||
avc->nb_streams = stream->nb_streams;
|
||||
|
||||
+2
-2
@@ -522,7 +522,7 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
|
||||
|
||||
/* add current frame to queue */
|
||||
if (frame) {
|
||||
if ((ret = ff_af_queue_add(&s->afq, frame) < 0))
|
||||
if ((ret = ff_af_queue_add(&s->afq, frame)) < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -576,7 +576,7 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
|
||||
}
|
||||
start_ch += chans;
|
||||
}
|
||||
if ((ret = ff_alloc_packet2(avctx, avpkt, 768 * s->channels))) {
|
||||
if ((ret = ff_alloc_packet2(avctx, avpkt, 8192 * s->channels))) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Error getting output packet\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
+6
-2
@@ -224,7 +224,7 @@ static void lpc_prediction(int32_t *error_buffer, int32_t *buffer_out,
|
||||
}
|
||||
|
||||
/* read warm-up samples */
|
||||
for (i = 1; i <= lpc_order; i++)
|
||||
for (i = 1; i <= lpc_order && i < nb_samples; i++)
|
||||
buffer_out[i] = sign_extend(buffer_out[i - 1] + error_buffer[i], bps);
|
||||
|
||||
/* NOTE: 4 and 8 are very common cases that could be optimized. */
|
||||
@@ -542,7 +542,11 @@ static av_cold int alac_decode_close(AVCodecContext *avctx)
|
||||
static int allocate_buffers(ALACContext *alac)
|
||||
{
|
||||
int ch;
|
||||
int buf_size = alac->max_samples_per_frame * sizeof(int32_t);
|
||||
int buf_size;
|
||||
|
||||
if (alac->max_samples_per_frame > INT_MAX / sizeof(int32_t))
|
||||
goto buf_alloc_fail;
|
||||
buf_size = alac->max_samples_per_frame * sizeof(int32_t);
|
||||
|
||||
for (ch = 0; ch < FFMIN(alac->channels, 2); ch++) {
|
||||
FF_ALLOC_OR_GOTO(alac->avctx, alac->predict_error_buffer[ch],
|
||||
|
||||
@@ -368,7 +368,7 @@ int ff_ass_split_override_codes(const ASSCodesCallbacks *callbacks, void *priv,
|
||||
char new_line[2];
|
||||
int text_len = 0;
|
||||
|
||||
while (*buf) {
|
||||
while (buf && *buf) {
|
||||
if (text && callbacks->text &&
|
||||
(sscanf(buf, "\\%1[nN]", new_line) == 1 ||
|
||||
!strncmp(buf, "{\\", 2))) {
|
||||
|
||||
+1
-1
@@ -237,7 +237,7 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
int chunk_type;
|
||||
int inter;
|
||||
|
||||
if (buf_size < 17) {
|
||||
if (buf_size < 26) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Input buffer too small\n");
|
||||
*data_size = 0;
|
||||
return -1;
|
||||
|
||||
+4
-5
@@ -1242,7 +1242,7 @@ static int encode_slice(AVCodecContext *c, void *arg){
|
||||
}
|
||||
if(!fs->ac){
|
||||
if(f->version > 2)
|
||||
put_rac(&fs->c, (int[]){129}, 0);
|
||||
put_rac(&fs->c, (uint8_t[]){129}, 0);
|
||||
fs->ac_byte_count = f->version > 2 || (!x&&!y) ? ff_rac_terminate(&fs->c) : 0;
|
||||
init_put_bits(&fs->pb, fs->c.bytestream_start + fs->ac_byte_count, fs->c.bytestream_end - fs->c.bytestream_start - fs->ac_byte_count);
|
||||
}
|
||||
@@ -1313,9 +1313,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||
|
||||
for(i=1; i<f->slice_count; i++){
|
||||
FFV1Context *fs= f->slice_context[i];
|
||||
uint8_t *start = pkt->data + (pkt->size-used_count)*i/f->slice_count;
|
||||
uint8_t *start = pkt->data + (pkt->size-used_count)*(int64_t)i/f->slice_count;
|
||||
int len = pkt->size/f->slice_count;
|
||||
|
||||
ff_init_range_encoder(&fs->c, start, len);
|
||||
}
|
||||
avctx->execute(avctx, encode_slice, &f->slice_context[0], NULL, f->slice_count, sizeof(void*));
|
||||
@@ -1678,7 +1677,7 @@ static int decode_slice(AVCodecContext *c, void *arg){
|
||||
|
||||
if(!fs->ac){
|
||||
if (f->version == 3 && f->minor_version > 1 || f->version > 3)
|
||||
get_rac(&fs->c, (int[]){129});
|
||||
get_rac(&fs->c, (uint8_t[]){129});
|
||||
fs->ac_byte_count = f->version > 2 || (!x&&!y) ? fs->c.bytestream - fs->c.bytestream_start - 1 : 0;
|
||||
init_get_bits(&fs->gb,
|
||||
fs->c.bytestream_start + fs->ac_byte_count,
|
||||
@@ -1707,7 +1706,7 @@ static int decode_slice(AVCodecContext *c, void *arg){
|
||||
}
|
||||
if(fs->ac && f->version > 2) {
|
||||
int v;
|
||||
get_rac(&fs->c, (int[]){129});
|
||||
get_rac(&fs->c, (uint8_t[]){129});
|
||||
v = fs->c.bytestream_end - fs->c.bytestream - 2 - 5*f->ec;
|
||||
if(v) {
|
||||
av_log(f->avctx, AV_LOG_ERROR, "bytestream end mismatching by %d\n", v);
|
||||
|
||||
@@ -541,14 +541,18 @@ static int flac_parse(AVCodecParserContext *s, AVCodecContext *avctx,
|
||||
av_freep(&fpc->best_header);
|
||||
}
|
||||
|
||||
/* Find and score new headers. */
|
||||
while ((buf && read_end < buf + buf_size &&
|
||||
/* Find and score new headers. */
|
||||
/* buf_size is to zero when padding, so check for this since we do */
|
||||
/* not want to try to read more input once we have found the end. */
|
||||
/* Note that as (non-modified) parameters, buf can be non-NULL, */
|
||||
/* while buf_size is 0. */
|
||||
while ((buf && buf_size && read_end < buf + buf_size &&
|
||||
fpc->nb_headers_buffered < FLAC_MIN_HEADERS)
|
||||
|| (!buf && !fpc->end_padded)) {
|
||||
|| ((!buf || !buf_size) && !fpc->end_padded)) {
|
||||
int start_offset;
|
||||
|
||||
/* Pad the end once if EOF, to check the final region for headers. */
|
||||
if (!buf) {
|
||||
if (!buf || !buf_size) {
|
||||
fpc->end_padded = 1;
|
||||
buf_size = MAX_FRAME_HEADER_SIZE;
|
||||
read_end = read_start + MAX_FRAME_HEADER_SIZE;
|
||||
@@ -569,7 +573,7 @@ static int flac_parse(AVCodecParserContext *s, AVCodecContext *avctx,
|
||||
goto handle_error;
|
||||
}
|
||||
|
||||
if (buf) {
|
||||
if (buf && buf_size) {
|
||||
av_fifo_generic_write(fpc->fifo_buf, (void*) read_start,
|
||||
read_end - read_start, NULL);
|
||||
} else {
|
||||
|
||||
+16
-7
@@ -310,10 +310,11 @@ static inline int get_lowest_part_list_y(H264Context *h, Picture *pic, int n,
|
||||
int height, int y_offset, int list)
|
||||
{
|
||||
int raw_my = h->mv_cache[list][scan8[n]][1];
|
||||
int filter_height = (raw_my & 3) ? 2 : 0;
|
||||
int filter_height_up = (raw_my & 3) ? 2 : 0;
|
||||
int filter_height_down = (raw_my & 3) ? 3 : 0;
|
||||
int full_my = (raw_my >> 2) + y_offset;
|
||||
int top = full_my - filter_height;
|
||||
int bottom = full_my + filter_height + height;
|
||||
int top = full_my - filter_height_up;
|
||||
int bottom = full_my + filter_height_down + height;
|
||||
|
||||
return FFMAX(abs(top), bottom);
|
||||
}
|
||||
@@ -2669,7 +2670,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
|
||||
h->mb_mbaff = 0;
|
||||
h->mb_aff_frame = 0;
|
||||
last_pic_structure = s0->picture_structure;
|
||||
last_pic_dropable = s->dropable;
|
||||
last_pic_dropable = s0->dropable;
|
||||
s->dropable = h->nal_ref_idc == 0;
|
||||
if (h->sps.frame_mbs_only_flag) {
|
||||
s->picture_structure = PICT_FRAME;
|
||||
@@ -2794,7 +2795,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
|
||||
s->current_picture_ptr->frame_num = h->prev_frame_num;
|
||||
ff_thread_report_progress(&s->current_picture_ptr->f, INT_MAX, 0);
|
||||
ff_thread_report_progress(&s->current_picture_ptr->f, INT_MAX, 1);
|
||||
ff_generate_sliding_window_mmcos(h);
|
||||
ff_generate_sliding_window_mmcos(h, 1);
|
||||
if (ff_h264_execute_ref_pic_marking(h, h->mmco, h->mmco_index) < 0 &&
|
||||
(s->avctx->err_recognition & AV_EF_EXPLODE))
|
||||
return AVERROR_INVALIDDATA;
|
||||
@@ -2922,7 +2923,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
|
||||
h->ref_count[1] = get_ue_golomb(&s->gb) + 1;
|
||||
else
|
||||
// full range is spec-ok in this case, even for frames
|
||||
max[1] = 31;
|
||||
h->ref_count[1] = 1;
|
||||
}
|
||||
|
||||
if (h->ref_count[0]-1 > max[0] || h->ref_count[1]-1 > max[1]){
|
||||
@@ -2971,7 +2972,15 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
|
||||
}
|
||||
}
|
||||
|
||||
if (h->nal_ref_idc && ff_h264_decode_ref_pic_marking(h0, &s->gb) < 0 &&
|
||||
// If frame-mt is enabled, only update mmco tables for the first slice
|
||||
// in a field. Subsequent slices can temporarily clobber h->mmco_index
|
||||
// or h->mmco, which will cause ref list mix-ups and decoding errors
|
||||
// further down the line. This may break decoding if the first slice is
|
||||
// corrupt, thus we only do this if frame-mt is enabled.
|
||||
if (h->nal_ref_idc &&
|
||||
ff_h264_decode_ref_pic_marking(h0, &s->gb,
|
||||
!(s->avctx->active_thread_type & FF_THREAD_FRAME) ||
|
||||
h0->current_slice == 0) < 0 &&
|
||||
(s->avctx->err_recognition & AV_EF_EXPLODE))
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
|
||||
+3
-2
@@ -668,9 +668,10 @@ void ff_h264_remove_all_refs(H264Context *h);
|
||||
*/
|
||||
int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count);
|
||||
|
||||
int ff_h264_decode_ref_pic_marking(H264Context *h, GetBitContext *gb);
|
||||
int ff_h264_decode_ref_pic_marking(H264Context *h, GetBitContext *gb,
|
||||
int first_slice);
|
||||
|
||||
void ff_generate_sliding_window_mmcos(H264Context *h);
|
||||
void ff_generate_sliding_window_mmcos(H264Context *h, int first_slice);
|
||||
|
||||
/**
|
||||
* Check if the top & left blocks are available if needed & change the
|
||||
|
||||
+101
-43
@@ -480,22 +480,49 @@ static void print_long_term(H264Context *h) {
|
||||
}
|
||||
}
|
||||
|
||||
void ff_generate_sliding_window_mmcos(H264Context *h) {
|
||||
MpegEncContext * const s = &h->s;
|
||||
static int check_opcodes(MMCO *mmco1, MMCO *mmco2, int n_mmcos)
|
||||
{
|
||||
int i;
|
||||
|
||||
h->mmco_index= 0;
|
||||
if(h->short_ref_count && h->long_ref_count + h->short_ref_count >= h->sps.ref_frame_count &&
|
||||
!(FIELD_PICTURE && !s->first_field && s->current_picture_ptr->f.reference)) {
|
||||
h->mmco[0].opcode= MMCO_SHORT2UNUSED;
|
||||
h->mmco[0].short_pic_num= h->short_ref[ h->short_ref_count - 1 ]->frame_num;
|
||||
h->mmco_index= 1;
|
||||
for (i = 0; i < n_mmcos; i++) {
|
||||
if (mmco1[i].opcode != mmco2[i].opcode)
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ff_generate_sliding_window_mmcos(H264Context *h, int first_slice)
|
||||
{
|
||||
MpegEncContext * const s = &h->s;
|
||||
MMCO mmco_temp[MAX_MMCO_COUNT], *mmco = first_slice ? h->mmco : mmco_temp;
|
||||
int mmco_index = 0, i;
|
||||
|
||||
if (h->short_ref_count &&
|
||||
h->long_ref_count + h->short_ref_count >= h->sps.ref_frame_count &&
|
||||
!(FIELD_PICTURE && !s->first_field &&
|
||||
s->current_picture_ptr->f.reference)) {
|
||||
mmco[0].opcode = MMCO_SHORT2UNUSED;
|
||||
mmco[0].short_pic_num = h->short_ref[h->short_ref_count - 1]->frame_num;
|
||||
mmco_index = 1;
|
||||
if (FIELD_PICTURE) {
|
||||
h->mmco[0].short_pic_num *= 2;
|
||||
h->mmco[1].opcode= MMCO_SHORT2UNUSED;
|
||||
h->mmco[1].short_pic_num= h->mmco[0].short_pic_num + 1;
|
||||
h->mmco_index= 2;
|
||||
mmco[0].short_pic_num *= 2;
|
||||
mmco[1].opcode = MMCO_SHORT2UNUSED;
|
||||
mmco[1].short_pic_num = mmco[0].short_pic_num + 1;
|
||||
mmco_index = 2;
|
||||
}
|
||||
}
|
||||
|
||||
if (first_slice) {
|
||||
h->mmco_index = mmco_index;
|
||||
} else if (!first_slice && mmco_index >= 0 &&
|
||||
(mmco_index != h->mmco_index ||
|
||||
(i = check_opcodes(h->mmco, mmco_temp, mmco_index)))) {
|
||||
av_log(h->s.avctx, AV_LOG_ERROR,
|
||||
"Inconsistent MMCO state between slices [%d, %d, %d]\n",
|
||||
mmco_index, h->mmco_index, i);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
}
|
||||
|
||||
int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count){
|
||||
@@ -665,52 +692,83 @@ int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count){
|
||||
return (h->s.avctx->err_recognition & AV_EF_EXPLODE) ? err : 0;
|
||||
}
|
||||
|
||||
int ff_h264_decode_ref_pic_marking(H264Context *h, GetBitContext *gb){
|
||||
int ff_h264_decode_ref_pic_marking(H264Context *h, GetBitContext *gb,
|
||||
int first_slice)
|
||||
{
|
||||
MpegEncContext * const s = &h->s;
|
||||
int i;
|
||||
MMCO mmco_temp[MAX_MMCO_COUNT], *mmco = first_slice ? h->mmco : mmco_temp;
|
||||
int mmco_index = 0;
|
||||
|
||||
h->mmco_index= 0;
|
||||
if(h->nal_unit_type == NAL_IDR_SLICE){ //FIXME fields
|
||||
s->broken_link= get_bits1(gb) -1;
|
||||
if(get_bits1(gb)){
|
||||
h->mmco[0].opcode= MMCO_LONG;
|
||||
h->mmco[0].long_arg= 0;
|
||||
h->mmco_index= 1;
|
||||
if (h->nal_unit_type == NAL_IDR_SLICE){ // FIXME fields
|
||||
s->broken_link = get_bits1(gb) - 1;
|
||||
if (get_bits1(gb)){
|
||||
mmco[0].opcode = MMCO_LONG;
|
||||
mmco[0].long_arg = 0;
|
||||
mmco_index = 1;
|
||||
}
|
||||
}else{
|
||||
if(get_bits1(gb)){ // adaptive_ref_pic_marking_mode_flag
|
||||
for(i= 0; i<MAX_MMCO_COUNT; i++) {
|
||||
MMCOOpcode opcode= get_ue_golomb_31(gb);
|
||||
} else {
|
||||
if (get_bits1(gb)) { // adaptive_ref_pic_marking_mode_flag
|
||||
for (i = 0; i < MAX_MMCO_COUNT; i++) {
|
||||
MMCOOpcode opcode = get_ue_golomb_31(gb);
|
||||
|
||||
h->mmco[i].opcode= opcode;
|
||||
if(opcode==MMCO_SHORT2UNUSED || opcode==MMCO_SHORT2LONG){
|
||||
h->mmco[i].short_pic_num= (h->curr_pic_num - get_ue_golomb(gb) - 1) & (h->max_pic_num - 1);
|
||||
/* if(h->mmco[i].short_pic_num >= h->short_ref_count || h->short_ref[ h->mmco[i].short_pic_num ] == NULL){
|
||||
av_log(s->avctx, AV_LOG_ERROR, "illegal short ref in memory management control operation %d\n", mmco);
|
||||
return -1;
|
||||
}*/
|
||||
}
|
||||
if(opcode==MMCO_SHORT2LONG || opcode==MMCO_LONG2UNUSED || opcode==MMCO_LONG || opcode==MMCO_SET_MAX_LONG){
|
||||
unsigned int long_arg= get_ue_golomb_31(gb);
|
||||
if(long_arg >= 32 || (long_arg >= 16 && !(opcode == MMCO_SET_MAX_LONG && long_arg == 16) && !(opcode == MMCO_LONG2UNUSED && FIELD_PICTURE))){
|
||||
av_log(h->s.avctx, AV_LOG_ERROR, "illegal long ref in memory management control operation %d\n", opcode);
|
||||
mmco[i].opcode = opcode;
|
||||
if (opcode == MMCO_SHORT2UNUSED || opcode == MMCO_SHORT2LONG){
|
||||
mmco[i].short_pic_num =
|
||||
(h->curr_pic_num - get_ue_golomb(gb) - 1) &
|
||||
(h->max_pic_num - 1);
|
||||
#if 0
|
||||
if (mmco[i].short_pic_num >= h->short_ref_count ||
|
||||
h->short_ref[ mmco[i].short_pic_num ] == NULL){
|
||||
av_log(s->avctx, AV_LOG_ERROR,
|
||||
"illegal short ref in memory management control "
|
||||
"operation %d\n", mmco);
|
||||
return -1;
|
||||
}
|
||||
h->mmco[i].long_arg= long_arg;
|
||||
#endif
|
||||
}
|
||||
if (opcode == MMCO_SHORT2LONG || opcode == MMCO_LONG2UNUSED ||
|
||||
opcode == MMCO_LONG || opcode == MMCO_SET_MAX_LONG) {
|
||||
unsigned int long_arg = get_ue_golomb_31(gb);
|
||||
if (long_arg >= 32 ||
|
||||
(long_arg >= 16 && !(opcode == MMCO_SET_MAX_LONG &&
|
||||
long_arg == 16) &&
|
||||
!(opcode == MMCO_LONG2UNUSED && FIELD_PICTURE))){
|
||||
av_log(h->s.avctx, AV_LOG_ERROR,
|
||||
"illegal long ref in memory management control "
|
||||
"operation %d\n", opcode);
|
||||
return -1;
|
||||
}
|
||||
mmco[i].long_arg = long_arg;
|
||||
}
|
||||
|
||||
if(opcode > (unsigned)MMCO_LONG){
|
||||
av_log(h->s.avctx, AV_LOG_ERROR, "illegal memory management control operation %d\n", opcode);
|
||||
if (opcode > (unsigned) MMCO_LONG){
|
||||
av_log(h->s.avctx, AV_LOG_ERROR,
|
||||
"illegal memory management control operation %d\n",
|
||||
opcode);
|
||||
return -1;
|
||||
}
|
||||
if(opcode == MMCO_END)
|
||||
if (opcode == MMCO_END)
|
||||
break;
|
||||
}
|
||||
h->mmco_index= i;
|
||||
}else{
|
||||
ff_generate_sliding_window_mmcos(h);
|
||||
mmco_index = i;
|
||||
} else {
|
||||
if (first_slice)
|
||||
ff_generate_sliding_window_mmcos(h, first_slice);
|
||||
mmco_index = -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (first_slice && mmco_index != -1) {
|
||||
h->mmco_index = mmco_index;
|
||||
} else if (!first_slice && mmco_index >= 0 &&
|
||||
(mmco_index != h->mmco_index ||
|
||||
(i = check_opcodes(h->mmco, mmco_temp, mmco_index)))) {
|
||||
av_log(h->s.avctx, AV_LOG_ERROR,
|
||||
"Inconsistent MMCO state between slices [%d, %d, %d]\n",
|
||||
mmco_index, h->mmco_index, i);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -514,7 +514,10 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
av_log(avctx, AV_LOG_ERROR, "width must be even for this colorspace\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (s->predictor == MEDIAN && avctx->pix_fmt == PIX_FMT_YUV422P && avctx->width%4) {
|
||||
av_log(avctx, AV_LOG_ERROR, "width must be a multiple of 4 this colorspace and predictor\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
alloc_temp(s);
|
||||
|
||||
return 0;
|
||||
|
||||
+2
-2
@@ -562,13 +562,13 @@ static int decode_frame_ilbm(AVCodecContext *avctx,
|
||||
}
|
||||
} else if (avctx->codec_tag == MKTAG('P','B','M',' ')) { // IFF-PBM
|
||||
if (avctx->pix_fmt == PIX_FMT_PAL8 || avctx->pix_fmt == PIX_FMT_GRAY8) {
|
||||
for(y = 0; y < avctx->height; y++ ) {
|
||||
for(y = 0; y < avctx->height && buf_end > buf; y++ ) {
|
||||
uint8_t *row = &s->frame.data[0][y * s->frame.linesize[0]];
|
||||
memcpy(row, buf, FFMIN(avctx->width, buf_end - buf));
|
||||
buf += avctx->width + (avctx->width % 2); // padding if odd
|
||||
}
|
||||
} else if (s->ham) { // IFF-PBM: HAM to PIX_FMT_BGR32
|
||||
for (y = 0; y < avctx->height; y++) {
|
||||
for (y = 0; y < avctx->height && buf_end > buf; y++) {
|
||||
uint8_t *row = &s->frame.data[0][ y*s->frame.linesize[0] ];
|
||||
memcpy(s->ham_buf, buf, FFMIN(avctx->width, buf_end - buf));
|
||||
buf += avctx->width + (avctx->width & 1); // padding if odd
|
||||
|
||||
@@ -201,7 +201,7 @@ static int Faac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
|
||||
|
||||
/* add current frame to the queue */
|
||||
if (frame) {
|
||||
if ((ret = ff_af_queue_add(&s->afq, frame) < 0))
|
||||
if ((ret = ff_af_queue_add(&s->afq, frame)) < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -334,7 +334,7 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
|
||||
in_buf.bufElSizes = &in_buffer_element_size;
|
||||
|
||||
/* add current frame to the queue */
|
||||
if ((ret = ff_af_queue_add(&s->afq, frame) < 0))
|
||||
if ((ret = ff_af_queue_add(&s->afq, frame)) < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -234,7 +234,7 @@ static int mp3lame_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
|
||||
|
||||
/* add current frame to the queue */
|
||||
if (frame) {
|
||||
if ((ret = ff_af_queue_add(&s->afq, frame) < 0))
|
||||
if ((ret = ff_af_queue_add(&s->afq, frame)) < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -258,7 +258,7 @@ static int amr_nb_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
|
||||
if (frame->nb_samples < avctx->frame_size - avctx->delay)
|
||||
s->enc_last_frame = -1;
|
||||
}
|
||||
if ((ret = ff_af_queue_add(&s->afq, frame) < 0)) {
|
||||
if ((ret = ff_af_queue_add(&s->afq, frame)) < 0) {
|
||||
av_freep(&flush_buf);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -254,7 +254,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
|
||||
speex_encode_stereo_int(samples, s->header.frame_size, &s->bits);
|
||||
speex_encode_int(s->enc_state, samples, &s->bits);
|
||||
s->pkt_frame_count++;
|
||||
if ((ret = ff_af_queue_add(&s->afq, frame) < 0))
|
||||
if ((ret = ff_af_queue_add(&s->afq, frame)) < 0)
|
||||
return ret;
|
||||
} else {
|
||||
/* handle end-of-stream */
|
||||
|
||||
@@ -157,7 +157,7 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
|
||||
samples = (VO_PBYTE)frame->data[0];
|
||||
}
|
||||
/* add current frame to the queue */
|
||||
if ((ret = ff_af_queue_add(&s->afq, frame) < 0))
|
||||
if ((ret = ff_af_queue_add(&s->afq, frame)) < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -307,7 +307,7 @@ static int oggvorbis_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
|
||||
av_log(avctx, AV_LOG_ERROR, "error in vorbis_analysis_wrote()\n");
|
||||
return vorbis_error_to_averror(ret);
|
||||
}
|
||||
if ((ret = ff_af_queue_add(&s->afq, frame) < 0))
|
||||
if ((ret = ff_af_queue_add(&s->afq, frame)) < 0)
|
||||
return ret;
|
||||
} else {
|
||||
if (!s->eof)
|
||||
@@ -362,7 +362,9 @@ static int oggvorbis_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
|
||||
* libvorbis, so we have to update the AudioFrameQueue counts */
|
||||
if (!avctx->delay) {
|
||||
avctx->delay = duration;
|
||||
s->afq.remaining_delay += duration;
|
||||
av_assert0(!s->afq.remaining_delay);
|
||||
s->afq.frames->duration += duration;
|
||||
s->afq.frames->pts -= duration;
|
||||
s->afq.remaining_samples += duration;
|
||||
}
|
||||
ff_af_queue_remove(&s->afq, duration, &avpkt->pts, &avpkt->duration);
|
||||
|
||||
@@ -1097,6 +1097,11 @@ static int mjpeg_decode_scan_progressive_ac(MJpegDecodeContext *s, int ss,
|
||||
int last_scan = 0;
|
||||
int16_t *quant_matrix = s->quant_matrixes[s->quant_index[c]];
|
||||
|
||||
if (se > 63) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "SE %d is too large\n", se);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (!Al) {
|
||||
s->coefs_finished[c] |= (1LL << (se + 1)) - (1LL << ss);
|
||||
last_scan = !~s->coefs_finished[c];
|
||||
|
||||
@@ -83,7 +83,7 @@ static int mov_text_decode_frame(AVCodecContext *avctx,
|
||||
* In complex cases, there are style descriptors appended to the string
|
||||
* so we can't just assume the packet size is the string size.
|
||||
*/
|
||||
end = ptr + FFMAX(2 + AV_RB16(ptr), avpkt->size);
|
||||
end = ptr + FFMIN(2 + AV_RB16(ptr), avpkt->size);
|
||||
ptr += 2;
|
||||
|
||||
ts_start = av_rescale_q(avpkt->pts,
|
||||
|
||||
+5
-2
@@ -1989,8 +1989,6 @@ static int mpeg1_decode_sequence(AVCodecContext *avctx,
|
||||
|
||||
width = get_bits(&s->gb, 12);
|
||||
height = get_bits(&s->gb, 12);
|
||||
if (width <= 0 || height <= 0)
|
||||
return -1;
|
||||
s->aspect_ratio_info = get_bits(&s->gb, 4);
|
||||
if (s->aspect_ratio_info == 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "aspect ratio has forbidden 0 value\n");
|
||||
@@ -2356,6 +2354,11 @@ static int decode_chunks(AVCodecContext *avctx,
|
||||
break;
|
||||
|
||||
case PICTURE_START_CODE:
|
||||
if (s2->width <= 0 || s2->height <= 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "%dx%d is invalid\n", s2->width, s2->height);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if(s->tmpgexs){
|
||||
s2->intra_dc_precision= 3;
|
||||
s2->intra_matrix[0]= 1;
|
||||
|
||||
+20
-4
@@ -132,6 +132,9 @@ static av_cold int encode_init(AVCodecContext *avctx)
|
||||
{
|
||||
MpegEncContext *s = avctx->priv_data;
|
||||
|
||||
if (avctx->codec_id == AV_CODEC_ID_MPEG1VIDEO && avctx->height > 2800)
|
||||
avctx->thread_count = 1;
|
||||
|
||||
if(ff_MPV_encode_init(avctx) < 0)
|
||||
return -1;
|
||||
|
||||
@@ -167,6 +170,19 @@ static av_cold int encode_init(AVCodecContext *avctx)
|
||||
}
|
||||
}
|
||||
|
||||
if ((avctx->width & 0xFFF) == 0 && (avctx->height & 0xFFF) == 1) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Width / Height is invalid for MPEG2\n");
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
if (s->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL) {
|
||||
if ((avctx->width & 0xFFF) == 0 || (avctx->height & 0xFFF) == 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Width or Height are not allowed to be multiplies of 4096\n"
|
||||
"add '-strict %d' if you want to use them anyway.\n", FF_COMPLIANCE_UNOFFICIAL);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
}
|
||||
|
||||
s->drop_frame_timecode = s->drop_frame_timecode || !!(avctx->flags2 & CODEC_FLAG2_DROP_FRAME_TIMECODE);
|
||||
if (s->drop_frame_timecode)
|
||||
s->tc.flags |= AV_TIMECODE_FLAG_DROPFRAME;
|
||||
@@ -214,8 +230,8 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s)
|
||||
/* mpeg1 header repeated every gop */
|
||||
put_header(s, SEQ_START_CODE);
|
||||
|
||||
put_sbits(&s->pb, 12, s->width );
|
||||
put_sbits(&s->pb, 12, s->height);
|
||||
put_sbits(&s->pb, 12, s->width & 0xFFF);
|
||||
put_sbits(&s->pb, 12, s->height & 0xFFF);
|
||||
|
||||
for(i=1; i<15; i++){
|
||||
float error= aspect_ratio;
|
||||
@@ -459,7 +475,7 @@ static av_always_inline void mpeg1_encode_mb_internal(MpegEncContext *s,
|
||||
}
|
||||
|
||||
if (cbp == 0 && !first_mb && s->mv_type == MV_TYPE_16X16 &&
|
||||
(mb_x != s->mb_width - 1 || (mb_y != s->mb_height - 1 && s->codec_id == AV_CODEC_ID_MPEG1VIDEO)) &&
|
||||
(mb_x != s->mb_width - 1 || (mb_y != s->end_mb_y - 1 && s->codec_id == AV_CODEC_ID_MPEG1VIDEO)) &&
|
||||
((s->pict_type == AV_PICTURE_TYPE_P && (motion_x | motion_y) == 0) ||
|
||||
(s->pict_type == AV_PICTURE_TYPE_B && s->mv_dir == s->last_mv_dir && (((s->mv_dir & MV_DIR_FORWARD) ? ((s->mv[0][0][0] - s->last_mv[0][0][0])|(s->mv[0][0][1] - s->last_mv[0][0][1])) : 0) |
|
||||
((s->mv_dir & MV_DIR_BACKWARD) ? ((s->mv[1][0][0] - s->last_mv[1][0][0])|(s->mv[1][0][1] - s->last_mv[1][0][1])) : 0)) == 0))) {
|
||||
@@ -972,7 +988,7 @@ AVCodec ff_mpeg1video_encoder = {
|
||||
.supported_framerates = avpriv_frame_rate_tab+1,
|
||||
.pix_fmts = (const enum PixelFormat[]){ PIX_FMT_YUV420P,
|
||||
PIX_FMT_NONE },
|
||||
.capabilities = CODEC_CAP_DELAY,
|
||||
.capabilities = CODEC_CAP_DELAY | CODEC_CAP_SLICE_THREADS,
|
||||
.long_name = NULL_IF_CONFIG_SMALL("MPEG-1 video"),
|
||||
.priv_class = &mpeg1_class,
|
||||
};
|
||||
|
||||
@@ -402,6 +402,32 @@ av_cold int ff_MPV_encode_init(AVCodecContext *avctx)
|
||||
|
||||
s->loop_filter = !!(s->flags & CODEC_FLAG_LOOP_FILTER);
|
||||
|
||||
if (avctx->rc_max_rate && !avctx->rc_buffer_size) {
|
||||
switch(avctx->codec_id) {
|
||||
case AV_CODEC_ID_MPEG1VIDEO:
|
||||
case AV_CODEC_ID_MPEG2VIDEO:
|
||||
avctx->rc_buffer_size = FFMAX(avctx->rc_max_rate, 15000000) * 112L / 15000000 * 16384;
|
||||
break;
|
||||
case AV_CODEC_ID_MPEG4:
|
||||
case AV_CODEC_ID_MSMPEG4V1:
|
||||
case AV_CODEC_ID_MSMPEG4V2:
|
||||
case AV_CODEC_ID_MSMPEG4V3:
|
||||
if (avctx->rc_max_rate >= 15000000) {
|
||||
avctx->rc_buffer_size = 320 + (avctx->rc_max_rate - 15000000L) * (760-320) / (38400000 - 15000000);
|
||||
} else if(avctx->rc_max_rate >= 2000000) {
|
||||
avctx->rc_buffer_size = 80 + (avctx->rc_max_rate - 2000000L) * (320- 80) / (15000000 - 2000000);
|
||||
} else if(avctx->rc_max_rate >= 384000) {
|
||||
avctx->rc_buffer_size = 40 + (avctx->rc_max_rate - 384000L) * ( 80- 40) / ( 2000000 - 384000);
|
||||
} else
|
||||
avctx->rc_buffer_size = 40;
|
||||
avctx->rc_buffer_size *= 16384;
|
||||
break;
|
||||
}
|
||||
if (avctx->rc_buffer_size) {
|
||||
av_log(avctx, AV_LOG_INFO, "Automatically choosing VBV buffer size of %d kbyte\n", avctx->rc_buffer_size/8192);
|
||||
}
|
||||
}
|
||||
|
||||
if ((!avctx->rc_max_rate) != (!avctx->rc_buffer_size)) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Either both buffer size and max rate or neither must be specified\n");
|
||||
if (avctx->rc_max_rate && !avctx->rc_buffer_size)
|
||||
@@ -606,7 +632,7 @@ av_cold int ff_MPV_encode_init(AVCodecContext *avctx)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (s->avctx->thread_count > 1)
|
||||
if (s->avctx->slices > 1 || s->avctx->thread_count > 1)
|
||||
s->rtp_mode = 1;
|
||||
|
||||
if (s->avctx->thread_count > 1 && s->codec_id == AV_CODEC_ID_H263P)
|
||||
|
||||
@@ -397,7 +397,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
|
||||
if (frame->nb_samples >= NELLY_BUF_LEN)
|
||||
s->last_frame = 1;
|
||||
}
|
||||
if ((ret = ff_af_queue_add(&s->afq, frame) < 0))
|
||||
if ((ret = ff_af_queue_add(&s->afq, frame)) < 0)
|
||||
return ret;
|
||||
} else {
|
||||
memset(s->buf + NELLY_BUF_LEN, 0, NELLY_SAMPLES * sizeof(*s->buf));
|
||||
|
||||
@@ -222,6 +222,11 @@ static int parse_picture_segment(AVCodecContext *avctx,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (buf_size > rle_bitmap_len) {
|
||||
av_log(avctx, AV_LOG_ERROR, "too much RLE data\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
ctx->pictures[picture_id].w = width;
|
||||
ctx->pictures[picture_id].h = height;
|
||||
|
||||
|
||||
@@ -1259,6 +1259,11 @@ static void qdm2_decode_super_block (QDM2Context *q)
|
||||
for (i = 0; packet_bytes > 0; i++) {
|
||||
int j;
|
||||
|
||||
if (i>=FF_ARRAY_ELEMS(q->sub_packet_list_A)) {
|
||||
SAMPLES_NEEDED_2("too many packet bytes");
|
||||
return;
|
||||
}
|
||||
|
||||
q->sub_packet_list_A[i].next = NULL;
|
||||
|
||||
if (i > 0) {
|
||||
|
||||
@@ -536,7 +536,7 @@ static int ra144_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
|
||||
for (; i < frame->nb_samples; i++)
|
||||
ractx->curr_block[i] = samples[i] >> 2;
|
||||
|
||||
if ((ret = ff_af_queue_add(&ractx->afq, frame) < 0))
|
||||
if ((ret = ff_af_queue_add(&ractx->afq, frame)) < 0)
|
||||
return ret;
|
||||
} else
|
||||
ractx->last_frame = 1;
|
||||
|
||||
@@ -169,6 +169,12 @@ static av_cold int roq_decode_init(AVCodecContext *avctx)
|
||||
RoqContext *s = avctx->priv_data;
|
||||
|
||||
s->avctx = avctx;
|
||||
|
||||
if (avctx->width%16 || avctx->height%16) {
|
||||
av_log_ask_for_sample(avctx, "dimensions not being a multiple of 16 are unsupported\n");
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
|
||||
s->width = avctx->width;
|
||||
s->height = avctx->height;
|
||||
avcodec_get_frame_defaults(&s->frames[0]);
|
||||
|
||||
+4
-4
@@ -250,7 +250,7 @@ static int add_doubles_metadata(int count,
|
||||
int i;
|
||||
double *dp;
|
||||
|
||||
if (count >= INT_MAX / sizeof(int64_t))
|
||||
if (count >= INT_MAX / sizeof(int64_t) || count <= 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (bytestream2_get_bytes_left(&s->gb) < count * sizeof(int64_t))
|
||||
return AVERROR_INVALIDDATA;
|
||||
@@ -276,7 +276,7 @@ static int add_shorts_metadata(int count, const char *name,
|
||||
int i;
|
||||
int16_t *sp;
|
||||
|
||||
if (count >= INT_MAX / sizeof(int16_t))
|
||||
if (count >= INT_MAX / sizeof(int16_t) || count <= 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (bytestream2_get_bytes_left(&s->gb) < count * sizeof(int16_t))
|
||||
return AVERROR_INVALIDDATA;
|
||||
@@ -737,7 +737,7 @@ static int tiff_decode_tag(TiffContext *s)
|
||||
break;
|
||||
case TIFF_ROWSPERSTRIP:
|
||||
if (type == TIFF_LONG && value == UINT_MAX)
|
||||
value = s->avctx->height;
|
||||
value = s->height;
|
||||
if (value < 1) {
|
||||
av_log(s->avctx, AV_LOG_ERROR,
|
||||
"Incorrect value of rows per strip\n");
|
||||
@@ -843,7 +843,7 @@ static int tiff_decode_tag(TiffContext *s)
|
||||
s->fax_opts = value;
|
||||
break;
|
||||
#define ADD_METADATA(count, name, sep)\
|
||||
if (ret = add_metadata(count, type, name, sep, s) < 0) {\
|
||||
if ((ret = add_metadata(count, type, name, sep, s)) < 0) {\
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Error allocating temporary buffer\n");\
|
||||
return ret;\
|
||||
}
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
#include <pthread.h>
|
||||
#elif HAVE_W32THREADS
|
||||
#include "w32pthreads.h"
|
||||
#elif HAVE_OS2THREADS
|
||||
#include "os2threads.h"
|
||||
#endif
|
||||
|
||||
#define VP8_MAX_QUANT 127
|
||||
|
||||
@@ -566,9 +566,7 @@ static int vqa_decode_chunk(VqaContext *s)
|
||||
|
||||
s->partial_countdown--;
|
||||
if (s->partial_countdown <= 0) {
|
||||
GetByteContext gb;
|
||||
|
||||
bytestream2_init(&gb, s->next_codebook_buffer, s->next_codebook_buffer_index);
|
||||
bytestream2_init(&s->gb, s->next_codebook_buffer, s->next_codebook_buffer_index);
|
||||
/* decompress codebook */
|
||||
if ((res = decode_format80(s, s->next_codebook_buffer_index,
|
||||
s->codebook, s->codebook_size, 0)) < 0)
|
||||
|
||||
@@ -1206,11 +1206,12 @@ static int wavpack_decode_frame(AVCodecContext *avctx, void *data,
|
||||
}
|
||||
|
||||
/* get output buffer */
|
||||
s->frame.nb_samples = s->samples;
|
||||
s->frame.nb_samples = s->samples + 1;
|
||||
if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
|
||||
return ret;
|
||||
}
|
||||
s->frame.nb_samples = s->samples;
|
||||
|
||||
while (buf_size > 0) {
|
||||
if (!s->multichannel) {
|
||||
|
||||
@@ -254,7 +254,7 @@ static int color_config_props(AVFilterLink *inlink)
|
||||
if (av_image_check_size(test->w, test->h, 0, ctx) < 0)
|
||||
return AVERROR(EINVAL);
|
||||
|
||||
if (ret = config_props(inlink) < 0)
|
||||
if ((ret = config_props(inlink)) < 0)
|
||||
return ret;
|
||||
|
||||
av_log(ctx, AV_LOG_VERBOSE, "color:0x%02x%02x%02x%02x\n",
|
||||
|
||||
@@ -28,6 +28,11 @@
|
||||
|
||||
#define PACKET_SIZE 3200
|
||||
|
||||
typedef struct ASFPayload {
|
||||
uint8_t type;
|
||||
uint16_t size;
|
||||
} ASFPayload;
|
||||
|
||||
typedef struct {
|
||||
int num;
|
||||
unsigned char seq;
|
||||
@@ -47,6 +52,9 @@ typedef struct {
|
||||
|
||||
int palette_changed;
|
||||
uint32_t palette[256];
|
||||
|
||||
int payload_ext_ct;
|
||||
ASFPayload payload[8];
|
||||
} ASFStream;
|
||||
|
||||
typedef struct {
|
||||
|
||||
+63
-20
@@ -513,8 +513,10 @@ static int asf_read_ext_stream_properties(AVFormatContext *s, int64_t size)
|
||||
stream_ct = avio_rl16(pb); //stream-name-count
|
||||
payload_ext_ct = avio_rl16(pb); //payload-extension-system-count
|
||||
|
||||
if (stream_num < 128)
|
||||
if (stream_num < 128) {
|
||||
asf->stream_bitrates[stream_num] = leak_rate;
|
||||
asf->streams[stream_num].payload_ext_ct = 0;
|
||||
}
|
||||
|
||||
for (i=0; i<stream_ct; i++){
|
||||
avio_rl16(pb);
|
||||
@@ -523,10 +525,18 @@ static int asf_read_ext_stream_properties(AVFormatContext *s, int64_t size)
|
||||
}
|
||||
|
||||
for (i=0; i<payload_ext_ct; i++){
|
||||
int size;
|
||||
ff_get_guid(pb, &g);
|
||||
avio_skip(pb, 2);
|
||||
size = avio_rl16(pb);
|
||||
ext_len=avio_rl32(pb);
|
||||
avio_skip(pb, ext_len);
|
||||
if (stream_num < 128 && i < FF_ARRAY_ELEMS(asf->streams[stream_num].payload)) {
|
||||
ASFPayload *p = &asf->streams[stream_num].payload[i];
|
||||
p->type = g[0];
|
||||
p->size = size;
|
||||
av_log(s, AV_LOG_DEBUG, "Payload extension %x %d\n", g[0], p->size );
|
||||
asf->streams[stream_num].payload_ext_ct ++;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -776,12 +786,12 @@ static int asf_read_header(AVFormatContext *s)
|
||||
if (!st->codec->bit_rate)
|
||||
st->codec->bit_rate = asf->stream_bitrates[i];
|
||||
if (asf->dar[i].num > 0 && asf->dar[i].den > 0){
|
||||
av_reduce(&st->sample_aspect_ratio.den,
|
||||
&st->sample_aspect_ratio.num,
|
||||
av_reduce(&st->sample_aspect_ratio.num,
|
||||
&st->sample_aspect_ratio.den,
|
||||
asf->dar[i].num, asf->dar[i].den, INT_MAX);
|
||||
} else if ((asf->dar[0].num > 0) && (asf->dar[0].den > 0) && (st->codec->codec_type==AVMEDIA_TYPE_VIDEO)) // Use ASF container value if the stream doesn't AR set.
|
||||
av_reduce(&st->sample_aspect_ratio.den,
|
||||
&st->sample_aspect_ratio.num,
|
||||
av_reduce(&st->sample_aspect_ratio.num,
|
||||
&st->sample_aspect_ratio.den,
|
||||
asf->dar[0].num, asf->dar[0].den, INT_MAX);
|
||||
|
||||
//av_log(s, AV_LOG_INFO, "i=%d, st->codec->codec_type:%d, dar %d:%d sar=%d:%d\n", i, st->codec->codec_type, dar[i].num, dar[i].den, st->sample_aspect_ratio.num, st->sample_aspect_ratio.den);
|
||||
@@ -915,13 +925,16 @@ static int ff_asf_get_packet(AVFormatContext *s, AVIOContext *pb)
|
||||
*/
|
||||
static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb){
|
||||
ASFContext *asf = s->priv_data;
|
||||
ASFStream *asfst;
|
||||
int rsize = 1;
|
||||
int num = avio_r8(pb);
|
||||
int i;
|
||||
int64_t ts0, ts1 av_unused;
|
||||
|
||||
asf->packet_segments--;
|
||||
asf->packet_key_frame = num >> 7;
|
||||
asf->stream_index = asf->asfid2avid[num & 0x7f];
|
||||
asfst = &asf->streams[num & 0x7f];
|
||||
// sequence should be ignored!
|
||||
DO_2BITS(asf->packet_property >> 4, asf->packet_seq, 0);
|
||||
DO_2BITS(asf->packet_property >> 2, asf->packet_frag_offset, 0);
|
||||
@@ -932,26 +945,56 @@ static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb){
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if (asf->packet_replic_size >= 8) {
|
||||
int64_t end = avio_tell(pb) + asf->packet_replic_size;
|
||||
AVRational aspect;
|
||||
asf->packet_obj_size = avio_rl32(pb);
|
||||
if(asf->packet_obj_size >= (1<<24) || asf->packet_obj_size <= 0){
|
||||
av_log(s, AV_LOG_ERROR, "packet_obj_size invalid\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
asf->packet_frag_timestamp = avio_rl32(pb); // timestamp
|
||||
if(asf->packet_replic_size >= 8+38+4){
|
||||
// for(i=0; i<asf->packet_replic_size-8; i++)
|
||||
// av_log(s, AV_LOG_DEBUG, "%02X ",avio_r8(pb));
|
||||
// av_log(s, AV_LOG_DEBUG, "\n");
|
||||
avio_skip(pb, 10);
|
||||
ts0= avio_rl64(pb);
|
||||
ts1= avio_rl64(pb);
|
||||
avio_skip(pb, 12);
|
||||
avio_rl32(pb);
|
||||
avio_skip(pb, asf->packet_replic_size - 8 - 38 - 4);
|
||||
if(ts0!= -1) asf->packet_frag_timestamp= ts0/10000;
|
||||
else asf->packet_frag_timestamp= AV_NOPTS_VALUE;
|
||||
}else
|
||||
avio_skip(pb, asf->packet_replic_size - 8);
|
||||
|
||||
for (i=0; i<asfst->payload_ext_ct; i++) {
|
||||
ASFPayload *p = &asfst->payload[i];
|
||||
int size = p->size;
|
||||
int64_t payend;
|
||||
if(size == 0xFFFF)
|
||||
size = avio_rl16(pb);
|
||||
payend = avio_tell(pb) + size;
|
||||
if (payend > end) {
|
||||
av_log(s, AV_LOG_ERROR, "too long payload\n");
|
||||
break;
|
||||
}
|
||||
switch(p->type) {
|
||||
case 0x50:
|
||||
// duration = avio_rl16(pb);
|
||||
break;
|
||||
case 0x54:
|
||||
aspect.num = avio_r8(pb);
|
||||
aspect.den = avio_r8(pb);
|
||||
if (aspect.num > 0 && aspect.den > 0 && asf->stream_index >= 0) {
|
||||
s->streams[asf->stream_index]->sample_aspect_ratio = aspect;
|
||||
}
|
||||
break;
|
||||
case 0x2A:
|
||||
avio_skip(pb, 8);
|
||||
ts0= avio_rl64(pb);
|
||||
ts1= avio_rl64(pb);
|
||||
if(ts0!= -1) asf->packet_frag_timestamp= ts0/10000;
|
||||
else asf->packet_frag_timestamp= AV_NOPTS_VALUE;
|
||||
break;
|
||||
case 0x5B:
|
||||
case 0xB7:
|
||||
case 0xCC:
|
||||
case 0xC0:
|
||||
case 0xA0:
|
||||
//unknown
|
||||
break;
|
||||
}
|
||||
avio_seek(pb, payend, SEEK_SET);
|
||||
}
|
||||
|
||||
avio_seek(pb, end, SEEK_SET);
|
||||
rsize += asf->packet_replic_size; // FIXME - check validity
|
||||
} else if (asf->packet_replic_size==1){
|
||||
// multipacket - frag_offset is beginning timestamp
|
||||
|
||||
@@ -1262,6 +1262,11 @@ static int avi_read_idx1(AVFormatContext *s, int size)
|
||||
avi->stream_index = -1;
|
||||
avio_seek(pb, idx1_pos, SEEK_SET);
|
||||
|
||||
if (s->nb_streams == 1 && s->streams[0]->codec->codec_tag == AV_RL32("MMES")){
|
||||
first_packet_pos = 0;
|
||||
data_offset = avi->movi_list;
|
||||
}
|
||||
|
||||
/* Read the entries and sort them in each stream component. */
|
||||
for(i = 0; i < nb_index_entries; i++) {
|
||||
if(url_feof(pb))
|
||||
|
||||
+13
-11
@@ -778,14 +778,16 @@ static int mov_read_moof(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
return mov_read_default(c, pb, atom);
|
||||
}
|
||||
|
||||
static void mov_metadata_creation_time(AVDictionary **metadata, time_t time)
|
||||
static void mov_metadata_creation_time(AVDictionary **metadata, int64_t time)
|
||||
{
|
||||
char buffer[32];
|
||||
if (time) {
|
||||
struct tm *ptm;
|
||||
time_t timet;
|
||||
if(time >= 2082844800)
|
||||
time -= 2082844800; /* seconds between 1904-01-01 and Epoch */
|
||||
ptm = gmtime(&time);
|
||||
timet = time;
|
||||
ptm = gmtime(&timet);
|
||||
if (!ptm) return;
|
||||
strftime(buffer, sizeof(buffer), "%Y-%m-%d %H:%M:%S", ptm);
|
||||
av_dict_set(metadata, "creation_time", buffer, 0);
|
||||
@@ -799,7 +801,7 @@ static int mov_read_mdhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
int version;
|
||||
char language[4] = {0};
|
||||
unsigned lang;
|
||||
time_t creation_time;
|
||||
int64_t creation_time;
|
||||
|
||||
if (c->fc->nb_streams < 1)
|
||||
return 0;
|
||||
@@ -834,7 +836,7 @@ static int mov_read_mdhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
|
||||
static int mov_read_mvhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
{
|
||||
time_t creation_time;
|
||||
int64_t creation_time;
|
||||
int version = avio_r8(pb); /* version */
|
||||
avio_rb24(pb); /* flags */
|
||||
|
||||
@@ -2671,25 +2673,24 @@ static int mov_read_chan2(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mov_read_tref(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
static int mov_read_tmcd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
{
|
||||
uint32_t i, size;
|
||||
uint32_t i;
|
||||
MOVStreamContext *sc;
|
||||
|
||||
if (c->fc->nb_streams < 1)
|
||||
return AVERROR_INVALIDDATA;
|
||||
sc = c->fc->streams[c->fc->nb_streams - 1]->priv_data;
|
||||
|
||||
size = avio_rb32(pb);
|
||||
if (size < 12)
|
||||
if (atom.size < 4)
|
||||
return 0;
|
||||
|
||||
sc->trefs_count = (size - 4) / 8;
|
||||
sc->trefs_count = atom.size / 4;
|
||||
sc->trefs = av_malloc(sc->trefs_count * sizeof(*sc->trefs));
|
||||
if (!sc->trefs)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
sc->tref_type = avio_rl32(pb);
|
||||
sc->tref_type = atom.type;
|
||||
for (i = 0; i < sc->trefs_count; i++)
|
||||
sc->trefs[i] = avio_rb32(pb);
|
||||
return 0;
|
||||
@@ -2742,7 +2743,8 @@ static const MOVParseTableEntry mov_default_parse_table[] = {
|
||||
{ MKTAG('t','f','h','d'), mov_read_tfhd }, /* track fragment header */
|
||||
{ MKTAG('t','r','a','k'), mov_read_trak },
|
||||
{ MKTAG('t','r','a','f'), mov_read_default },
|
||||
{ MKTAG('t','r','e','f'), mov_read_tref },
|
||||
{ MKTAG('t','r','e','f'), mov_read_default },
|
||||
{ MKTAG('t','m','c','d'), mov_read_tmcd },
|
||||
{ MKTAG('c','h','a','p'), mov_read_chap },
|
||||
{ MKTAG('t','r','e','x'), mov_read_trex },
|
||||
{ MKTAG('t','r','u','n'), mov_read_trun },
|
||||
|
||||
@@ -887,10 +887,11 @@ static int mov_get_rawvideo_codec_tag(AVFormatContext *s, MOVTrack *track)
|
||||
int i;
|
||||
|
||||
for (i = 0; i < FF_ARRAY_ELEMS(mov_pix_fmt_tags); i++) {
|
||||
if (track->enc->codec_tag == mov_pix_fmt_tags[i].tag && track->enc->pix_fmt == mov_pix_fmt_tags[i].pix_fmt) {
|
||||
if (track->enc->pix_fmt == mov_pix_fmt_tags[i].pix_fmt) {
|
||||
tag = mov_pix_fmt_tags[i].tag;
|
||||
track->enc->bits_per_coded_sample = mov_pix_fmt_tags[i].bps;
|
||||
break;
|
||||
if (track->enc->codec_tag == mov_pix_fmt_tags[i].tag)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -497,7 +497,7 @@ static int mpegps_read_packet(AVFormatContext *s,
|
||||
if(st->discard >= AVDISCARD_ALL)
|
||||
goto skip;
|
||||
if (startcode >= 0xa0 && startcode <= 0xaf) {
|
||||
if (lpcm_header_len == 6) {
|
||||
if (lpcm_header_len == 6 && st->codec->codec_id == AV_CODEC_ID_MLP) {
|
||||
if (len < 6)
|
||||
goto skip;
|
||||
avio_skip(s->pb, 6);
|
||||
|
||||
+7
-2
@@ -771,8 +771,13 @@ int ff_read_riff_info(AVFormatContext *s, int64_t size)
|
||||
chunk_code = avio_rl32(pb);
|
||||
chunk_size = avio_rl32(pb);
|
||||
if (chunk_size > end || end - chunk_size < cur || chunk_size == UINT_MAX) {
|
||||
av_log(s, AV_LOG_ERROR, "too big INFO subchunk\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
avio_seek(pb, -9, SEEK_CUR);
|
||||
chunk_code = avio_rl32(pb);
|
||||
chunk_size = avio_rl32(pb);
|
||||
if (chunk_size > end || end - chunk_size < cur || chunk_size == UINT_MAX) {
|
||||
av_log(s, AV_LOG_ERROR, "too big INFO subchunk\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
}
|
||||
|
||||
chunk_size += (chunk_size & 1);
|
||||
|
||||
@@ -1793,7 +1793,7 @@ static int handle_invoke(URLContext *s, RTMPPacket *pkt)
|
||||
!memcmp(pkt->data, "\002\000\007publish", 10) ||
|
||||
!memcmp(pkt->data, "\002\000\010_checkbw", 11) ||
|
||||
!memcmp(pkt->data, "\002\000\014createStream", 15)) {
|
||||
if (ret = send_invoke_response(s, pkt) < 0)
|
||||
if ((ret = send_invoke_response(s, pkt)) < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ static int zlib_refill(void *opaque, uint8_t *buf, int buf_size)
|
||||
retry:
|
||||
if (!z->avail_in) {
|
||||
int n = avio_read(s->pb, swf->zbuf_in, ZBUF_SIZE);
|
||||
if (n <= 0)
|
||||
if (n < 0)
|
||||
return n;
|
||||
z->next_in = swf->zbuf_in;
|
||||
z->avail_in = n;
|
||||
|
||||
+26
-17
@@ -459,7 +459,7 @@ int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt,
|
||||
{
|
||||
AVProbeData pd = { filename ? filename : "", NULL, -offset };
|
||||
unsigned char *buf = NULL;
|
||||
int ret = 0, probe_size;
|
||||
int ret = 0, probe_size, buf_offset = 0;
|
||||
|
||||
if (!max_probe_size) {
|
||||
max_probe_size = PROBE_BUF_MAX;
|
||||
@@ -499,7 +499,7 @@ int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt,
|
||||
score = 0;
|
||||
ret = 0; /* error was end of file, nothing read */
|
||||
}
|
||||
pd.buf_size += ret;
|
||||
pd.buf_size = buf_offset += ret;
|
||||
pd.buf = &buf[offset];
|
||||
|
||||
memset(pd.buf + pd.buf_size, 0, AVPROBE_PADDING_SIZE);
|
||||
@@ -676,6 +676,21 @@ fail:
|
||||
|
||||
/*******************************************************/
|
||||
|
||||
static void force_codec_ids(AVFormatContext *s, AVStream *st)
|
||||
{
|
||||
switch(st->codec->codec_type){
|
||||
case AVMEDIA_TYPE_VIDEO:
|
||||
if(s->video_codec_id) st->codec->codec_id= s->video_codec_id;
|
||||
break;
|
||||
case AVMEDIA_TYPE_AUDIO:
|
||||
if(s->audio_codec_id) st->codec->codec_id= s->audio_codec_id;
|
||||
break;
|
||||
case AVMEDIA_TYPE_SUBTITLE:
|
||||
if(s->subtitle_codec_id)st->codec->codec_id= s->subtitle_codec_id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void probe_codec(AVFormatContext *s, AVStream *st, const AVPacket *pkt)
|
||||
{
|
||||
if(st->request_probe>0){
|
||||
@@ -716,25 +731,11 @@ no_packet:
|
||||
}else
|
||||
av_log(s, AV_LOG_WARNING, "probed stream %d failed\n", st->index);
|
||||
}
|
||||
force_codec_ids(s, st);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void force_codec_ids(AVFormatContext *s, AVStream *st)
|
||||
{
|
||||
switch(st->codec->codec_type){
|
||||
case AVMEDIA_TYPE_VIDEO:
|
||||
if(s->video_codec_id) st->codec->codec_id= s->video_codec_id;
|
||||
break;
|
||||
case AVMEDIA_TYPE_AUDIO:
|
||||
if(s->audio_codec_id) st->codec->codec_id= s->audio_codec_id;
|
||||
break;
|
||||
case AVMEDIA_TYPE_SUBTITLE:
|
||||
if(s->subtitle_codec_id)st->codec->codec_id= s->subtitle_codec_id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
{
|
||||
int ret, i;
|
||||
@@ -845,6 +846,13 @@ static int get_audio_frame_size(AVCodecContext *enc, int size, int mux)
|
||||
if (enc->frame_size > 1)
|
||||
return enc->frame_size;
|
||||
|
||||
//For WMA we currently have no other means to calculate duration thus we
|
||||
//do it here by assuming CBR, which is true for all known cases.
|
||||
if(!mux && enc->bit_rate>0 && size>0 && enc->sample_rate>0 && enc->block_align>1) {
|
||||
if (enc->codec_id == AV_CODEC_ID_WMAV1 || enc->codec_id == AV_CODEC_ID_WMAV2)
|
||||
return ((int64_t)size * 8 * enc->sample_rate) / enc->bit_rate;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -3056,6 +3064,7 @@ void ff_free_stream(AVFormatContext *s, AVStream *st){
|
||||
av_freep(&st->codec);
|
||||
av_freep(&st->priv_data);
|
||||
av_freep(&st->info);
|
||||
av_freep(&st->probe_data.buf);
|
||||
av_freep(&s->streams[ --s->nb_streams ]);
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -527,8 +527,7 @@ static int wav_read_header(AVFormatContext *s)
|
||||
}
|
||||
switch (list_type) {
|
||||
case MKTAG('I', 'N', 'F', 'O'):
|
||||
if ((ret = ff_read_riff_info(s, size - 4)) < 0)
|
||||
return ret;
|
||||
ff_read_riff_info(s, size - 4);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
typedef void (RENAME(mix_any_func_type))(SAMPLE **out, const SAMPLE **in1, COEFF *coeffp, int len);
|
||||
typedef void (RENAME(mix_any_func_type))(SAMPLE **out, const SAMPLE **in1, COEFF *coeffp, integer len);
|
||||
|
||||
static void RENAME(sum2)(SAMPLE *out, const SAMPLE *in1, const SAMPLE *in2, COEFF *coeffp, int index1, int index2, int len){
|
||||
static void RENAME(sum2)(SAMPLE *out, const SAMPLE *in1, const SAMPLE *in2, COEFF *coeffp, integer index1, integer index2, integer len){
|
||||
int i;
|
||||
COEFF coeff1 = coeffp[index1];
|
||||
COEFF coeff2 = coeffp[index2];
|
||||
@@ -29,14 +29,14 @@ static void RENAME(sum2)(SAMPLE *out, const SAMPLE *in1, const SAMPLE *in2, COEF
|
||||
out[i] = R(coeff1*in1[i] + coeff2*in2[i]);
|
||||
}
|
||||
|
||||
static void RENAME(copy)(SAMPLE *out, const SAMPLE *in, COEFF *coeffp, int index, int len){
|
||||
static void RENAME(copy)(SAMPLE *out, const SAMPLE *in, COEFF *coeffp, integer index, integer len){
|
||||
int i;
|
||||
COEFF coeff = coeffp[index];
|
||||
for(i=0; i<len; i++)
|
||||
out[i] = R(coeff*in[i]);
|
||||
}
|
||||
|
||||
static void RENAME(mix6to2)(SAMPLE **out, const SAMPLE **in, COEFF *coeffp, int len){
|
||||
static void RENAME(mix6to2)(SAMPLE **out, const SAMPLE **in, COEFF *coeffp, integer len){
|
||||
int i;
|
||||
|
||||
for(i=0; i<len; i++) {
|
||||
@@ -46,7 +46,7 @@ static void RENAME(mix6to2)(SAMPLE **out, const SAMPLE **in, COEFF *coeffp, int
|
||||
}
|
||||
}
|
||||
|
||||
static void RENAME(mix8to2)(SAMPLE **out, const SAMPLE **in, COEFF *coeffp, int len){
|
||||
static void RENAME(mix8to2)(SAMPLE **out, const SAMPLE **in, COEFF *coeffp, integer len){
|
||||
int i;
|
||||
|
||||
for(i=0; i<len; i++) {
|
||||
|
||||
@@ -770,7 +770,7 @@ int64_t swr_next_pts(struct SwrContext *s, int64_t pts){
|
||||
if(s->min_compensation >= FLT_MAX) {
|
||||
return (s->outpts = pts - swr_get_delay(s, s->in_sample_rate * (int64_t)s->out_sample_rate));
|
||||
} else {
|
||||
int64_t delta = pts - swr_get_delay(s, s->in_sample_rate * (int64_t)s->out_sample_rate) - s->outpts;
|
||||
int64_t delta = pts - swr_get_delay(s, s->in_sample_rate * (int64_t)s->out_sample_rate) - s->outpts + s->drop_output*(int64_t)s->in_sample_rate;
|
||||
double fdelta = delta /(double)(s->in_sample_rate * (int64_t)s->out_sample_rate);
|
||||
|
||||
if(fabs(fdelta) > s->min_compensation) {
|
||||
|
||||
@@ -23,13 +23,20 @@
|
||||
|
||||
#include "swresample.h"
|
||||
#include "libavutil/audioconvert.h"
|
||||
#include "config.h"
|
||||
|
||||
#define SQRT3_2 1.22474487139158904909 /* sqrt(3/2) */
|
||||
|
||||
typedef void (mix_1_1_func_type)(void *out, const void *in, void *coeffp, int index, int len);
|
||||
typedef void (mix_2_1_func_type)(void *out, const void *in1, const void *in2, void *coeffp, int index1, int index2, int len);
|
||||
#if ARCH_X86_64
|
||||
typedef int64_t integer;
|
||||
#else
|
||||
typedef int integer;
|
||||
#endif
|
||||
|
||||
typedef void (mix_any_func_type)(uint8_t **out, const uint8_t **in1, void *coeffp, int len);
|
||||
typedef void (mix_1_1_func_type)(void *out, const void *in, void *coeffp, integer index, integer len);
|
||||
typedef void (mix_2_1_func_type)(void *out, const void *in1, const void *in2, void *coeffp, integer index1, integer index2, integer len);
|
||||
|
||||
typedef void (mix_any_func_type)(uint8_t **out, const uint8_t **in1, void *coeffp, integer len);
|
||||
|
||||
typedef struct AudioData{
|
||||
uint8_t *ch[SWR_CH_MAX]; ///< samples buffer per channel
|
||||
|
||||
@@ -40,11 +40,13 @@ fate-mszh: CMD = framecrc -i $(SAMPLES)/lcl/mszh-1frame.avi
|
||||
FATE_LOSSLESS_VIDEO += fate-vble
|
||||
fate-vble: CMD = framecrc -i $(SAMPLES)/vble/flowers-partial-2MB.avi
|
||||
|
||||
FATE_LOSSLESS_VIDEO += fate-zlib
|
||||
FATE_LOSSLESS_VIDEO-$(CONFIG_ZLIB) += fate-zlib
|
||||
fate-zlib: CMD = framecrc -i $(SAMPLES)/lcl/zlib-1frame.avi
|
||||
|
||||
FATE_LOSSLESS_VIDEO += fate-zerocodec
|
||||
FATE_LOSSLESS_VIDEO-$(CONFIG_ZLIB) += fate-zerocodec
|
||||
fate-zerocodec: CMD = framecrc -i $(SAMPLES)/zerocodec/sample-zeco.avi
|
||||
|
||||
FATE_LOSSLESS_VIDEO += $(FATE_LOSSLESS_VIDEO-yes)
|
||||
|
||||
FATE_SAMPLES_FFMPEG += $(FATE_LOSSLESS_VIDEO)
|
||||
fate-lossless-video: $(FATE_LOSSLESS_VIDEO)
|
||||
|
||||
+3
-1
@@ -46,8 +46,10 @@ fate-rpza: CMD = framecrc -i $(SAMPLES)/rpza/rpza2.mov -t 2 -pix_fmt rgb24
|
||||
FATE_QT += fate-svq1
|
||||
fate-svq1: CMD = framecrc -i $(SAMPLES)/svq1/marymary-shackles.mov -an -t 10
|
||||
|
||||
FATE_QT += fate-svq3
|
||||
FATE_QT-$(CONFIG_ZLIB) += fate-svq3
|
||||
fate-svq3: CMD = framecrc -i $(SAMPLES)/svq3/Vertical400kbit.sorenson3.mov -t 6 -an
|
||||
|
||||
FATE_QT += $(FATE_QT-yes)
|
||||
|
||||
FATE_SAMPLES_FFMPEG += $(FATE_QT)
|
||||
fate-qt: $(FATE_QT)
|
||||
|
||||
@@ -32,7 +32,7 @@ fate-tscc-15bit: CMD = framecrc -i $(SAMPLES)/tscc/oneminute.avi -t 15 -pix_fmt
|
||||
FATE_TSCC += fate-tscc-32bit
|
||||
fate-tscc-32bit: CMD = framecrc -i $(SAMPLES)/tscc/2004-12-17-uebung9-partial.avi -pix_fmt rgb24 -an
|
||||
|
||||
FATE_SCREEN += $(FATE_TSCC)
|
||||
FATE_SCREEN-$(CONFIG_ZLIB) += $(FATE_TSCC)
|
||||
fate-tscc: $(FATE_TSCC)
|
||||
|
||||
FATE_VMNC += fate-vmnc-16bit
|
||||
@@ -56,8 +56,10 @@ fate-zmbv-16bit: CMD = framecrc -i $(SAMPLES)/zmbv/zmbv_16bit.avi -pix_fmt rgb24
|
||||
FATE_ZMBV += fate-zmbv-32bit
|
||||
fate-zmbv-32bit: CMD = framecrc -i $(SAMPLES)/zmbv/zmbv_32bit.avi -pix_fmt rgb24 -t 25
|
||||
|
||||
FATE_SCREEN += $(FATE_ZMBV)
|
||||
FATE_SCREEN-$(CONFIG_ZLIB) += $(FATE_ZMBV)
|
||||
fate-zmbv: $(FATE_ZMBV)
|
||||
|
||||
FATE_SCREEN += $(FATE_SCREEN-yes)
|
||||
|
||||
FATE_SAMPLES_FFMPEG += $(FATE_SCREEN)
|
||||
fate-screen: $(FATE_SCREEN)
|
||||
|
||||
@@ -59,12 +59,12 @@ fate-vsynth%-ffv1: ENCOPTS = -strict -2
|
||||
|
||||
FATE_VCODEC += ffvhuff
|
||||
|
||||
FATE_VCODEC += flashsv
|
||||
FATE_VCODEC-$(CONFIG_ZLIB) += flashsv
|
||||
fate-vsynth%-flashsv: ENCOPTS = -sws_flags neighbor+full_chroma_int
|
||||
fate-vsynth%-flashsv: DECOPTS = -sws_flags area
|
||||
fate-vsynth%-flashsv: FMT = flv
|
||||
|
||||
FATE_VCODEC += flashsv2
|
||||
FATE_VCODEC-$(CONFIG_ZLIB) += flashsv2
|
||||
fate-vsynth%-flashsv2: ENCOPTS = -sws_flags neighbor+full_chroma_int -strict experimental -compression_level 0
|
||||
fate-vsynth%-flashsv2: DECOPTS = -sws_flags area
|
||||
fate-vsynth%-flashsv2: FMT = flv
|
||||
@@ -193,7 +193,7 @@ fate-vsynth%-msmpeg4: ENCOPTS = -qscale 10
|
||||
FATE_VCODEC += msmpeg4v2
|
||||
fate-vsynth%-msmpeg4v2: ENCOPTS = -qscale 10
|
||||
|
||||
FATE_VCODEC += mpng
|
||||
FATE_VCODEC-$(CONFIG_ZLIB) += mpng
|
||||
fate-vsynth%-mpng: CODEC = png
|
||||
|
||||
FATE_VCODEC += msvideo1
|
||||
@@ -277,8 +277,9 @@ FATE_VCODEC += yuv4
|
||||
|
||||
FATE_VCODEC += y41p
|
||||
|
||||
FATE_VCODEC += zlib
|
||||
FATE_VCODEC-$(CONFIG_ZLIB) += zlib
|
||||
|
||||
FATE_VCODEC += $(FATE_VCODEC-yes)
|
||||
|
||||
FATE_VSYNTH1 = $(FATE_VCODEC:%=fate-vsynth1-%)
|
||||
FATE_VSYNTH2 = $(FATE_VCODEC:%=fate-vsynth2-%)
|
||||
|
||||
@@ -49,7 +49,7 @@ fate-cdgraphics: CMD = framecrc -i $(SAMPLES)/cdgraphics/BrotherJohn.cdg -pix_fm
|
||||
FATE_VIDEO += fate-cljr
|
||||
fate-cljr: CMD = framecrc -i $(SAMPLES)/cljr/testcljr-partial.avi
|
||||
|
||||
FATE_VIDEO += fate-corepng
|
||||
FATE_VIDEO-$(CONFIG_ZLIB) += fate-corepng
|
||||
fate-corepng: CMD = framecrc -i $(SAMPLES)/png1/corepng-partial.avi
|
||||
|
||||
FATE_VIDEO += fate-creatureshock-avs
|
||||
@@ -97,7 +97,7 @@ fate-dxa-feeble: CMD = framecrc -i $(SAMPLES)/dxa/meetsquid.dxa -t 2 -pix_fmt rg
|
||||
FATE_DXA += fate-dxa-scummvm
|
||||
fate-dxa-scummvm: CMD = framecrc -i $(SAMPLES)/dxa/scummvm.dxa -pix_fmt rgb24
|
||||
|
||||
FATE_VIDEO += $(FATE_DXA)
|
||||
FATE_VIDEO-$(CONFIG_ZLIB) += $(FATE_DXA)
|
||||
fate-dxa: $(FATE_DXA)
|
||||
|
||||
FATE_SAMPLES_PCM += fate-film-cvid
|
||||
|
||||
Reference in New Issue
Block a user