当前位置: 首页 > news >正文

ffplay数据结构解析

ffmpeg版本5-1-6

数据结构

FrameQueue

typedef struct FrameQueue {Frame queue[FRAME_QUEUE_SIZE];//存储解码后帧数据(视频YUV/RGB、音频PCM、字幕)的预分配内存池int rindex;//指向当前待读取(播放)的帧位置,相当于队列头部int windex;//指向下一个可写入(解码)的帧位置,相当于队列尾部int size;//当前队列中已存储的帧数量。用于判断队列空满,避免“假溢出”int max_size;//最大存储帧数int keep_last;//关键标志。为1时,队列会​​保留最近已显示的一帧​​(由rindex指向),用于特殊情况下的重绘或seek操作int rindex_shown;//	配合keep_last使用。为1表示rindex指向的帧是已显示的“保留帧”,实际待读帧是(rindex + rindex_shown) % max_sizeSDL_mutex *mutex;SDL_cond *cond;PacketQueue *pktq;//指向对应的​​压缩数据包队列​​。关联关系有助于在队列终止(如abort_request)时快速通知对方,实现协同退出} FrameQueue;

PacketQueue

typedef struct PacketQueue {AVFifo *pkt_list; //数据存储区​​。一个环形缓冲区,用于存放 MyAVPacketList元素,每个元素包含一个 AVPacket和其序列号int nb_packets;//	包数量​​。记录队列中当前存在的 AVPacket 数量int size;//	内存大小​​。统计队列中所有 AVPacket 数据(包括其数据体)所占用的总内存字节数,用于控制缓存大小int64_t duration;//总时长​​。统计队列中所有数据包解码后播放的总持续时间(以时间基为单位),用于控制缓存时长 int abort_request;//​​中止请求标志​​。设置为 1 时,表示队列应中止所有操作并准备退出,用于安全快速地停止播放 int serial;//队列序列号​​。用于标识数据包的连续性。在 seek 操作或插入刷新包 (flush_pkt) 后,此序列号会增加,以区分不连续的数据段 SDL_mutex *mutex;SDL_cond *cond;
} PacketQueue;

VideoState

typedef struct VideoState {SDL_Thread *read_tid;const AVInputFormat *iformat;int abort_request;int force_refresh;int paused;int last_paused;int queue_attachments_req;int seek_req;int seek_flags;int64_t seek_pos;int64_t seek_rel;int read_pause_return;AVFormatContext *ic;int realtime;Clock audclk;Clock vidclk;Clock extclk;FrameQueue pictq;FrameQueue subpq;FrameQueue sampq;Decoder auddec;Decoder viddec;Decoder subdec;int audio_stream;int av_sync_type;double audio_clock;int audio_clock_serial;double audio_diff_cum; /* used for AV difference average computation */double audio_diff_avg_coef;double audio_diff_threshold;int audio_diff_avg_count;AVStream *audio_st;PacketQueue audioq;int audio_hw_buf_size;uint8_t *audio_buf;uint8_t *audio_buf1;unsigned int audio_buf_size; /* in bytes */unsigned int audio_buf1_size;int audio_buf_index; /* in bytes */int audio_write_buf_size;int audio_volume;int muted;struct AudioParams audio_src;struct AudioParams audio_filter_src;struct AudioParams audio_tgt;struct SwrContext *swr_ctx;int frame_drops_early;int frame_drops_late;enum ShowMode {SHOW_MODE_NONE = -1, SHOW_MODE_VIDEO = 0, SHOW_MODE_WAVES, SHOW_MODE_RDFT, SHOW_MODE_NB} show_mode;int16_t sample_array[SAMPLE_ARRAY_SIZE];int sample_array_index;int last_i_start;RDFTContext *rdft;int rdft_bits;FFTSample *rdft_data;int xpos;double last_vis_time;SDL_Texture *vis_texture;SDL_Texture *sub_texture;SDL_Texture *vid_texture;int subtitle_stream;AVStream *subtitle_st;PacketQueue subtitleq;double frame_timer;double frame_last_returned_time;double frame_last_filter_delay;int video_stream;AVStream *video_st;PacketQueue videoq;double max_frame_duration;      // maximum duration of a frame - above this, we consider the jump a timestamp discontinuitystruct SwsContext *sub_convert_ctx;int eof;char *filename;int width, height, xleft, ytop;int step;int vfilter_idx;AVFilterContext *in_video_filter;   // the first filter in the video chainAVFilterContext *out_video_filter;  // the last filter in the video chainAVFilterContext *in_audio_filter;   // the first filter in the audio chainAVFilterContext *out_audio_filter;  // the last filter in the audio chainAVFilterGraph *agraph;              // audio filter graphint last_video_stream, last_audio_stream, last_subtitle_stream;SDL_cond *continue_read_thread;
} VideoState;

数据处理流程

http://www.rkmt.cn/news/19168.html

相关文章:

  • FileX和ThreadX精简版
  • ue4素材场景 - MKT
  • 阅读《构建之法》的思考与问题
  • 2025年9月22日优雅草蜻蜓I通讯水银版4.1.9版本正式发布-完成所有服务升级版本重构升级-修复大量漏洞-优化启动步骤-卓伊凡|bigniu|麻子|贝贝| - 指南
  • count down 84 days - 详解
  • AWS自然语言处理技术实战指南
  • 10.12~10.18随笔
  • 面向对象的题目
  • [HZOI] CSP-S模拟29
  • 二三阶行列式
  • CHAR与VARCHAR深度解析:MySQL字符类型选择指南与性能对比
  • vivo霸榜背后:以技术打赢用户保卫战
  • securityCTF 2025 pwn方向题解
  • 02020507 EF Core高级07-悲观并发控制、乐观并发控制、EF Core连接MySQL、RowVersion
  • 完整教程:游标查询在对话历史场景下的独特优势
  • [论文笔记] A Contemporary Survey of Large Language Model Assisted Program Analysis
  • C语言入门教程 | 第一讲:C语言零基础入门教程:第一个代码到变量运算详解
  • 【AI算力架构设计分析】1000PetaOps 算力云计算系统设计方案(大模型训练推理专项版)
  • 未来计划
  • NOIP2023
  • 概率论习题
  • 2025上海经侦律师TOP5榜单:专业法律服务与高效解决方案
  • 概率论部分习题
  • 完整教程:《机器学习与深度学习》入门
  • 「解题报告」蓝桥杯2013省AB 错误票据
  • 时时想起 寸步难行 叩问自己 无人回应 若我离去 若我死去 枯萎于这幽暗的井底 长眠不醒
  • 完整教程:计算机毕业设计免费领源码-教师教学进度管理及建议系统的设计与实现
  • 战略、运营、经营三循环:企业卓越绩效的密码 - 智慧园区
  • tcpdump 使用详解 - 教程
  • 2025农机带实力厂家推荐:浙江三星胶带,品质卓越供货无忧!