gpt4 book ai didi

ffmpeg - 如何复制从 av_read_frame 接收到的 AVPicture。什么是正确的方法?

转载 作者:行者123 更新时间:2023-12-04 23:16:57 34 4
gpt4 key购买 nike

我一直在尝试在 android 中编写一个 rtsp 播放器。我是新手。并想知道如何存储从 av_read_frame 检索到的数据包以供进一步使用。
[例如。 不同的线程来解码它 ]。

while (1)
{

av_read_frame(pFormatCtx, &packet) >= 0) {

if (packet.stream_index == videoStream) {
sendPacketToLInkedList ( packet);
}



sendPacketToLinkedList (AVPacket *pkt)
{

AVPacket *refPacket;
refPacket = pkt; // How log will it be valid ??
}

我只是想知道从 av_read_frame 检索到的数据包有效多长时间?..

最佳答案

ffmpeg 实际上有一些 ok-ish documentation :

int av_read_frame( AVFormatContext * s, AVPacket * pkt )

If pkt->buf is NULL, then the packet is valid until the next av_read_frame() or until avformat_close_input(). Otherwise the packet is valid indefinitely. In both cases the packet must be freed with av_free_packet when it is no longer needed. For video, the packet contains exactly one frame. For audio, it contains an integer number of frames if each frame has a known fixed size (e.g. PCM or ADPCM data). If the audio frames have a variable size (e.g. MPEG audio), then it contains one frame.


如果你想要 av_read_frame() -分配 AVPacket s 多逗留一点,总会有 av_copy_packet() .

关于ffmpeg - 如何复制从 av_read_frame 接收到的 AVPicture。什么是正确的方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23828599/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com