Commit 8f6f2322 authored by wm4's avatar wm4

ffmpeg: use new decode API

This is a bit messy, mainly due to timestamp handling.

decode_video() relied on the fact that it could set dts on a flush/drain
packet. This is not possible with the old API, and won't be. (I think
doing this was very questionable with the old API. Flush packets should
not contain any information; they just cause a FIFO to be emptied.) This
is replaced with checking the best_effort_timestamp for AV_NOPTS_VALUE,
and using the suggested DTS in the drain case.

The modified tests (fate-cavs and others) still fails due to dropping
the last frame. This happens because the timestamp of the last frame
goes backwards (ffprobe -show_frames shows the same thing). I suspect
that this "worked" due to the best effort timestamp logic picking the
DTS over the decreasing PTS. Since this logic is in libavcodec (where
it probably shouldn't be), this can't be easily fixed. The timestamps
of the cavs samples are weird anyway, so I chose not to fix it.

Another strange thing is the timestamp handling in the video path of
process_input_packet (after the decode_video() call). It looks like
the code to increase next_dts and next_pts should be run every time
a frame is decoded - but it's needed even if output is skipped.
parent b2fea2fd
This diff is collapsed.
...@@ -348,6 +348,9 @@ typedef struct InputStream { ...@@ -348,6 +348,9 @@ typedef struct InputStream {
// number of frames/samples retrieved from the decoder // number of frames/samples retrieved from the decoder
uint64_t frames_decoded; uint64_t frames_decoded;
uint64_t samples_decoded; uint64_t samples_decoded;
int64_t *dts_buffer;
int nb_dts_buffer;
} InputStream; } InputStream;
typedef struct InputFile { typedef struct InputFile {
......
...@@ -173,4 +173,3 @@ ...@@ -173,4 +173,3 @@
0, 167, 167, 1, 622080, 0xdcb4cee8 0, 167, 167, 1, 622080, 0xdcb4cee8
0, 168, 168, 1, 622080, 0xb41172e5 0, 168, 168, 1, 622080, 0xb41172e5
0, 169, 169, 1, 622080, 0x56c72478 0, 169, 169, 1, 622080, 0x56c72478
0, 170, 170, 1, 622080, 0x84ff3af9
...@@ -354,4 +354,3 @@ ...@@ -354,4 +354,3 @@
0, 348, 348, 1, 152064, 0x929650eb 0, 348, 348, 1, 152064, 0x929650eb
0, 349, 349, 1, 152064, 0x082557a1 0, 349, 349, 1, 152064, 0x082557a1
0, 350, 350, 1, 152064, 0xb80510ae 0, 350, 350, 1, 152064, 0xb80510ae
0, 351, 351, 1, 152064, 0x6fce483f
...@@ -12,4 +12,3 @@ ...@@ -12,4 +12,3 @@
0, 7, 7, 1, 102240, 0x342bf32f 0, 7, 7, 1, 102240, 0x342bf32f
0, 8, 8, 1, 102240, 0x7b311bf1 0, 8, 8, 1, 102240, 0x7b311bf1
0, 9, 9, 1, 102240, 0xf56e0cd3 0, 9, 9, 1, 102240, 0xf56e0cd3
0, 10, 10, 1, 102240, 0xfb95c7d3
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