mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-21 10:55:51 +02:00
wtvenc: populate VIDEOINFOHEADER2
Fixes ticket #2835. Signed-off-by: Peter Ross <pross@xvid.org> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
f93b0abe40
commit
6da21c1f81
@ -223,9 +223,50 @@ static void finish_chunk(AVFormatContext *s)
|
||||
write_index(s);
|
||||
}
|
||||
|
||||
static void put_videoinfoheader2(AVIOContext *pb, AVStream *st)
|
||||
{
|
||||
AVRational dar = av_mul_q(st->sample_aspect_ratio, (AVRational){st->codec->width, st->codec->height});
|
||||
unsigned int num, den;
|
||||
av_reduce(&num, &den, dar.num, dar.den, 0xFFFFFFFF);
|
||||
|
||||
/* VIDEOINFOHEADER2 */
|
||||
avio_wl32(pb, 0);
|
||||
avio_wl32(pb, 0);
|
||||
avio_wl32(pb, st->codec->width);
|
||||
avio_wl32(pb, st->codec->height);
|
||||
|
||||
avio_wl32(pb, 0);
|
||||
avio_wl32(pb, 0);
|
||||
avio_wl32(pb, 0);
|
||||
avio_wl32(pb, 0);
|
||||
|
||||
avio_wl32(pb, st->codec->bit_rate);
|
||||
avio_wl32(pb, 0);
|
||||
avio_wl64(pb, st->avg_frame_rate.num && st->avg_frame_rate.den ? INT64_C(10000000) / av_q2d(st->avg_frame_rate) : 0);
|
||||
avio_wl32(pb, 0);
|
||||
avio_wl32(pb, 0);
|
||||
|
||||
avio_wl32(pb, num);
|
||||
avio_wl32(pb, den);
|
||||
avio_wl32(pb, 0);
|
||||
avio_wl32(pb, 0);
|
||||
|
||||
ff_put_bmp_header(pb, st->codec, ff_codec_bmp_tags, 0, 1);
|
||||
|
||||
if (st->codec->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
|
||||
/* MPEG2VIDEOINFO */
|
||||
avio_wl32(pb, 0);
|
||||
avio_wl32(pb, st->codec->extradata_size);
|
||||
avio_wl32(pb, -1);
|
||||
avio_wl32(pb, -1);
|
||||
avio_wl32(pb, 0);
|
||||
avio_write(pb, st->codec->extradata, st->codec->extradata_size);
|
||||
avio_wl64(pb, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static int write_stream_codec_info(AVFormatContext *s, AVStream *st)
|
||||
{
|
||||
WtvContext *wctx = s->priv_data;
|
||||
const ff_asf_guid *g, *media_type, *format_type;
|
||||
AVIOContext *pb = s->pb;
|
||||
int64_t hdr_pos_start;
|
||||
@ -257,13 +298,7 @@ static int write_stream_codec_info(AVFormatContext *s, AVStream *st)
|
||||
|
||||
hdr_pos_start = avio_tell(pb);
|
||||
if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
|
||||
if (wctx->first_video_flag) {
|
||||
write_pad(pb, 216); //The size is sensitive.
|
||||
wctx->first_video_flag = 0;
|
||||
} else {
|
||||
write_pad(pb, 72); // aspect ratio
|
||||
ff_put_bmp_header(pb, st->codec, ff_codec_bmp_tags, 0);
|
||||
}
|
||||
put_videoinfoheader2(pb, st);
|
||||
} else {
|
||||
ff_put_wav_header(pb, st->codec);
|
||||
}
|
||||
|
@ -1,3 +1,3 @@
|
||||
98dd5205889313542da71351fbaf4172 *./tests/data/lavf/lavf.wtv
|
||||
13cbdaf2c5e7c97991781cc48d9a958f *./tests/data/lavf/lavf.wtv
|
||||
413696 ./tests/data/lavf/lavf.wtv
|
||||
./tests/data/lavf/lavf.wtv CRC=0x71287e25
|
||||
|
@ -1,48 +1,48 @@
|
||||
ret: 0 st: 1 flags:1 dts: 0.029093 pts: 0.029093 pos: 26344 size: 208
|
||||
ret: 0 st: 1 flags:1 dts: 0.029093 pts: 0.029093 pos: 26288 size: 208
|
||||
ret: 0 st:-1 flags:0 ts:-1.000000
|
||||
ret: 0 st: 1 flags:1 dts: 0.029093 pts: 0.029093 pos: 26344 size: 208
|
||||
ret: 0 st: 1 flags:1 dts: 0.029093 pts: 0.029093 pos: 26288 size: 208
|
||||
ret: 0 st:-1 flags:1 ts: 1.894167
|
||||
ret: 0 st: 1 flags:1 dts: 0.734399 pts: 0.734399 pos: 294744 size: 209
|
||||
ret: 0 st: 1 flags:1 dts: 0.734399 pts: 0.734399 pos: 294688 size: 209
|
||||
ret: 0 st: 0 flags:0 ts: 0.788334
|
||||
ret: 0 st: 1 flags:1 dts: 0.734399 pts: 0.734399 pos: 294744 size: 209
|
||||
ret: 0 st: 1 flags:1 dts: 0.734399 pts: 0.734399 pos: 294688 size: 209
|
||||
ret: 0 st: 0 flags:1 ts:-0.317499
|
||||
ret: 0 st: 1 flags:1 dts: 0.029093 pts: 0.029093 pos: 26344 size: 208
|
||||
ret: 0 st: 1 flags:1 dts: 0.029093 pts: 0.029093 pos: 26288 size: 208
|
||||
ret:-1 st: 1 flags:0 ts: 2.576668
|
||||
ret: 0 st: 1 flags:1 ts: 1.470835
|
||||
ret: 0 st: 1 flags:1 dts: 0.734399 pts: 0.734399 pos: 294744 size: 209
|
||||
ret: 0 st: 1 flags:1 dts: 0.734399 pts: 0.734399 pos: 294688 size: 209
|
||||
ret: 0 st:-1 flags:0 ts: 0.365002
|
||||
ret: 0 st: 1 flags:1 dts: 0.029093 pts: 0.029093 pos: 26344 size: 208
|
||||
ret: 0 st: 1 flags:1 dts: 0.029093 pts: 0.029093 pos: 26288 size: 208
|
||||
ret: 0 st:-1 flags:1 ts:-0.740831
|
||||
ret: 0 st: 1 flags:1 dts: 0.029093 pts: 0.029093 pos: 26344 size: 208
|
||||
ret: 0 st: 1 flags:1 dts: 0.029093 pts: 0.029093 pos: 26288 size: 208
|
||||
ret:-1 st: 0 flags:0 ts: 2.153336
|
||||
ret: 0 st: 0 flags:1 ts: 1.047503
|
||||
ret: 0 st: 1 flags:1 dts: 0.029093 pts: 0.029093 pos: 26344 size: 208
|
||||
ret: 0 st: 1 flags:1 dts: 0.029093 pts: 0.029093 pos: 26288 size: 208
|
||||
ret: 0 st: 1 flags:0 ts:-0.058330
|
||||
ret: 0 st: 1 flags:1 dts: 0.029093 pts: 0.029093 pos: 26344 size: 208
|
||||
ret: 0 st: 1 flags:1 dts: 0.029093 pts: 0.029093 pos: 26288 size: 208
|
||||
ret: 0 st: 1 flags:1 ts: 2.835837
|
||||
ret: 0 st: 1 flags:1 dts: 0.734399 pts: 0.734399 pos: 294744 size: 209
|
||||
ret: 0 st: 1 flags:1 dts: 0.734399 pts: 0.734399 pos: 294688 size: 209
|
||||
ret:-1 st:-1 flags:0 ts: 1.730004
|
||||
ret: 0 st:-1 flags:1 ts: 0.624171
|
||||
ret: 0 st: 1 flags:1 dts: 0.029093 pts: 0.029093 pos: 26344 size: 208
|
||||
ret: 0 st: 1 flags:1 dts: 0.029093 pts: 0.029093 pos: 26288 size: 208
|
||||
ret: 0 st: 0 flags:0 ts:-0.481662
|
||||
ret: 0 st: 1 flags:1 dts: 0.029093 pts: 0.029093 pos: 26344 size: 208
|
||||
ret: 0 st: 1 flags:1 dts: 0.029093 pts: 0.029093 pos: 26288 size: 208
|
||||
ret: 0 st: 0 flags:1 ts: 2.412505
|
||||
ret: 0 st: 1 flags:1 dts: 0.734399 pts: 0.734399 pos: 294744 size: 209
|
||||
ret: 0 st: 1 flags:1 dts: 0.734399 pts: 0.734399 pos: 294688 size: 209
|
||||
ret:-1 st: 1 flags:0 ts: 1.306672
|
||||
ret: 0 st: 1 flags:1 ts: 0.200839
|
||||
ret: 0 st: 1 flags:1 dts: 0.211950 pts: 0.211950 pos: 99352 size: 209
|
||||
ret: 0 st: 1 flags:1 dts: 0.211950 pts: 0.211950 pos: 99296 size: 209
|
||||
ret: 0 st:-1 flags:0 ts:-0.904994
|
||||
ret: 0 st: 1 flags:1 dts: 0.029093 pts: 0.029093 pos: 26344 size: 208
|
||||
ret: 0 st: 1 flags:1 dts: 0.029093 pts: 0.029093 pos: 26288 size: 208
|
||||
ret: 0 st:-1 flags:1 ts: 1.989173
|
||||
ret: 0 st: 1 flags:1 dts: 0.734399 pts: 0.734399 pos: 294744 size: 209
|
||||
ret: 0 st: 1 flags:1 dts: 0.734399 pts: 0.734399 pos: 294688 size: 209
|
||||
ret: 0 st: 0 flags:0 ts: 0.883340
|
||||
ret: 0 st: 1 flags:1 dts: 0.734399 pts: 0.734399 pos: 294744 size: 209
|
||||
ret: 0 st: 1 flags:1 dts: 0.734399 pts: 0.734399 pos: 294688 size: 209
|
||||
ret: 0 st: 0 flags:1 ts:-0.222493
|
||||
ret: 0 st: 1 flags:1 dts: 0.029093 pts: 0.029093 pos: 26344 size: 208
|
||||
ret: 0 st: 1 flags:1 dts: 0.029093 pts: 0.029093 pos: 26288 size: 208
|
||||
ret:-1 st: 1 flags:0 ts: 2.671674
|
||||
ret: 0 st: 1 flags:1 ts: 1.565841
|
||||
ret: 0 st: 1 flags:1 dts: 0.734399 pts: 0.734399 pos: 294744 size: 209
|
||||
ret: 0 st: 1 flags:1 dts: 0.734399 pts: 0.734399 pos: 294688 size: 209
|
||||
ret: 0 st:-1 flags:0 ts: 0.460008
|
||||
ret: 0 st: 1 flags:1 dts: 0.029093 pts: 0.029093 pos: 26344 size: 208
|
||||
ret: 0 st: 1 flags:1 dts: 0.029093 pts: 0.029093 pos: 26288 size: 208
|
||||
ret: 0 st:-1 flags:1 ts:-0.645825
|
||||
ret: 0 st: 1 flags:1 dts: 0.029093 pts: 0.029093 pos: 26344 size: 208
|
||||
ret: 0 st: 1 flags:1 dts: 0.029093 pts: 0.029093 pos: 26288 size: 208
|
||||
|
Loading…
Reference in New Issue
Block a user