Commit 8672fc7b authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit 'b146d747'

* commit 'b146d747':
  indeo4: update AVCodecContext width/height on size change
  dfa: check that the caller set width/height properly.
  indeo5dec: Make sure we have had a valid gop header.
  cavsdec: check for changing w/h.
  lavc: set channel count from channel layout in avcodec_open2().
  doc/platform: Rework the Visual Studio linking section
  doc/faq: Change the Visual Studio entry to reflect current status
  doc/platform: Replace Visual Studio section with build instructions
  doc/platform: Nuke section on linking static MinGW-built libs with MSVC
  doc/platform: Remove false claim about MinGW installer
  doc/platform: Mention MinGW-w64
  dsputil_mmx: fix reading prior of the src array in sub_hfyu_median_prediction()
  mpegaudiodec: fix short_start calculation

Conflicts:
	doc/faq.texi
	doc/platform.texi
	libavcodec/cavsdec.c
	libavcodec/indeo5.c
	libavcodec/ivi_common.h
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 74bd0cf4 b146d747
......@@ -1073,11 +1073,12 @@ static int decode_seq_header(AVSContext *h) {
h->profile = get_bits(&s->gb,8);
h->level = get_bits(&s->gb,8);
skip_bits1(&s->gb); //progressive sequence
width = get_bits(&s->gb,14);
height = get_bits(&s->gb,14);
width = get_bits(&s->gb, 14);
height = get_bits(&s->gb, 14);
if ((s->width || s->height) && (s->width != width || s->height != height)) {
av_log_missing_feature(s, "Width/height changing in CAVS is", 0);
return -1;
return AVERROR_PATCHWELCOME;
}
if (width <= 0 || height <= 0) {
av_log(s, AV_LOG_ERROR, "Dimensions invalid\n");
......@@ -1085,6 +1086,7 @@ static int decode_seq_header(AVSContext *h) {
}
s->width = width;
s->height = height;
skip_bits(&s->gb,2); //chroma format
skip_bits(&s->gb,3); //sample_precision
h->aspect_ratio = get_bits(&s->gb,4);
......
......@@ -22,6 +22,8 @@
#include "avcodec.h"
#include "bytestream.h"
#include "libavutil/imgutils.h"
#include "libavutil/lzo.h" // for av_memcpy_backptr
typedef struct DfaContext {
......@@ -34,9 +36,13 @@ typedef struct DfaContext {
static av_cold int dfa_decode_init(AVCodecContext *avctx)
{
DfaContext *s = avctx->priv_data;
int ret;
avctx->pix_fmt = PIX_FMT_PAL8;
if ((ret = av_image_check_size(avctx->width, avctx->height, 0, avctx)) < 0)
return ret;
s->frame_buf = av_mallocz(avctx->width * avctx->height + AV_LZO_OUTPUT_PADDING);
if (!s->frame_buf)
return AVERROR(ENOMEM);
......
......@@ -321,8 +321,10 @@ static int decode_pic_hdr(IVI45DecContext *ctx, AVCodecContext *avctx)
if (ctx->frame_type == FRAMETYPE_INTRA) {
ctx->gop_invalid = 1;
if (decode_gop_header(ctx, avctx))
return -1;
if (decode_gop_header(ctx, avctx)) {
av_log(avctx, AV_LOG_ERROR, "Invalid GOP header, skipping frames.\n");
return AVERROR_INVALIDDATA;
}
ctx->gop_invalid = 0;
}
......
......@@ -755,11 +755,13 @@ int ff_ivi_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
ctx->frame_size = buf_size;
result = ctx->decode_pic_hdr(ctx, avctx);
if (result || ctx->gop_invalid) {
if (result) {
av_log(avctx, AV_LOG_ERROR,
"Error while decoding picture header: %d\n", result);
return -1;
}
if (ctx->gop_invalid)
return AVERROR_INVALIDDATA;
if (ctx->gop_flags & IVI5_IS_PROTECTED) {
av_log(avctx, AV_LOG_ERROR, "Password-protected clip!\n");
......@@ -805,8 +807,8 @@ int ff_ivi_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
if (ctx->frame.data[0])
avctx->release_buffer(avctx, &ctx->frame);
avcodec_set_dimensions(avctx, ctx->planes[0].width, ctx->planes[0].height);
ctx->frame.reference = 0;
avcodec_set_dimensions(avctx, ctx->planes[0].width, ctx->planes[0].height);
if ((result = avctx->get_buffer(avctx, &ctx->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return result;
......
......@@ -1023,12 +1023,17 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code
if (!avctx->bit_rate)
avctx->bit_rate = get_bit_rate(avctx);
/* validate channel layout from the decoder */
if (avctx->channel_layout &&
av_get_channel_layout_nb_channels(avctx->channel_layout) != avctx->channels) {
av_log(avctx, AV_LOG_WARNING, "channel layout does not match number of channels\n");
if (avctx->channel_layout) {
int channels = av_get_channel_layout_nb_channels(avctx->channel_layout);
if (!avctx->channels)
avctx->channels = channels;
else if (channels != avctx->channels) {
av_log(avctx, AV_LOG_WARNING,
"channel layout does not match number of channels\n");
avctx->channel_layout = 0;
}
}
}
end:
entangled_thread_counter--;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment