1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

Merge commit 'b513bf6f69e26e724de6d5dca642c3582dcd0517'

* commit 'b513bf6f69e26e724de6d5dca642c3582dcd0517':
  yuv4mpegdec: do not set coded_frame properties

Conflicts:
	libavformat/yuv4mpegdec.c

See: b45a3e167f
Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2014-05-18 14:02:31 +02:00
commit 213e82b55c

View File

@ -31,7 +31,7 @@ static int yuv4_read_header(AVFormatContext *s)
{
char header[MAX_YUV4_HEADER + 10]; // Include headroom for
// the longest option
char *tokstart, *tokend, *header_end, interlaced = '?';
char *tokstart, *tokend, *header_end;
int i;
AVIOContext *pb = s->pb;
int width = -1, height = -1, raten = 0,
@ -39,6 +39,7 @@ static int yuv4_read_header(AVFormatContext *s)
enum AVPixelFormat pix_fmt = AV_PIX_FMT_NONE, alt_pix_fmt = AV_PIX_FMT_NONE;
enum AVChromaLocation chroma_sample_location = AVCHROMA_LOC_UNSPECIFIED;
AVStream *st;
enum AVFieldOrder field_order;
for (i = 0; i < MAX_YUV4_HEADER; i++) {
header[i] = avio_r8(pb);
@ -134,7 +135,26 @@ static int yuv4_read_header(AVFormatContext *s)
tokstart++;
break;
case 'I': // Interlace type
interlaced = *tokstart++;
switch (*tokstart++){
case '?':
field_order = AV_FIELD_UNKNOWN;
break;
case 'p':
field_order = AV_FIELD_PROGRESSIVE;
break;
case 't':
field_order = AV_FIELD_TT;
break;
case 'b':
field_order = AV_FIELD_BB;
break;
case 'm':
av_log(s, AV_LOG_ERROR, "YUV4MPEG stream contains mixed "
"interlaced and non-interlaced frames.\n");
default:
av_log(s, AV_LOG_ERROR, "YUV4MPEG has invalid header.\n");
return AVERROR(EINVAL);
}
break;
case 'F': // Frame rate
sscanf(tokstart, "%d:%d", &raten, &rated); // 0:0 if unknown
@ -235,27 +255,7 @@ static int yuv4_read_header(AVFormatContext *s)
st->codec->codec_id = AV_CODEC_ID_RAWVIDEO;
st->sample_aspect_ratio = (AVRational){ aspectn, aspectd };
st->codec->chroma_sample_location = chroma_sample_location;
switch (interlaced){
case 'p':
st->codec->field_order = AV_FIELD_PROGRESSIVE;
break;
case 't':
st->codec->field_order = AV_FIELD_TB;
break;
case 'b':
st->codec->field_order = AV_FIELD_BT;
break;
case 'm':
av_log(s, AV_LOG_ERROR, "YUV4MPEG stream contains mixed "
"interlaced and non-interlaced frames.\n");
case '?':
st->codec->field_order = AV_FIELD_UNKNOWN;
break;
default:
av_log(s, AV_LOG_ERROR, "YUV4MPEG has invalid header.\n");
return AVERROR(EINVAL);
}
st->codec->field_order = field_order;
return 0;
}