在输出到文件之前,从AVAssetWriter中删除缓冲区

时间:2022-08-30 00:05:24

I have an app that is like Vine or Instagram Video and I am trying to delete the last recorded segment. I am using AVAssetWriter and appending the sample buffer to the asset writer input when recording but I want to allow users to delete the last sample buffer that was recorded.

我有一个类似Vine或Instagram视频的应用程序,我想删除最后录制的片段。我正在使用AVAssetWriter,并在记录时将示例缓冲区附加到资产写入器输入,但我希望允许用户删除记录的最后一个示例缓冲区。

Is there a way to remove buffer appended to AVAssetWriter? I check the documentation and there is no methods to delete buffer.

有没有办法删除附加在AVAssetWriter上的缓冲区?我检查了文档,没有删除缓冲区的方法。

1 个解决方案

#1


0  

You can use a fixed sized FIFO queue to cache the recent buffers instead of writing them directly. If the user decides not to delete the last buffers, then you write the remaining buffers in the queue.

可以使用固定大小的FIFO队列缓存最近的缓冲区,而不是直接写入缓冲区。如果用户决定不删除最后的缓冲区,那么您将在队列中写入其余的缓冲区。

#1


0  

You can use a fixed sized FIFO queue to cache the recent buffers instead of writing them directly. If the user decides not to delete the last buffers, then you write the remaining buffers in the queue.

可以使用固定大小的FIFO队列缓存最近的缓冲区,而不是直接写入缓冲区。如果用户决定不删除最后的缓冲区,那么您将在队列中写入其余的缓冲区。