filter/ffmpeg: fill `AVFrame::pts`
Some libavfilter plugins don't produce any output if `pts` is never set, e.g. the `lowpass` plugin. Closes https://github.com/MusicPlayerDaemon/MPD/issues/2114
This commit is contained in:
parent
7dce7ad32d
commit
fc5d258890
2
NEWS
2
NEWS
|
@ -46,6 +46,8 @@ ver 0.24 (not yet released)
|
|||
- sidplay: require libsidplayfp (drop support for the original sidplay)
|
||||
- wavpack: require libwavpack version 5
|
||||
- fix MixRamp bug
|
||||
* filter
|
||||
- ffmpeg: fix for filters producing no output
|
||||
* resampler
|
||||
- soxr: require libsoxr 0.1.2 or later
|
||||
* player
|
||||
|
|
|
@ -66,6 +66,9 @@ FfmpegFilter::FilterPCM(std::span<const std::byte> src)
|
|||
#endif
|
||||
frame->nb_samples = src.size() / in_audio_frame_size;
|
||||
|
||||
frame->pts = pts;
|
||||
pts += frame->nb_samples;
|
||||
|
||||
frame.GetBuffer();
|
||||
|
||||
memcpy(frame.GetData(0), src.data(), src.size());
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
// Copyright The Music Player Daemon Project
|
||||
|
||||
#ifndef MPD_FFMPEG_FILTER__HXX
|
||||
#define MPD_FFMPEG_FILTER__HXX
|
||||
#pragma once
|
||||
|
||||
#include "filter/Filter.hxx"
|
||||
#include "lib/ffmpeg/Buffer.hxx"
|
||||
#include "lib/ffmpeg/Filter.hxx"
|
||||
#include "lib/ffmpeg/Frame.hxx"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
/**
|
||||
* A #Filter implementation using FFmpeg's libavfilter.
|
||||
*/
|
||||
|
@ -30,6 +31,11 @@ class FfmpegFilter final : public Filter {
|
|||
const size_t in_audio_frame_size;
|
||||
const size_t out_audio_frame_size;
|
||||
|
||||
/**
|
||||
* Presentation timestamp. A counter for `AVFrame::pts`.
|
||||
*/
|
||||
int_least64_t pts = 0;
|
||||
|
||||
bool flushed = false;
|
||||
|
||||
public:
|
||||
|
@ -53,5 +59,3 @@ public:
|
|||
private:
|
||||
std::span<const std::byte> ReadOutput();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue