Compare commits
66 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 86a01362c0 | |||
| 9789612689 | |||
| 3769601fb6 | |||
| 2528468e20 | |||
| f1d59a207f | |||
| 85b2396265 | |||
| 25dc978bb1 | |||
| 13838647ca | |||
| 133dc77da9 | |||
| 9ce4686bfe | |||
| 50e04b3f3c | |||
| 226727f08f | |||
| b8021620e2 | |||
| a0f4f12b62 | |||
| c351cd720a | |||
| 7279be7c75 | |||
| f5fd937fc5 | |||
| de43442391 | |||
| 3b9cb8d7d8 | |||
| b9510b3274 | |||
| 30099bf0f0 | |||
| f2fde86dae | |||
| a40e6a214e | |||
| 3e8b73e65b | |||
| 8babbdc9b1 | |||
| e91df69cf2 | |||
| 855ae45c5a | |||
| b1959b1719 | |||
| ecae610207 | |||
| 33a67961c8 | |||
| fc1fed62d9 | |||
| 0684cd5d8c | |||
| a4a87a7efd | |||
| b76dc8b5b8 | |||
| 6e2204b152 | |||
| 81bdaacb65 | |||
| 3e3193f03c | |||
| 3b17c1e13e | |||
| 8abe459ac6 | |||
| bebe3d35f3 | |||
| 7c270a5e3b | |||
| 20a03d5c93 | |||
| 57710c3646 | |||
| 0d481efb7b | |||
| 92a36a4e78 | |||
| ef33242c2a | |||
| 1c983ee2c1 | |||
| a6d59978a0 | |||
| e9ddf726aa | |||
| c52c9f534e | |||
| 0d31a01d3a | |||
| 475d68e0f5 | |||
| 7fd20799d7 | |||
| bf00132a14 | |||
| ede5946b70 | |||
| 3cd2c33d36 | |||
| c494be6411 | |||
| 2d855c94b6 | |||
| f249e98891 | |||
| 92888e9ed4 | |||
| 3f10a779b4 | |||
| 8f238dd9bd | |||
| da4f5d9d77 | |||
| 931f5b2351 | |||
| b807e987f1 | |||
| e7fdd6aa0d |
@@ -106,7 +106,7 @@ endef
|
||||
|
||||
$(foreach P,$(PROGS),$(eval $(call DOPROG,$(P:$(PROGSSUF)$(EXESUF)=))))
|
||||
|
||||
ffprobe.o cmdutils.o : libavutil/ffversion.h
|
||||
ffprobe.o cmdutils.o libavcodec/utils.o libavformat/utils.o libavdevice/avdevice.o libavfilter/avfilter.o libavutil/utils.o libpostproc/postprocess.o libswresample/swresample.o libswscale/utils.o : libavutil/ffversion.h
|
||||
|
||||
$(PROGS): %$(PROGSSUF)$(EXESUF): %$(PROGSSUF)_g$(EXESUF)
|
||||
$(CP) $< $@
|
||||
|
||||
+1
-1
@@ -1803,7 +1803,7 @@ int read_yesno(void)
|
||||
|
||||
int cmdutils_read_file(const char *filename, char **bufptr, size_t *size)
|
||||
{
|
||||
int ret;
|
||||
int64_t ret;
|
||||
FILE *f = av_fopen_utf8(filename, "rb");
|
||||
|
||||
if (!f) {
|
||||
|
||||
@@ -5176,7 +5176,7 @@ cat > $TMPH <<EOF
|
||||
#define FFMPEG_CONFIG_H
|
||||
#define FFMPEG_CONFIGURATION "$(c_escape $FFMPEG_CONFIGURATION)"
|
||||
#define FFMPEG_LICENSE "$(c_escape $license)"
|
||||
#define CONFIG_THIS_YEAR 2014
|
||||
#define CONFIG_THIS_YEAR 2015
|
||||
#define FFMPEG_DATADIR "$(eval c_escape $datadir)"
|
||||
#define AVCONV_DATADIR "$(eval c_escape $datadir)"
|
||||
#define CC_IDENT "$(c_escape ${cc_ident:-Unknown compiler})"
|
||||
@@ -5203,6 +5203,7 @@ enabled getenv || echo "#define getenv(x) NULL" >> $TMPH
|
||||
|
||||
|
||||
mkdir -p doc
|
||||
mkdir -p tests
|
||||
echo "@c auto-generated by configure" > doc/config.texi
|
||||
|
||||
print_config ARCH_ "$config_files" $ARCH_LIST
|
||||
|
||||
+1
-1
@@ -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 = 2.2.11
|
||||
PROJECT_NUMBER = 2.2.12
|
||||
|
||||
# With the PROJECT_LOGO tag one can specify a logo or icon that is included
|
||||
# in the documentation. The maximum height of the logo should not exceed 55
|
||||
|
||||
@@ -2284,7 +2284,7 @@ static int transcode_init(void)
|
||||
AVCodecContext *codec;
|
||||
OutputStream *ost;
|
||||
InputStream *ist;
|
||||
char error[1024];
|
||||
char error[1024] = {0};
|
||||
int want_sdp = 1;
|
||||
|
||||
for (i = 0; i < nb_filtergraphs; i++) {
|
||||
|
||||
@@ -2349,6 +2349,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#else
|
||||
if (s->xch_present && !s->xch_disable) {
|
||||
#endif
|
||||
if (avctx->channel_layout & AV_CH_BACK_CENTER) {
|
||||
avpriv_request_sample(avctx, "XCh with Back center channel");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
avctx->channel_layout |= AV_CH_BACK_CENTER;
|
||||
if (s->lfe) {
|
||||
avctx->channel_layout |= AV_CH_LOW_FREQUENCY;
|
||||
|
||||
+15
-13
@@ -37,7 +37,7 @@ typedef struct DVDSubContext
|
||||
int has_palette;
|
||||
uint8_t colormap[4];
|
||||
uint8_t alpha[256];
|
||||
uint8_t *buf;
|
||||
uint8_t buf[0x10000];
|
||||
int buf_size;
|
||||
#ifdef DEBUG
|
||||
int sub_id;
|
||||
@@ -105,6 +105,12 @@ static int decode_rle(uint8_t *bitmap, int linesize, int w, int h,
|
||||
int x, y, len, color;
|
||||
uint8_t *d;
|
||||
|
||||
if (start >= buf_size)
|
||||
return -1;
|
||||
|
||||
if (w <= 0 || h <= 0)
|
||||
return -1;
|
||||
|
||||
bit_len = (buf_size - start) * 8;
|
||||
init_get_bits(&gb, buf + start, bit_len);
|
||||
|
||||
@@ -356,10 +362,12 @@ static int decode_dvd_subtitles(DVDSubContext *ctx, AVSubtitle *sub_header,
|
||||
sub_header->rects[0] = av_mallocz(sizeof(AVSubtitleRect));
|
||||
sub_header->num_rects = 1;
|
||||
sub_header->rects[0]->pict.data[0] = bitmap;
|
||||
decode_rle(bitmap, w * 2, w, (h + 1) / 2,
|
||||
buf, offset1, buf_size, is_8bit);
|
||||
decode_rle(bitmap + w, w * 2, w, h / 2,
|
||||
buf, offset2, buf_size, is_8bit);
|
||||
if (decode_rle(bitmap, w * 2, w, (h + 1) / 2,
|
||||
buf, offset1, buf_size, is_8bit) < 0)
|
||||
goto fail;
|
||||
if (decode_rle(bitmap + w, w * 2, w, h / 2,
|
||||
buf, offset2, buf_size, is_8bit) < 0)
|
||||
goto fail;
|
||||
sub_header->rects[0]->pict.data[1] = av_mallocz(AVPALETTE_SIZE);
|
||||
if (is_8bit) {
|
||||
if (yuv_palette == 0)
|
||||
@@ -494,15 +502,11 @@ static int append_to_cached_buf(AVCodecContext *avctx,
|
||||
{
|
||||
DVDSubContext *ctx = avctx->priv_data;
|
||||
|
||||
if (ctx->buf_size > 0xffff - buf_size) {
|
||||
if (ctx->buf_size >= sizeof(ctx->buf) - buf_size) {
|
||||
av_log(avctx, AV_LOG_WARNING, "Attempt to reconstruct "
|
||||
"too large SPU packets aborted.\n");
|
||||
av_freep(&ctx->buf);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
ctx->buf = av_realloc(ctx->buf, ctx->buf_size + buf_size);
|
||||
if (!ctx->buf)
|
||||
return AVERROR(ENOMEM);
|
||||
memcpy(ctx->buf + ctx->buf_size, buf, buf_size);
|
||||
ctx->buf_size += buf_size;
|
||||
return 0;
|
||||
@@ -518,7 +522,7 @@ static int dvdsub_decode(AVCodecContext *avctx,
|
||||
AVSubtitle *sub = data;
|
||||
int is_menu;
|
||||
|
||||
if (ctx->buf) {
|
||||
if (ctx->buf_size) {
|
||||
int ret = append_to_cached_buf(avctx, buf, buf_size);
|
||||
if (ret < 0) {
|
||||
*data_size = 0;
|
||||
@@ -556,7 +560,6 @@ static int dvdsub_decode(AVCodecContext *avctx,
|
||||
}
|
||||
#endif
|
||||
|
||||
av_freep(&ctx->buf);
|
||||
ctx->buf_size = 0;
|
||||
*data_size = 1;
|
||||
return buf_size;
|
||||
@@ -638,7 +641,6 @@ static av_cold int dvdsub_init(AVCodecContext *avctx)
|
||||
static av_cold int dvdsub_close(AVCodecContext *avctx)
|
||||
{
|
||||
DVDSubContext *ctx = avctx->priv_data;
|
||||
av_freep(&ctx->buf);
|
||||
ctx->buf_size = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -685,7 +685,7 @@ static int flac_parse(AVCodecParserContext *s, AVCodecContext *avctx,
|
||||
handle_error:
|
||||
*poutbuf = NULL;
|
||||
*poutbuf_size = 0;
|
||||
return read_end - buf;
|
||||
return buf_size ? read_end - buf : 0;
|
||||
}
|
||||
|
||||
static av_cold int flac_parse_init(AVCodecParserContext *c)
|
||||
|
||||
+1
-1
@@ -269,7 +269,7 @@ static int gif_read_image(GifState *s, AVFrame *frame)
|
||||
break;
|
||||
}
|
||||
while (y1 >= height) {
|
||||
y1 = 4 >> pass;
|
||||
y1 = 4 >> pass;
|
||||
ptr = ptr1 + linesize * y1;
|
||||
pass++;
|
||||
}
|
||||
|
||||
@@ -1233,6 +1233,7 @@ static void free_tables(H264Context *h, int free_rbsp)
|
||||
av_buffer_pool_uninit(&h->ref_index_pool);
|
||||
|
||||
if (free_rbsp && h->DPB) {
|
||||
memset(h->delayed_pic, 0, sizeof(h->delayed_pic));
|
||||
for (i = 0; i < MAX_PICTURE_COUNT; i++)
|
||||
unref_picture(h, &h->DPB[i]);
|
||||
av_freep(&h->DPB);
|
||||
@@ -2706,6 +2707,16 @@ int ff_pred_weight_table(H264Context *h)
|
||||
h->luma_log2_weight_denom = get_ue_golomb(&h->gb);
|
||||
if (h->sps.chroma_format_idc)
|
||||
h->chroma_log2_weight_denom = get_ue_golomb(&h->gb);
|
||||
|
||||
if (h->luma_log2_weight_denom > 7U) {
|
||||
av_log(h->avctx, AV_LOG_ERROR, "luma_log2_weight_denom %d is out of range\n", h->luma_log2_weight_denom);
|
||||
h->luma_log2_weight_denom = 0;
|
||||
}
|
||||
if (h->chroma_log2_weight_denom > 7U) {
|
||||
av_log(h->avctx, AV_LOG_ERROR, "chroma_log2_weight_denom %d is out of range\n", h->chroma_log2_weight_denom);
|
||||
h->chroma_log2_weight_denom = 0;
|
||||
}
|
||||
|
||||
luma_def = 1 << h->luma_log2_weight_denom;
|
||||
chroma_def = 1 << h->chroma_log2_weight_denom;
|
||||
|
||||
|
||||
@@ -286,6 +286,7 @@ typedef struct MMCO {
|
||||
* H264Context
|
||||
*/
|
||||
typedef struct H264Context {
|
||||
AVClass *av_class;
|
||||
AVCodecContext *avctx;
|
||||
VideoDSPContext vdsp;
|
||||
H264DSPContext h264dsp;
|
||||
|
||||
+20
-7
@@ -112,7 +112,7 @@ static int pic_arrays_init(HEVCContext *s, const HEVCSPS *sps)
|
||||
if (!s->tab_ipm || !s->cbf_luma || !s->is_pcm)
|
||||
goto fail;
|
||||
|
||||
s->filter_slice_edges = av_malloc(ctb_count);
|
||||
s->filter_slice_edges = av_mallocz(ctb_count);
|
||||
s->tab_slice_address = av_malloc_array(pic_size_in_ctb,
|
||||
sizeof(*s->tab_slice_address));
|
||||
s->qp_y_tab = av_malloc_array(pic_size_in_ctb,
|
||||
@@ -2568,17 +2568,30 @@ static int decode_nal_units(HEVCContext *s, const uint8_t *buf, int length)
|
||||
|
||||
if (s->nals_allocated < s->nb_nals + 1) {
|
||||
int new_size = s->nals_allocated + 1;
|
||||
HEVCNAL *tmp = av_realloc_array(s->nals, new_size, sizeof(*tmp));
|
||||
void *tmp = av_realloc_array(s->nals, new_size, sizeof(*s->nals));
|
||||
ret = AVERROR(ENOMEM);
|
||||
if (!tmp) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto fail;
|
||||
}
|
||||
s->nals = tmp;
|
||||
memset(s->nals + s->nals_allocated, 0,
|
||||
(new_size - s->nals_allocated) * sizeof(*tmp));
|
||||
av_reallocp_array(&s->skipped_bytes_nal, new_size, sizeof(*s->skipped_bytes_nal));
|
||||
av_reallocp_array(&s->skipped_bytes_pos_size_nal, new_size, sizeof(*s->skipped_bytes_pos_size_nal));
|
||||
av_reallocp_array(&s->skipped_bytes_pos_nal, new_size, sizeof(*s->skipped_bytes_pos_nal));
|
||||
(new_size - s->nals_allocated) * sizeof(*s->nals));
|
||||
|
||||
tmp = av_realloc_array(s->skipped_bytes_nal, new_size, sizeof(*s->skipped_bytes_nal));
|
||||
if (!tmp)
|
||||
goto fail;
|
||||
s->skipped_bytes_nal = tmp;
|
||||
|
||||
tmp = av_realloc_array(s->skipped_bytes_pos_size_nal, new_size, sizeof(*s->skipped_bytes_pos_size_nal));
|
||||
if (!tmp)
|
||||
goto fail;
|
||||
s->skipped_bytes_pos_size_nal = tmp;
|
||||
|
||||
tmp = av_realloc_array(s->skipped_bytes_pos_nal, new_size, sizeof(*s->skipped_bytes_pos_nal));
|
||||
if (!tmp)
|
||||
goto fail;
|
||||
s->skipped_bytes_pos_nal = tmp;
|
||||
|
||||
s->skipped_bytes_pos_size_nal[s->nals_allocated] = 1024; // initial buffer size
|
||||
s->skipped_bytes_pos_nal[s->nals_allocated] = av_malloc_array(s->skipped_bytes_pos_size_nal[s->nals_allocated], sizeof(*s->skipped_bytes_pos));
|
||||
s->nals_allocated = new_size;
|
||||
|
||||
@@ -1072,6 +1072,14 @@ int ff_hevc_decode_nal_pps(HEVCContext *s)
|
||||
if (pps->cu_qp_delta_enabled_flag)
|
||||
pps->diff_cu_qp_delta_depth = get_ue_golomb_long(gb);
|
||||
|
||||
if (pps->diff_cu_qp_delta_depth < 0 ||
|
||||
pps->diff_cu_qp_delta_depth > sps->log2_diff_max_min_coding_block_size) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "diff_cu_qp_delta_depth %d is invalid\n",
|
||||
pps->diff_cu_qp_delta_depth);
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto err;
|
||||
}
|
||||
|
||||
pps->cb_qp_offset = get_se_golomb(gb);
|
||||
if (pps->cb_qp_offset < -12 || pps->cb_qp_offset > 12) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "pps_cb_qp_offset out of range: %d\n",
|
||||
|
||||
+5
-3
@@ -94,7 +94,7 @@ typedef struct Indeo3DecodeContext {
|
||||
|
||||
int16_t width, height;
|
||||
uint32_t frame_num; ///< current frame number (zero-based)
|
||||
uint32_t data_size; ///< size of the frame data in bytes
|
||||
int data_size; ///< size of the frame data in bytes
|
||||
uint16_t frame_flags; ///< frame properties
|
||||
uint8_t cb_offset; ///< needed for selecting VQ tables
|
||||
uint8_t buf_sel; ///< active frame buffer: 0 - primary, 1 -secondary
|
||||
@@ -899,7 +899,8 @@ static int decode_frame_headers(Indeo3DecodeContext *ctx, AVCodecContext *avctx,
|
||||
GetByteContext gb;
|
||||
const uint8_t *bs_hdr;
|
||||
uint32_t frame_num, word2, check_sum, data_size;
|
||||
uint32_t y_offset, u_offset, v_offset, starts[3], ends[3];
|
||||
int y_offset, u_offset, v_offset;
|
||||
uint32_t starts[3], ends[3];
|
||||
uint16_t height, width;
|
||||
int i, j;
|
||||
|
||||
@@ -981,7 +982,8 @@ static int decode_frame_headers(Indeo3DecodeContext *ctx, AVCodecContext *avctx,
|
||||
ctx->y_data_size = ends[0] - starts[0];
|
||||
ctx->v_data_size = ends[1] - starts[1];
|
||||
ctx->u_data_size = ends[2] - starts[2];
|
||||
if (FFMAX3(y_offset, v_offset, u_offset) >= ctx->data_size - 16 ||
|
||||
if (FFMIN3(y_offset, v_offset, u_offset) < 0 ||
|
||||
FFMAX3(y_offset, v_offset, u_offset) >= ctx->data_size - 16 ||
|
||||
FFMIN3(y_offset, v_offset, u_offset) < gb.buffer - bs_hdr + 16 ||
|
||||
FFMIN3(ctx->y_data_size, ctx->v_data_size, ctx->u_data_size) <= 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "One of the y/u/v offsets is invalid\n");
|
||||
|
||||
@@ -43,6 +43,13 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
{
|
||||
JvContext *s = avctx->priv_data;
|
||||
|
||||
if (!avctx->width || !avctx->height ||
|
||||
(avctx->width & 7) || (avctx->height & 7)) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid video dimensions: %dx%d\n",
|
||||
avctx->width, avctx->height);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
s->frame = av_frame_alloc();
|
||||
if (!s->frame)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
@@ -240,8 +240,8 @@ int ff_mjpeg_decode_dht(MJpegDecodeContext *s)
|
||||
int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
|
||||
{
|
||||
int len, nb_components, i, width, height, bits, pix_fmt_id, ret;
|
||||
int h_count[MAX_COMPONENTS];
|
||||
int v_count[MAX_COMPONENTS];
|
||||
int h_count[MAX_COMPONENTS] = { 0 };
|
||||
int v_count[MAX_COMPONENTS] = { 0 };
|
||||
|
||||
s->cur_scan = 0;
|
||||
s->upscale_h = s->upscale_v = 0;
|
||||
@@ -249,7 +249,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
|
||||
/* XXX: verify len field validity */
|
||||
len = get_bits(&s->gb, 16);
|
||||
s->avctx->bits_per_raw_sample =
|
||||
bits = get_bits(&s->gb, 8);
|
||||
bits = get_bits(&s->gb, 8);
|
||||
|
||||
if (s->pegasus_rct)
|
||||
bits = 9;
|
||||
@@ -292,8 +292,6 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
|
||||
s->nb_components = nb_components;
|
||||
s->h_max = 1;
|
||||
s->v_max = 1;
|
||||
memset(h_count, 0, sizeof(h_count));
|
||||
memset(v_count, 0, sizeof(v_count));
|
||||
for (i = 0; i < nb_components; i++) {
|
||||
/* component id */
|
||||
s->component_id[i] = get_bits(&s->gb, 8) - 1;
|
||||
@@ -328,10 +326,9 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
|
||||
|
||||
|
||||
/* if different size, realloc/alloc picture */
|
||||
if ( width != s->width || height != s->height
|
||||
|| bits != s->bits
|
||||
|| memcmp(s->h_count, h_count, sizeof(h_count))
|
||||
|| memcmp(s->v_count, v_count, sizeof(v_count))) {
|
||||
if (width != s->width || height != s->height || bits != s->bits ||
|
||||
memcmp(s->h_count, h_count, sizeof(h_count)) ||
|
||||
memcmp(s->v_count, v_count, sizeof(v_count))) {
|
||||
|
||||
s->width = width;
|
||||
s->height = height;
|
||||
|
||||
@@ -61,6 +61,13 @@ static av_cold int mm_decode_init(AVCodecContext *avctx)
|
||||
|
||||
avctx->pix_fmt = AV_PIX_FMT_PAL8;
|
||||
|
||||
if (!avctx->width || !avctx->height ||
|
||||
(avctx->width & 1) || (avctx->height & 1)) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid video dimensions: %dx%d\n",
|
||||
avctx->width, avctx->height);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
s->frame = av_frame_alloc();
|
||||
if (!s->frame)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
+7
-6
@@ -120,12 +120,13 @@ static void av_noinline qpeg_decode_inter(QpegContext *qctx, uint8_t *dst,
|
||||
int filled = 0;
|
||||
int orig_height;
|
||||
|
||||
if(!refdata)
|
||||
refdata= dst;
|
||||
|
||||
/* copy prev frame */
|
||||
for(i = 0; i < height; i++)
|
||||
memcpy(dst + (i * stride), refdata + (i * stride), width);
|
||||
if (refdata) {
|
||||
/* copy prev frame */
|
||||
for (i = 0; i < height; i++)
|
||||
memcpy(dst + (i * stride), refdata + (i * stride), width);
|
||||
} else {
|
||||
refdata = dst;
|
||||
}
|
||||
|
||||
orig_height = height;
|
||||
height--;
|
||||
|
||||
+1
-1
@@ -70,7 +70,7 @@ typedef struct SmcContext {
|
||||
row_ptr += stride * 4; \
|
||||
} \
|
||||
total_blocks--; \
|
||||
if (total_blocks < 0 + !!n_blocks) \
|
||||
if (total_blocks < !!n_blocks) \
|
||||
{ \
|
||||
av_log(s->avctx, AV_LOG_INFO, "warning: block counter just went negative (this should not happen)\n"); \
|
||||
return; \
|
||||
|
||||
@@ -65,6 +65,9 @@
|
||||
#include "compat/os2threads.h"
|
||||
#endif
|
||||
|
||||
#include "libavutil/ffversion.h"
|
||||
const char av_codec_ffversion[] = "FFmpeg version " FFMPEG_VERSION;
|
||||
|
||||
#if HAVE_PTHREADS || HAVE_W32THREADS || HAVE_OS2THREADS
|
||||
static int default_lockmgr_cb(void **arg, enum AVLockOp op)
|
||||
{
|
||||
|
||||
@@ -212,6 +212,8 @@ static void restore_median(uint8_t *src, int step, int stride,
|
||||
slice_height = ((((slice + 1) * height) / slices) & cmask) -
|
||||
slice_start;
|
||||
|
||||
if (!slice_height)
|
||||
continue;
|
||||
bsrc = src + slice_start * stride;
|
||||
|
||||
// first line - left neighbour prediction
|
||||
@@ -267,6 +269,8 @@ static void restore_median_il(uint8_t *src, int step, int stride,
|
||||
slice_height = ((((slice + 1) * height) / slices) & cmask) -
|
||||
slice_start;
|
||||
slice_height >>= 1;
|
||||
if (!slice_height)
|
||||
continue;
|
||||
|
||||
bsrc = src + slice_start * stride;
|
||||
|
||||
|
||||
@@ -352,6 +352,9 @@ static int vmd_decode(VmdVideoContext *s, AVFrame *frame)
|
||||
ofs += slen;
|
||||
bytestream2_skip(&gb, len);
|
||||
} else {
|
||||
if (ofs + len > frame_width ||
|
||||
bytestream2_get_bytes_left(&gb) < len)
|
||||
return AVERROR_INVALIDDATA;
|
||||
bytestream2_get_buffer(&gb, &dp[ofs], len);
|
||||
ofs += len;
|
||||
}
|
||||
|
||||
@@ -77,6 +77,8 @@ static int parse(AVCodecParserContext *ctx,
|
||||
idx += a; \
|
||||
if (sz > size) { \
|
||||
s->n_frames = 0; \
|
||||
*out_size = 0; \
|
||||
*out_data = data; \
|
||||
av_log(avctx, AV_LOG_ERROR, \
|
||||
"Superframe packet size too big: %u > %d\n", \
|
||||
sz, size); \
|
||||
|
||||
@@ -20,6 +20,9 @@
|
||||
#include "avdevice.h"
|
||||
#include "config.h"
|
||||
|
||||
#include "libavutil/ffversion.h"
|
||||
const char av_device_ffversion[] = "FFmpeg version " FFMPEG_VERSION;
|
||||
|
||||
unsigned avdevice_version(void)
|
||||
{
|
||||
av_assert0(LIBAVDEVICE_VERSION_MICRO >= 100);
|
||||
@@ -48,9 +51,9 @@ int avdevice_app_to_dev_control_message(struct AVFormatContext *s, enum AVAppToD
|
||||
int avdevice_dev_to_app_control_message(struct AVFormatContext *s, enum AVDevToAppMessageType type,
|
||||
void *data, size_t data_size)
|
||||
{
|
||||
if (!s->control_message_cb)
|
||||
if (!av_format_get_control_message_cb(s))
|
||||
return AVERROR(ENOSYS);
|
||||
return s->control_message_cb(s, type, data, data_size);
|
||||
return av_format_get_control_message_cb(s)(s, type, data, data_size);
|
||||
}
|
||||
|
||||
int avdevice_list_devices(AVFormatContext *s, AVDeviceInfoList **device_list)
|
||||
|
||||
@@ -496,6 +496,8 @@ static av_cold int init(AVFilterContext *ctx)
|
||||
snprintf(name, sizeof(name), "input%d", i);
|
||||
pad.type = AVMEDIA_TYPE_AUDIO;
|
||||
pad.name = av_strdup(name);
|
||||
if (!pad.name)
|
||||
return AVERROR(ENOMEM);
|
||||
pad.filter_frame = filter_frame;
|
||||
|
||||
ff_insert_inpad(ctx, i, &pad);
|
||||
|
||||
@@ -214,6 +214,8 @@ static av_cold int join_init(AVFilterContext *ctx)
|
||||
snprintf(name, sizeof(name), "input%d", i);
|
||||
pad.type = AVMEDIA_TYPE_AUDIO;
|
||||
pad.name = av_strdup(name);
|
||||
if (!pad.name)
|
||||
return AVERROR(ENOMEM);
|
||||
pad.filter_frame = filter_frame;
|
||||
|
||||
pad.needs_fifo = 1;
|
||||
|
||||
@@ -37,6 +37,9 @@
|
||||
#include "formats.h"
|
||||
#include "internal.h"
|
||||
|
||||
#include "libavutil/ffversion.h"
|
||||
const char av_filter_ffversion[] = "FFmpeg version " FFMPEG_VERSION;
|
||||
|
||||
static int ff_filter_frame_framed(AVFilterLink *link, AVFrame *frame);
|
||||
|
||||
void ff_tlog_ref(void *ctx, AVFrame *ref, int end)
|
||||
|
||||
@@ -52,6 +52,8 @@ static av_cold int split_init(AVFilterContext *ctx)
|
||||
snprintf(name, sizeof(name), "output%d", i);
|
||||
pad.type = ctx->filter->inputs[0].type;
|
||||
pad.name = av_strdup(name);
|
||||
if (!pad.name)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
ff_insert_outpad(ctx, i, &pad);
|
||||
}
|
||||
|
||||
@@ -292,6 +292,8 @@ static av_cold int movie_common_init(AVFilterContext *ctx)
|
||||
snprintf(name, sizeof(name), "out%d", i);
|
||||
pad.type = movie->st[i].st->codec->codec_type;
|
||||
pad.name = av_strdup(name);
|
||||
if (!pad.name)
|
||||
return AVERROR(ENOMEM);
|
||||
pad.config_props = movie_config_output_props;
|
||||
pad.request_frame = movie_request_frame;
|
||||
ff_insert_outpad(ctx, i, &pad);
|
||||
|
||||
@@ -82,6 +82,7 @@ static int config_output(AVFilterLink *outlink)
|
||||
int width = ctx->inputs[LEFT]->w;
|
||||
int height = ctx->inputs[LEFT]->h;
|
||||
AVRational time_base = ctx->inputs[LEFT]->time_base;
|
||||
AVRational frame_rate = ctx->inputs[LEFT]->frame_rate;
|
||||
|
||||
// check size and fps match on the other input
|
||||
if (width != ctx->inputs[RIGHT]->w ||
|
||||
@@ -93,11 +94,18 @@ static int config_output(AVFilterLink *outlink)
|
||||
return AVERROR_INVALIDDATA;
|
||||
} else if (av_cmp_q(time_base, ctx->inputs[RIGHT]->time_base) != 0) {
|
||||
av_log(ctx, AV_LOG_ERROR,
|
||||
"Left and right framerates differ (%d/%d vs %d/%d).\n",
|
||||
"Left and right time bases differ (%d/%d vs %d/%d).\n",
|
||||
time_base.num, time_base.den,
|
||||
ctx->inputs[RIGHT]->time_base.num,
|
||||
ctx->inputs[RIGHT]->time_base.den);
|
||||
return AVERROR_INVALIDDATA;
|
||||
} else if (av_cmp_q(frame_rate, ctx->inputs[RIGHT]->frame_rate) != 0) {
|
||||
av_log(ctx, AV_LOG_ERROR,
|
||||
"Left and right framerates differ (%d/%d vs %d/%d).\n",
|
||||
frame_rate.num, frame_rate.den,
|
||||
ctx->inputs[RIGHT]->frame_rate.num,
|
||||
ctx->inputs[RIGHT]->frame_rate.den);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
s->pix_desc = av_pix_fmt_desc_get(outlink->format);
|
||||
@@ -108,6 +116,8 @@ static int config_output(AVFilterLink *outlink)
|
||||
switch (s->format) {
|
||||
case AV_STEREO3D_FRAMESEQUENCE:
|
||||
time_base.den *= 2;
|
||||
frame_rate.num *= 2;
|
||||
|
||||
s->double_pts = AV_NOPTS_VALUE;
|
||||
break;
|
||||
case AV_STEREO3D_COLUMNS:
|
||||
@@ -126,6 +136,7 @@ static int config_output(AVFilterLink *outlink)
|
||||
outlink->w = width;
|
||||
outlink->h = height;
|
||||
outlink->time_base = time_base;
|
||||
outlink->frame_rate= frame_rate;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
+16
-6
@@ -220,6 +220,19 @@ static int config_props(AVFilterLink *inlink)
|
||||
|
||||
#define NB_PLANES 4
|
||||
|
||||
static inline int mirror(int x, int w)
|
||||
{
|
||||
if (!w)
|
||||
return 0;
|
||||
|
||||
while ((unsigned)x > (unsigned)w) {
|
||||
x = -x;
|
||||
if (x < 0)
|
||||
x += 2 * w;
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
static void blur(uint8_t *dst, const int dst_linesize,
|
||||
const uint8_t *src, const int src_linesize,
|
||||
const int w, const int h, FilterParam *fp)
|
||||
@@ -253,8 +266,7 @@ static void blur(uint8_t *dst, const int dst_linesize,
|
||||
for (dy = 0; dy < radius*2 + 1; dy++) {
|
||||
int dx;
|
||||
int iy = y+dy - radius;
|
||||
if (iy < 0) iy = -iy;
|
||||
else if (iy >= h) iy = h+h-iy-1;
|
||||
iy = mirror(iy, h-1);
|
||||
|
||||
for (dx = 0; dx < radius*2 + 1; dx++) {
|
||||
const int ix = x+dx - radius;
|
||||
@@ -265,13 +277,11 @@ static void blur(uint8_t *dst, const int dst_linesize,
|
||||
for (dy = 0; dy < radius*2+1; dy++) {
|
||||
int dx;
|
||||
int iy = y+dy - radius;
|
||||
if (iy < 0) iy = -iy;
|
||||
else if (iy >= h) iy = h+h-iy-1;
|
||||
iy = mirror(iy, h-1);
|
||||
|
||||
for (dx = 0; dx < radius*2 + 1; dx++) {
|
||||
int ix = x+dx - radius;
|
||||
if (ix < 0) ix = -ix;
|
||||
else if (ix >= w) ix = w+w-ix-1;
|
||||
ix = mirror(ix, w-1);
|
||||
UPDATE_FACTOR;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -219,6 +219,9 @@ int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
|
||||
return offset1;
|
||||
offset += offset1;
|
||||
}
|
||||
if (offset < 0)
|
||||
return AVERROR(EINVAL);
|
||||
|
||||
offset1 = offset - pos;
|
||||
if (!s->must_flush && (!s->direct || !s->seek) &&
|
||||
offset1 >= 0 && offset1 <= buffer_size) {
|
||||
|
||||
@@ -127,6 +127,8 @@ static int cdxl_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
height = AV_RB16(&cdxl->header[16]);
|
||||
palette_size = AV_RB16(&cdxl->header[20]);
|
||||
audio_size = AV_RB16(&cdxl->header[22]);
|
||||
if (FFALIGN(width, 16) * (uint64_t)height * cdxl->header[19] > INT_MAX)
|
||||
return AVERROR_INVALIDDATA;
|
||||
image_size = FFALIGN(width, 16) * height * cdxl->header[19] / 8;
|
||||
video_size = palette_size + image_size;
|
||||
|
||||
|
||||
@@ -376,7 +376,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream,
|
||||
FLVContext *flv = s->priv_data;
|
||||
AVIOContext *ioc;
|
||||
AMFDataType amf_type;
|
||||
char str_val[256];
|
||||
char str_val[1024];
|
||||
double num_val;
|
||||
|
||||
num_val = 0;
|
||||
@@ -541,13 +541,13 @@ static int flv_read_metabody(AVFormatContext *s, int64_t next_pos)
|
||||
type = avio_r8(ioc);
|
||||
if (type != AMF_DATA_TYPE_STRING ||
|
||||
amf_get_string(ioc, buffer, sizeof(buffer)) < 0)
|
||||
return -1;
|
||||
return 2;
|
||||
|
||||
if (!strcmp(buffer, "onTextData"))
|
||||
return 1;
|
||||
|
||||
if (strcmp(buffer, "onMetaData"))
|
||||
return -1;
|
||||
return 2;
|
||||
|
||||
// find the streams now so that amf_parse_object doesn't need to do
|
||||
// the lookup every time it is called.
|
||||
@@ -614,7 +614,7 @@ static int flv_read_close(AVFormatContext *s)
|
||||
|
||||
static int flv_get_extradata(AVFormatContext *s, AVStream *st, int size)
|
||||
{
|
||||
av_free(st->codec->extradata);
|
||||
av_freep(&st->codec->extradata);
|
||||
if (ff_get_extradata(st->codec, s->pb, size) < 0)
|
||||
return AVERROR(ENOMEM);
|
||||
return 0;
|
||||
@@ -813,7 +813,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
stream_type=FLV_STREAM_TYPE_DATA;
|
||||
if (size > 13 + 1 + 4 && dts == 0) { // Header-type metadata stuff
|
||||
meta_pos = avio_tell(s->pb);
|
||||
if (flv_read_metabody(s, next) == 0) {
|
||||
if (flv_read_metabody(s, next) <= 0) {
|
||||
goto skip;
|
||||
}
|
||||
avio_seek(s->pb, meta_pos, SEEK_SET);
|
||||
|
||||
@@ -145,15 +145,15 @@ static void hds_free(AVFormatContext *s)
|
||||
if (os->ctx && os->ctx_inited)
|
||||
av_write_trailer(os->ctx);
|
||||
if (os->ctx && os->ctx->pb)
|
||||
av_free(os->ctx->pb);
|
||||
av_freep(&os->ctx->pb);
|
||||
if (os->ctx)
|
||||
avformat_free_context(os->ctx);
|
||||
av_free(os->metadata);
|
||||
av_freep(&os->metadata);
|
||||
for (j = 0; j < os->nb_extra_packets; j++)
|
||||
av_free(os->extra_packets[j]);
|
||||
av_freep(&os->extra_packets[j]);
|
||||
for (j = 0; j < os->nb_fragments; j++)
|
||||
av_free(os->fragments[j]);
|
||||
av_free(os->fragments);
|
||||
av_freep(&os->fragments[j]);
|
||||
av_freep(&os->fragments);
|
||||
}
|
||||
av_freep(&c->streams);
|
||||
}
|
||||
@@ -509,7 +509,7 @@ static int hds_flush(AVFormatContext *s, OutputStream *os, int final,
|
||||
if (remove > 0) {
|
||||
for (i = 0; i < remove; i++) {
|
||||
unlink(os->fragments[i]->file);
|
||||
av_free(os->fragments[i]);
|
||||
av_freep(&os->fragments[i]);
|
||||
}
|
||||
os->nb_fragments -= remove;
|
||||
memmove(os->fragments, os->fragments + remove,
|
||||
|
||||
@@ -167,6 +167,7 @@ typedef struct MOVContext {
|
||||
int64_t next_root_atom; ///< offset of the next root atom
|
||||
int *bitrates; ///< bitrates read before streams creation
|
||||
int bitrates_count;
|
||||
int atom_depth;
|
||||
} MOVContext;
|
||||
|
||||
int ff_mp4_read_descr_len(AVIOContext *pb);
|
||||
|
||||
@@ -1051,7 +1051,7 @@ static void ebml_free(EbmlSyntax *syntax, void *data)
|
||||
char *ptr = list->elem;
|
||||
for (j=0; j<list->nb_elem; j++, ptr+=syntax[i].list_elem_size)
|
||||
ebml_free(syntax[i].def.n, ptr);
|
||||
av_free(list->elem);
|
||||
av_freep(&list->elem);
|
||||
} else
|
||||
ebml_free(syntax[i].def.n, data_off);
|
||||
default: break;
|
||||
@@ -2033,7 +2033,7 @@ static int matroska_deliver_packet(MatroskaDemuxContext *matroska,
|
||||
{
|
||||
if (matroska->num_packets > 0) {
|
||||
memcpy(pkt, matroska->packets[0], sizeof(AVPacket));
|
||||
av_free(matroska->packets[0]);
|
||||
av_freep(&matroska->packets[0]);
|
||||
if (matroska->num_packets > 1) {
|
||||
void *newpackets;
|
||||
memmove(&matroska->packets[0], &matroska->packets[1],
|
||||
@@ -2063,7 +2063,7 @@ static void matroska_clear_queue(MatroskaDemuxContext *matroska)
|
||||
int n;
|
||||
for (n = 0; n < matroska->num_packets; n++) {
|
||||
av_free_packet(matroska->packets[n]);
|
||||
av_free(matroska->packets[n]);
|
||||
av_freep(&matroska->packets[n]);
|
||||
}
|
||||
av_freep(&matroska->packets);
|
||||
matroska->num_packets = 0;
|
||||
@@ -2903,7 +2903,7 @@ static int matroska_read_close(AVFormatContext *s)
|
||||
|
||||
for (n=0; n < matroska->tracks.nb_elem; n++)
|
||||
if (tracks[n].type == MATROSKA_TRACK_TYPE_AUDIO)
|
||||
av_free(tracks[n].audio.buf);
|
||||
av_freep(&tracks[n].audio.buf);
|
||||
ebml_free(matroska_cluster, &matroska->current_cluster);
|
||||
ebml_free(matroska_segment, matroska);
|
||||
|
||||
|
||||
+57
-26
@@ -279,7 +279,11 @@ static int mov_read_covr(MOVContext *c, AVIOContext *pb, int type, int len)
|
||||
static int mov_metadata_raw(MOVContext *c, AVIOContext *pb,
|
||||
unsigned len, const char *key)
|
||||
{
|
||||
char *value = av_malloc(len + 1);
|
||||
char *value;
|
||||
// Check for overflow.
|
||||
if (len >= INT_MAX)
|
||||
return AVERROR(EINVAL);
|
||||
value = av_malloc(len + 1);
|
||||
if (!value)
|
||||
return AVERROR(ENOMEM);
|
||||
avio_read(pb, value, len);
|
||||
@@ -383,7 +387,7 @@ static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
|
||||
if (!key)
|
||||
return 0;
|
||||
if (atom.size < 0)
|
||||
if (atom.size < 0 || str_size >= INT_MAX/2)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
str_size = FFMIN3(sizeof(str)-1, str_size, atom.size);
|
||||
@@ -1200,10 +1204,12 @@ static int mov_read_stco(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
|
||||
if (!entries)
|
||||
return 0;
|
||||
if (entries >= UINT_MAX/sizeof(int64_t))
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
sc->chunk_offsets = av_malloc(entries * sizeof(int64_t));
|
||||
if (sc->chunk_offsets)
|
||||
av_log(c->fc, AV_LOG_WARNING, "Duplicate STCO atom\n");
|
||||
av_free(sc->chunk_offsets);
|
||||
sc->chunk_count = 0;
|
||||
sc->chunk_offsets = av_malloc_array(entries, sizeof(*sc->chunk_offsets));
|
||||
if (!sc->chunk_offsets)
|
||||
return AVERROR(ENOMEM);
|
||||
sc->chunk_count = entries;
|
||||
@@ -1474,7 +1480,7 @@ static void mov_parse_stsd_audio(MOVContext *c, AVIOContext *pb,
|
||||
|
||||
static void mov_parse_stsd_subtitle(MOVContext *c, AVIOContext *pb,
|
||||
AVStream *st, MOVStreamContext *sc,
|
||||
int size)
|
||||
int64_t size)
|
||||
{
|
||||
// ttxt stsd contains display flags, justification, background
|
||||
// color, fonts, and default styles, so fake an atom to read it
|
||||
@@ -1488,10 +1494,10 @@ static void mov_parse_stsd_subtitle(MOVContext *c, AVIOContext *pb,
|
||||
|
||||
static int mov_parse_stsd_data(MOVContext *c, AVIOContext *pb,
|
||||
AVStream *st, MOVStreamContext *sc,
|
||||
int size)
|
||||
int64_t size)
|
||||
{
|
||||
if (st->codec->codec_tag == MKTAG('t','m','c','d')) {
|
||||
if (ff_get_extradata(st->codec, pb, size) < 0)
|
||||
if ((int)size != size || ff_get_extradata(st->codec, pb, size) < 0)
|
||||
return AVERROR(ENOMEM);
|
||||
if (size > 16) {
|
||||
MOVStreamContext *tmcd_ctx = st->priv_data;
|
||||
@@ -1716,9 +1722,11 @@ static int mov_read_stsc(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
|
||||
if (!entries)
|
||||
return 0;
|
||||
if (entries >= UINT_MAX / sizeof(*sc->stsc_data))
|
||||
return AVERROR_INVALIDDATA;
|
||||
sc->stsc_data = av_malloc(entries * sizeof(*sc->stsc_data));
|
||||
if (sc->stsc_data)
|
||||
av_log(c->fc, AV_LOG_WARNING, "Duplicate STSC atom\n");
|
||||
av_free(sc->stsc_data);
|
||||
sc->stsc_count = 0;
|
||||
sc->stsc_data = av_malloc_array(entries, sizeof(*sc->stsc_data));
|
||||
if (!sc->stsc_data)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
@@ -1750,9 +1758,11 @@ static int mov_read_stps(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
avio_rb32(pb); // version + flags
|
||||
|
||||
entries = avio_rb32(pb);
|
||||
if (entries >= UINT_MAX / sizeof(*sc->stps_data))
|
||||
return AVERROR_INVALIDDATA;
|
||||
sc->stps_data = av_malloc(entries * sizeof(*sc->stps_data));
|
||||
if (sc->stps_data)
|
||||
av_log(c->fc, AV_LOG_WARNING, "Duplicate STPS atom\n");
|
||||
av_free(sc->stps_data);
|
||||
sc->stps_count = 0;
|
||||
sc->stps_data = av_malloc_array(entries, sizeof(*sc->stps_data));
|
||||
if (!sc->stps_data)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
@@ -1794,9 +1804,13 @@ static int mov_read_stss(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
st->need_parsing = AVSTREAM_PARSE_HEADERS;
|
||||
return 0;
|
||||
}
|
||||
if (sc->keyframes)
|
||||
av_log(c->fc, AV_LOG_WARNING, "Duplicated STSS atom\n");
|
||||
if (entries >= UINT_MAX / sizeof(int))
|
||||
return AVERROR_INVALIDDATA;
|
||||
sc->keyframes = av_malloc(entries * sizeof(int));
|
||||
av_freep(&sc->keyframes);
|
||||
sc->keyframe_count = 0;
|
||||
sc->keyframes = av_malloc_array(entries, sizeof(*sc->keyframes));
|
||||
if (!sc->keyframes)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
@@ -1855,9 +1869,13 @@ static int mov_read_stsz(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
|
||||
if (!entries)
|
||||
return 0;
|
||||
if (entries >= UINT_MAX / sizeof(int) || entries >= (UINT_MAX - 4) / field_size)
|
||||
if (entries >= (UINT_MAX - 4) / field_size)
|
||||
return AVERROR_INVALIDDATA;
|
||||
sc->sample_sizes = av_malloc(entries * sizeof(int));
|
||||
if (sc->sample_sizes)
|
||||
av_log(c->fc, AV_LOG_WARNING, "Duplicate STSZ atom\n");
|
||||
av_free(sc->sample_sizes);
|
||||
sc->sample_count = 0;
|
||||
sc->sample_sizes = av_malloc_array(entries, sizeof(*sc->sample_sizes));
|
||||
if (!sc->sample_sizes)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
@@ -1911,11 +1929,11 @@ static int mov_read_stts(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
av_dlog(c->fc, "track[%i].stts.entries = %i\n",
|
||||
c->fc->nb_streams-1, entries);
|
||||
|
||||
if (entries >= UINT_MAX / sizeof(*sc->stts_data))
|
||||
return -1;
|
||||
|
||||
if (sc->stts_data)
|
||||
av_log(c->fc, AV_LOG_WARNING, "Duplicate STTS atom\n");
|
||||
av_free(sc->stts_data);
|
||||
sc->stts_data = av_malloc(entries * sizeof(*sc->stts_data));
|
||||
sc->stts_count = 0;
|
||||
sc->stts_data = av_malloc_array(entries, sizeof(*sc->stts_data));
|
||||
if (!sc->stts_data)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
@@ -2054,9 +2072,11 @@ static int mov_read_sbgp(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
entries = avio_rb32(pb);
|
||||
if (!entries)
|
||||
return 0;
|
||||
if (entries >= UINT_MAX / sizeof(*sc->rap_group))
|
||||
return AVERROR_INVALIDDATA;
|
||||
sc->rap_group = av_malloc(entries * sizeof(*sc->rap_group));
|
||||
if (sc->rap_group)
|
||||
av_log(c->fc, AV_LOG_WARNING, "Duplicate SBGP atom\n");
|
||||
av_free(sc->rap_group);
|
||||
sc->rap_group_count = 0;
|
||||
sc->rap_group = av_malloc_array(entries, sizeof(*sc->rap_group));
|
||||
if (!sc->rap_group)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
@@ -3006,6 +3026,12 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
MOVAtom a;
|
||||
int i;
|
||||
|
||||
if (c->atom_depth > 10) {
|
||||
av_log(c->fc, AV_LOG_ERROR, "Atoms too deeply nested\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
c->atom_depth ++;
|
||||
|
||||
if (atom.size < 0)
|
||||
atom.size = INT64_MAX;
|
||||
while (total_size + 8 <= atom.size && !url_feof(pb)) {
|
||||
@@ -3022,11 +3048,12 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
{
|
||||
av_log(c->fc, AV_LOG_ERROR, "Broken file, trak/mdat not at top-level\n");
|
||||
avio_skip(pb, -8);
|
||||
c->atom_depth --;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
total_size += 8;
|
||||
if (a.size == 1) { /* 64 bit extended size */
|
||||
if (a.size == 1 && total_size + 8 <= atom.size) { /* 64 bit extended size */
|
||||
a.size = avio_rb64(pb) - 8;
|
||||
total_size += 8;
|
||||
}
|
||||
@@ -3058,13 +3085,16 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
int64_t start_pos = avio_tell(pb);
|
||||
int64_t left;
|
||||
int err = parse(c, pb, a);
|
||||
if (err < 0)
|
||||
if (err < 0) {
|
||||
c->atom_depth --;
|
||||
return err;
|
||||
}
|
||||
if (c->found_moov && c->found_mdat &&
|
||||
((!pb->seekable || c->fc->flags & AVFMT_FLAG_IGNIDX) ||
|
||||
start_pos + a.size == avio_size(pb))) {
|
||||
if (!pb->seekable || c->fc->flags & AVFMT_FLAG_IGNIDX)
|
||||
c->next_root_atom = start_pos + a.size;
|
||||
c->atom_depth --;
|
||||
return 0;
|
||||
}
|
||||
left = a.size - avio_tell(pb) + start_pos;
|
||||
@@ -3084,6 +3114,7 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
if (total_size < atom.size && atom.size < 0x7ffff)
|
||||
avio_skip(pb, atom.size - total_size);
|
||||
|
||||
c->atom_depth --;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -2033,7 +2033,8 @@ static int mov_write_mvhd_tag(AVIOContext *pb, MOVMuxContext *mov)
|
||||
}
|
||||
|
||||
version = max_track_len < UINT32_MAX ? 0 : 1;
|
||||
(version == 1) ? avio_wb32(pb, 120) : avio_wb32(pb, 108); /* size */
|
||||
avio_wb32(pb, version == 1 ? 120 : 108); /* size */
|
||||
|
||||
ffio_wfourcc(pb, "mvhd");
|
||||
avio_w8(pb, version);
|
||||
avio_wb24(pb, 0); /* flags */
|
||||
|
||||
+5
-1
@@ -397,7 +397,11 @@ ff_rm_read_mdpr_codecdata (AVFormatContext *s, AVIOContext *pb,
|
||||
skip:
|
||||
/* skip codec info */
|
||||
size = avio_tell(pb) - codec_pos;
|
||||
avio_skip(pb, codec_data_size - size);
|
||||
if (codec_data_size >= size) {
|
||||
avio_skip(pb, codec_data_size - size);
|
||||
} else {
|
||||
av_log(s, AV_LOG_WARNING, "codec_data_size %u < size %d\n", codec_data_size, size);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
+1
-1
@@ -70,7 +70,7 @@ static int rsd_read_header(AVFormatContext *s)
|
||||
codec->codec_tag = avio_rl32(pb);
|
||||
codec->codec_id = ff_codec_get_id(rsd_tags, codec->codec_tag);
|
||||
if (!codec->codec_id) {
|
||||
char tag_buf[5];
|
||||
char tag_buf[32];
|
||||
|
||||
av_get_codec_tag_string(tag_buf, sizeof(tag_buf), codec->codec_tag);
|
||||
for (i=0; i < FF_ARRAY_ELEMS(rsd_unsupported_tags); i++) {
|
||||
|
||||
@@ -321,7 +321,7 @@ static int segment_end(AVFormatContext *s, int write_trailer, int is_last)
|
||||
if (seg->list_size && seg->segment_count > seg->list_size) {
|
||||
entry = seg->segment_list_entries;
|
||||
seg->segment_list_entries = seg->segment_list_entries->next;
|
||||
av_free(entry->filename);
|
||||
av_freep(&entry->filename);
|
||||
av_freep(&entry);
|
||||
}
|
||||
|
||||
@@ -479,10 +479,10 @@ static int open_null_ctx(AVIOContext **ctx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void close_null_ctx(AVIOContext *pb)
|
||||
static void close_null_ctxp(AVIOContext **pb)
|
||||
{
|
||||
av_free(pb->buffer);
|
||||
av_free(pb);
|
||||
av_freep(&(*pb)->buffer);
|
||||
av_freep(pb);
|
||||
}
|
||||
|
||||
static int select_reference_stream(AVFormatContext *s)
|
||||
@@ -638,7 +638,7 @@ static int seg_write_header(AVFormatContext *s)
|
||||
s->avoid_negative_ts = 1;
|
||||
|
||||
if (!seg->write_header_trailer) {
|
||||
close_null_ctx(oc->pb);
|
||||
close_null_ctxp(&oc->pb);
|
||||
if ((ret = avio_open2(&oc->pb, oc->filename, AVIO_FLAG_WRITE,
|
||||
&s->interrupt_callback, NULL)) < 0)
|
||||
goto fail;
|
||||
@@ -743,7 +743,7 @@ static int seg_write_trailer(struct AVFormatContext *s)
|
||||
goto fail;
|
||||
open_null_ctx(&oc->pb);
|
||||
ret = av_write_trailer(oc);
|
||||
close_null_ctx(oc->pb);
|
||||
close_null_ctxp(&oc->pb);
|
||||
} else {
|
||||
ret = segment_end(s, 1, 1);
|
||||
}
|
||||
@@ -758,7 +758,7 @@ fail:
|
||||
cur = seg->segment_list_entries;
|
||||
while (cur) {
|
||||
next = cur->next;
|
||||
av_free(cur->filename);
|
||||
av_freep(&cur->filename);
|
||||
av_free(cur);
|
||||
cur = next;
|
||||
}
|
||||
|
||||
@@ -53,6 +53,9 @@
|
||||
#include "riff.h"
|
||||
#include "url.h"
|
||||
|
||||
#include "libavutil/ffversion.h"
|
||||
const char av_format_ffversion[] = "FFmpeg version " FFMPEG_VERSION;
|
||||
|
||||
/**
|
||||
* @file
|
||||
* various utility functions for use within FFmpeg
|
||||
@@ -706,6 +709,8 @@ static int update_wrap_reference(AVFormatContext *s, AVStream *st, int stream_in
|
||||
int default_stream_index = av_find_default_stream_index(s);
|
||||
if (s->streams[default_stream_index]->pts_wrap_reference == AV_NOPTS_VALUE) {
|
||||
for (i = 0; i < s->nb_streams; i++) {
|
||||
if (av_find_program_from_stream(s, NULL, i))
|
||||
continue;
|
||||
s->streams[i]->pts_wrap_reference = pts_wrap_reference;
|
||||
s->streams[i]->pts_wrap_behavior = pts_wrap_behavior;
|
||||
}
|
||||
@@ -2865,6 +2870,7 @@ int ff_alloc_extradata(AVCodecContext *avctx, int size)
|
||||
int ret;
|
||||
|
||||
if (size < 0 || size >= INT32_MAX - FF_INPUT_BUFFER_PADDING_SIZE) {
|
||||
avctx->extradata = NULL;
|
||||
avctx->extradata_size = 0;
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
@@ -487,6 +487,7 @@ int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
|
||||
av_dict_free(&dst->side_data[i]->metadata);
|
||||
}
|
||||
av_freep(&dst->side_data);
|
||||
dst->nb_side_data = 0;
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
memcpy(sd_dst->data, sd_src->data, sd_src->size);
|
||||
|
||||
@@ -27,6 +27,9 @@
|
||||
* various utility functions
|
||||
*/
|
||||
|
||||
#include "libavutil/ffversion.h"
|
||||
const char av_util_ffversion[] = "FFmpeg version " FFMPEG_VERSION;
|
||||
|
||||
unsigned avutil_version(void)
|
||||
{
|
||||
static int checks_done;
|
||||
|
||||
@@ -89,6 +89,9 @@ try to unroll inner for(x=0 ... loop to avoid these damn if(x ... checks
|
||||
#include "postprocess_internal.h"
|
||||
#include "libavutil/avstring.h"
|
||||
|
||||
#include "libavutil/ffversion.h"
|
||||
const char postproc_ffversion[] = "FFmpeg version " FFMPEG_VERSION;
|
||||
|
||||
unsigned postproc_version(void)
|
||||
{
|
||||
av_assert0(LIBPOSTPROC_VERSION_MICRO >= 100);
|
||||
|
||||
@@ -76,8 +76,12 @@ static int process(
|
||||
AudioData *src, int src_size, int *consumed){
|
||||
size_t idone, odone;
|
||||
soxr_error_t error = soxr_set_error((soxr_t)c, soxr_set_num_channels((soxr_t)c, src->ch_count));
|
||||
error = soxr_process((soxr_t)c, src->ch, (size_t)src_size,
|
||||
&idone, dst->ch, (size_t)dst_size, &odone);
|
||||
if (!error)
|
||||
error = soxr_process((soxr_t)c, src->ch, (size_t)src_size,
|
||||
&idone, dst->ch, (size_t)dst_size, &odone);
|
||||
else
|
||||
idone = 0;
|
||||
|
||||
*consumed = (int)idone;
|
||||
return error? -1 : odone;
|
||||
}
|
||||
|
||||
@@ -146,6 +146,10 @@ static const AVClass av_class = {
|
||||
.category = AV_CLASS_CATEGORY_SWRESAMPLER,
|
||||
};
|
||||
|
||||
|
||||
#include "libavutil/ffversion.h"
|
||||
const char swr_ffversion[] = "FFmpeg version " FFMPEG_VERSION;
|
||||
|
||||
unsigned swresample_version(void)
|
||||
{
|
||||
av_assert0(LIBSWRESAMPLE_VERSION_MICRO >= 100);
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
#define STR(s) AV_TOSTRING(s) // AV_STRINGIFY is too long
|
||||
|
||||
#define YUVRGB_TABLE_HEADROOM 128
|
||||
#define YUVRGB_TABLE_HEADROOM 256
|
||||
|
||||
#define MAX_FILTER_SIZE 256
|
||||
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
#tb 0: 1/25
|
||||
#tb 0: 1/50
|
||||
0, 0, 0, 1, 152064, 0x05b789ef
|
||||
0, 1, 1, 1, 152064, 0x05b789ef
|
||||
0, 2, 2, 1, 152064, 0x4bb46551
|
||||
0, 3, 3, 1, 152064, 0x9dddf64a
|
||||
0, 4, 4, 1, 152064, 0x2a8380b0
|
||||
0, 5, 5, 1, 152064, 0x4de3b652
|
||||
0, 6, 6, 1, 152064, 0xedb5a8e6
|
||||
0, 7, 7, 1, 152064, 0xe20f7c23
|
||||
0, 8, 8, 1, 152064, 0x5ab58bac
|
||||
0, 9, 9, 1, 152064, 0x1f1b8026
|
||||
0, 10, 10, 1, 152064, 0x91373915
|
||||
0, 11, 11, 1, 152064, 0x02344760
|
||||
0, 12, 12, 1, 152064, 0x30f5fcd5
|
||||
0, 13, 13, 1, 152064, 0xc711ad61
|
||||
0, 14, 14, 1, 152064, 0x24eca223
|
||||
0, 3, 3, 1, 152064, 0x4bb46551
|
||||
0, 4, 4, 1, 152064, 0x9dddf64a
|
||||
0, 5, 5, 1, 152064, 0x9dddf64a
|
||||
0, 6, 6, 1, 152064, 0x2a8380b0
|
||||
0, 7, 7, 1, 152064, 0x2a8380b0
|
||||
0, 8, 8, 1, 152064, 0x4de3b652
|
||||
0, 9, 9, 1, 152064, 0x4de3b652
|
||||
0, 10, 10, 1, 152064, 0xedb5a8e6
|
||||
0, 11, 11, 1, 152064, 0xedb5a8e6
|
||||
0, 12, 12, 1, 152064, 0xe20f7c23
|
||||
0, 13, 13, 1, 152064, 0xe20f7c23
|
||||
0, 14, 14, 1, 152064, 0x5ab58bac
|
||||
|
||||
Reference in New Issue
Block a user