Commit e3453fd4 authored by Luca Barbato's avatar Luca Barbato

matroska: Write the field order information

And bump the document version to 4.
parent b3051a46
......@@ -626,6 +626,45 @@ static int mkv_write_codecprivate(AVFormatContext *s, AVIOContext *pb,
return ret;
}
static void mkv_write_field_order(AVIOContext *pb,
enum AVFieldOrder field_order)
{
switch (field_order) {
case AV_FIELD_UNKNOWN:
put_ebml_uint(pb, MATROSKA_ID_VIDEOFLAGINTERLACED,
MATROSKA_VIDEO_INTERLACE_FLAG_UNDETERMINED);
break;
case AV_FIELD_PROGRESSIVE:
put_ebml_uint(pb, MATROSKA_ID_VIDEOFLAGINTERLACED,
MATROSKA_VIDEO_INTERLACE_FLAG_PROGRESSIVE);
break;
case AV_FIELD_TT:
case AV_FIELD_BB:
case AV_FIELD_TB:
case AV_FIELD_BT:
put_ebml_uint(pb, MATROSKA_ID_VIDEOFLAGINTERLACED,
MATROSKA_VIDEO_INTERLACE_FLAG_INTERLACED);
switch (field_order) {
case AV_FIELD_TT:
put_ebml_uint(pb, MATROSKA_ID_VIDEOFIELDORDER,
MATROSKA_VIDEO_FIELDORDER_TT);
break;
case AV_FIELD_BB:
put_ebml_uint(pb, MATROSKA_ID_VIDEOFIELDORDER,
MATROSKA_VIDEO_FIELDORDER_BB);
break;
case AV_FIELD_TB:
put_ebml_uint(pb, MATROSKA_ID_VIDEOFIELDORDER,
MATROSKA_VIDEO_FIELDORDER_TB);
break;
case AV_FIELD_BT:
put_ebml_uint(pb, MATROSKA_ID_VIDEOFIELDORDER,
MATROSKA_VIDEO_FIELDORDER_BT);
break;
}
}
}
static int mkv_write_stereo_mode(AVFormatContext *s, AVIOContext *pb,
AVStream *st, int mode)
{
......@@ -825,10 +864,12 @@ static int mkv_write_track(AVFormatContext *s, MatroskaMuxContext *mkv,
}
subinfo = start_ebml_master(pb, MATROSKA_ID_TRACKVIDEO, 0);
// XXX: interlace flag?
put_ebml_uint (pb, MATROSKA_ID_VIDEOPIXELWIDTH , par->width);
put_ebml_uint (pb, MATROSKA_ID_VIDEOPIXELHEIGHT, par->height);
mkv_write_field_order(pb, par->field_order);
// check both side data and metadata for stereo information,
// write the result to the bitstream if any is found
ret = mkv_write_stereo_mode(s, pb, st, mkv->mode);
......@@ -1145,7 +1186,7 @@ static int mkv_write_header(AVFormatContext *s)
put_ebml_uint (pb, EBML_ID_EBMLMAXIDLENGTH , 4);
put_ebml_uint (pb, EBML_ID_EBMLMAXSIZELENGTH , 8);
put_ebml_string (pb, EBML_ID_DOCTYPE , s->oformat->name);
put_ebml_uint (pb, EBML_ID_DOCTYPEVERSION , 2);
put_ebml_uint (pb, EBML_ID_DOCTYPEVERSION , 4);
put_ebml_uint (pb, EBML_ID_DOCTYPEREADVERSION , 2);
end_ebml_master(pb, ebml_header);
......
......@@ -91,12 +91,12 @@ fate-wavpack-matroskamode: CMD = md5 -i $(TARGET_SAMPLES)/wavpack/special/matros
FATE_WAVPACK-$(call DEMMUX, WV, MATROSKA) += fate-wavpack-matroska_mux-mono
fate-wavpack-matroska_mux-mono: CMD = md5 -i $(TARGET_SAMPLES)/wavpack/num_channels/mono_16bit_int.wv -c copy -fflags +bitexact -f matroska
fate-wavpack-matroska_mux-mono: CMP = oneline
fate-wavpack-matroska_mux-mono: REF = 6bd769b3f0e9d7fa6261c3b73a53eb7d
fate-wavpack-matroska_mux-mono: REF = 90bb202ca75333d25146c52f863f93bd
FATE_WAVPACK-$(call DEMMUX, WV, MATROSKA) += fate-wavpack-matroska_mux-61
fate-wavpack-matroska_mux-61: CMD = md5 -i $(TARGET_SAMPLES)/wavpack/num_channels/eva_2.22_6.1_16bit-partial.wv -c copy -fflags +bitexact -f matroska
fate-wavpack-matroska_mux-61: CMP = oneline
fate-wavpack-matroska_mux-61: REF = 2d2f1e7f81a8b1983fcffc7f24de8a11
fate-wavpack-matroska_mux-61: REF = de9f9f8136377af41ac1e899aaec6752
FATE_SAMPLES_AVCONV += $(FATE_WAVPACK-yes)
fate-wavpack: $(FATE_WAVPACK-yes)
268fb8f9278b0df2f87a6a9455f3cd56 *./tests/data/lavf/lavf.mkv
320380 ./tests/data/lavf/lavf.mkv
76d400179dfd6143f50ea4d19fe8ed99 *./tests/data/lavf/lavf.mkv
320383 ./tests/data/lavf/lavf.mkv
./tests/data/lavf/lavf.mkv CRC=0x36193cda
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 630 size: 208
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 633 size: 208
ret: 0 st:-1 flags:0 ts:-1.000000
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 630 size: 208
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 633 size: 208
ret: 0 st:-1 flags:1 ts: 1.894167
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292268 size: 27834
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292271 size: 27834
ret: 0 st: 0 flags:0 ts: 0.788000
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292268 size: 27834
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292271 size: 27834
ret: 0 st: 0 flags:1 ts:-0.317000
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 630 size: 208
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 633 size: 208
ret: 0 st: 1 flags:0 ts: 2.577000
ret:-EOF
ret: 0 st: 1 flags:1 ts: 1.471000
ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 320109 size: 209
ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 320112 size: 209
ret: 0 st:-1 flags:0 ts: 0.365002
ret: 0 st: 0 flags:1 dts: 0.491000 pts: 0.491000 pos: 146821 size: 27925
ret: 0 st: 0 flags:1 dts: 0.491000 pts: 0.491000 pos: 146824 size: 27925
ret: 0 st:-1 flags:1 ts:-0.740831
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 630 size: 208
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 633 size: 208
ret: 0 st: 0 flags:0 ts: 2.153000
ret:-EOF
ret: 0 st: 0 flags:1 ts: 1.048000
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292268 size: 27834
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292271 size: 27834
ret: 0 st: 1 flags:0 ts:-0.058000
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 630 size: 208
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 633 size: 208
ret: 0 st: 1 flags:1 ts: 2.836000
ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 320109 size: 209
ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 320112 size: 209
ret: 0 st:-1 flags:0 ts: 1.730004
ret:-EOF
ret: 0 st:-1 flags:1 ts: 0.624171
ret: 0 st: 0 flags:1 dts: 0.491000 pts: 0.491000 pos: 146821 size: 27925
ret: 0 st: 0 flags:1 dts: 0.491000 pts: 0.491000 pos: 146824 size: 27925
ret: 0 st: 0 flags:0 ts:-0.482000
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 630 size: 208
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 633 size: 208
ret: 0 st: 0 flags:1 ts: 2.413000
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292268 size: 27834
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292271 size: 27834
ret: 0 st: 1 flags:0 ts: 1.307000
ret:-EOF
ret: 0 st: 1 flags:1 ts: 0.201000
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 630 size: 208
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 633 size: 208
ret: 0 st:-1 flags:0 ts:-0.904994
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 630 size: 208
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 633 size: 208
ret: 0 st:-1 flags:1 ts: 1.989173
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292268 size: 27834
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292271 size: 27834
ret: 0 st: 0 flags:0 ts: 0.883000
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292268 size: 27834
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292271 size: 27834
ret: 0 st: 0 flags:1 ts:-0.222000
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 630 size: 208
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 633 size: 208
ret: 0 st: 1 flags:0 ts: 2.672000
ret:-EOF
ret: 0 st: 1 flags:1 ts: 1.566000
ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 320109 size: 209
ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 320112 size: 209
ret: 0 st:-1 flags:0 ts: 0.460008
ret: 0 st: 0 flags:1 dts: 0.491000 pts: 0.491000 pos: 146821 size: 27925
ret: 0 st: 0 flags:1 dts: 0.491000 pts: 0.491000 pos: 146824 size: 27925
ret: 0 st:-1 flags:1 ts:-0.645825
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 630 size: 208
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 633 size: 208
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