[FFmpeg-devel] [PATCH 1/2] avformat/mlpdec: fix time_base for packet timestamps
Andreas Rheinhardt
andreas.rheinhardt at outlook.com
Sun Sep 5 19:33:40 EEST 2021
Paul B Mahol:
> Signed-off-by: Paul B Mahol <onemda at gmail.com>
> ---
> libavformat/mlpdec.c | 43 ++++++++++++++++++++++++++++++++++++++++---
> 1 file changed, 40 insertions(+), 3 deletions(-)
>
> diff --git a/libavformat/mlpdec.c b/libavformat/mlpdec.c
> index 8f0aabb510..cc5b8d07bb 100644
> --- a/libavformat/mlpdec.c
> +++ b/libavformat/mlpdec.c
> @@ -22,8 +22,12 @@
> */
>
> #include "avformat.h"
> +#include "avio_internal.h"
> +#include "internal.h"
> #include "rawdec.h"
> #include "libavutil/intreadwrite.h"
> +#include "libavcodec/mlp.h"
> +#include "libavcodec/mlp_parse.h"
>
> static int av_always_inline mlp_thd_probe(const AVProbeData *p, uint32_t sync)
> {
> @@ -50,6 +54,40 @@ static int av_always_inline mlp_thd_probe(const AVProbeData *p, uint32_t sync)
> return 0;
> }
>
> +static int mlp_read_header(AVFormatContext *s)
> +{
> + int ret = ff_raw_audio_read_header(s);
> +
> + if (ret < 0)
> + return ret;
> +
> + ret = ffio_ensure_seekback(s->pb, 10);
> + if (ret == 0) {
> + uint8_t buffer[10];
> + int read, sample_rate = 0;
> +
> + read = avio_read(s->pb, buffer, 10);
> + if (read == 10) {
> + switch (buffer[7]) {
> + case SYNC_TRUEHD:
> + sample_rate = mlp_samplerate(buffer[8] >> 4);
> + break;
> + case SYNC_MLP:
> + sample_rate = mlp_samplerate((buffer[9] >> 4) & 0xF);
The "& 0xF" is unnecessary now.
- Andreas
More information about the ffmpeg-devel
mailing list