mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-21 10:55:51 +02:00
avformat/avienc: fix fields-per-frame value for interlaced video streams
Writes one set of field framing information for progressive streams and two sets for interlaced streams. Fixes ticket #6383. Unfortunately the OpenDML v1.02 document is not very specific on what value to use for start_line when frame data is not coming from a capturing device, so this is just using 0/1 depending on the field order as a best-effort guess. Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
This commit is contained in:
parent
0e93694e64
commit
26c0c84784
@ -501,8 +501,14 @@ static int avi_write_header(AVFormatContext *s)
|
||||
AVRational dar = av_mul_q(st->sample_aspect_ratio,
|
||||
(AVRational) { par->width,
|
||||
par->height });
|
||||
int num, den;
|
||||
int num, den, fields, i;
|
||||
av_reduce(&num, &den, dar.num, dar.den, 0xFFFF);
|
||||
if (par->field_order == AV_FIELD_TT || par->field_order == AV_FIELD_BB ||
|
||||
par->field_order == AV_FIELD_TB || par->field_order == AV_FIELD_BT) {
|
||||
fields = 2; // interlaced
|
||||
} else {
|
||||
fields = 1; // progressive
|
||||
}
|
||||
|
||||
avio_wl32(pb, 0); // video format = unknown
|
||||
avio_wl32(pb, 0); // video standard = unknown
|
||||
@ -514,17 +520,30 @@ static int avi_write_header(AVFormatContext *s)
|
||||
avio_wl16(pb, num);
|
||||
avio_wl32(pb, par->width);
|
||||
avio_wl32(pb, par->height);
|
||||
avio_wl32(pb, 1); // progressive FIXME
|
||||
avio_wl32(pb, fields); // fields per frame
|
||||
|
||||
avio_wl32(pb, par->height);
|
||||
avio_wl32(pb, par->width);
|
||||
avio_wl32(pb, par->height);
|
||||
avio_wl32(pb, par->width);
|
||||
avio_wl32(pb, 0);
|
||||
avio_wl32(pb, 0);
|
||||
for (i = 0; i < fields; i++) {
|
||||
int start_line;
|
||||
// OpenDML v1.02 is not very specific on what value to use for
|
||||
// start_line when frame data is not coming from a capturing device,
|
||||
// so just use 0/1 depending on the field order for interlaced frames
|
||||
if (par->field_order == AV_FIELD_TT || par->field_order == AV_FIELD_TB) {
|
||||
start_line = (i == 0) ? 0 : 1;
|
||||
} else if (par->field_order == AV_FIELD_BB || par->field_order == AV_FIELD_BT) {
|
||||
start_line = (i == 0) ? 1 : 0;
|
||||
} else {
|
||||
start_line = 0;
|
||||
}
|
||||
|
||||
avio_wl32(pb, 0);
|
||||
avio_wl32(pb, 0);
|
||||
avio_wl32(pb, par->height / fields); // compressed bitmap height
|
||||
avio_wl32(pb, par->width); // compressed bitmap width
|
||||
avio_wl32(pb, par->height / fields); // valid bitmap height
|
||||
avio_wl32(pb, par->width); // valid bitmap width
|
||||
avio_wl32(pb, 0); // valid bitmap X offset
|
||||
avio_wl32(pb, 0); // valid bitmap Y offset
|
||||
avio_wl32(pb, 0); // valid X offset in T
|
||||
avio_wl32(pb, start_line); // valid Y start line
|
||||
}
|
||||
ff_end_tag(pb, vprp);
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@
|
||||
// Also please add any ticket numbers that you believe might be affected here
|
||||
#define LIBAVFORMAT_VERSION_MAJOR 58
|
||||
#define LIBAVFORMAT_VERSION_MINOR 2
|
||||
#define LIBAVFORMAT_VERSION_MICRO 102
|
||||
#define LIBAVFORMAT_VERSION_MICRO 103
|
||||
|
||||
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
|
||||
LIBAVFORMAT_VERSION_MINOR, \
|
||||
|
@ -1,5 +1,5 @@
|
||||
6f6b211cbc8de9871e8e09e64048e2f9 *tests/data/fate/copy-trac2211-avi.avi
|
||||
1777924 tests/data/fate/copy-trac2211-avi.avi
|
||||
0920978f3f8196413c43f0033b55a5b6 *tests/data/fate/copy-trac2211-avi.avi
|
||||
1777956 tests/data/fate/copy-trac2211-avi.avi
|
||||
#tb 0: 1/14
|
||||
#media_type 0: video
|
||||
#codec_id 0: rawvideo
|
||||
|
Loading…
Reference in New Issue
Block a user