If skip_samples is set and timestamps are synthesized using durations,
make them start at -skip_samples (rescaled) instead of 0,
so that the timestamp of the first undiscarded sample is 0.
This adds the minimum delay needed with the current decoder to
recognize the reorder buffer size for the reference bitstreams.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
To ensure the full range of values is still used, also adjust all uses of this function to loop from 0
instead of 1. This way only 60.00 is added and nothing lost.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This can easily happen when the caller is using a custom AVIOContext.
Behave as if the filename was an empty string in this case.
CC: libav-stable@libav.org
This fixes an issue with a crazy data track starting with a large
negative timestamp.
It could as well be solved in all user apps, but this is looking
attractively simpler ...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Use codec aspect ratio for frame aspect ratio if AVFrame is NULL.
Signed-off-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Guesses the sample aspect ratio of a frame, based on both the stream and the
frame aspect ratio.
Since the frame aspect ratio is set by the codec but the stream aspect ratio
is set by the demuxer, these two may not be equal. This function tries to
return the value that you should use if you would like to display the frame.
Basic logic is to use the stream aspect ratio if it is set to something sane
otherwise use the frame aspect ratio. This way a container setting, which is
usually easy to modify can override the coded value in the frames.
Signed-off-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Manually remove that flag again for formats that read an arbitrary
amount of data and thus truncation is not an error.
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
this hunk was merged in 8b97ae64 and cbf767a8 although the check was there a
few lines above since cdced09e. I removed the first check to reduce the differences
to libav.
Signed-off-by: Jean First <jeanfirst@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This replaces the matroskadec one with the same name.
The advantage is not only easier reuse in other demuxers
but also that we can make the decisions after the parser.
This fixes seeking in files that mark the keyframes incorrectly,
for example the file in track ticket #1003.
The matroska variable is still kept to be able to complain
about such broken files.
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>