mplayer 源码分析(9月11日).pptx

上传人:摩西的****12 文档编号:144950795 上传时间:2020-09-14 格式:PPTX 页数:9 大小:332.58KB
返回 下载 相关 举报
mplayer 源码分析(9月11日).pptx_第1页
第1页 / 共9页
mplayer 源码分析(9月11日).pptx_第2页
第2页 / 共9页
mplayer 源码分析(9月11日).pptx_第3页
第3页 / 共9页
mplayer 源码分析(9月11日).pptx_第4页
第4页 / 共9页
mplayer 源码分析(9月11日).pptx_第5页
第5页 / 共9页
点击查看更多>>
资源描述

《mplayer 源码分析(9月11日).pptx》由会员分享,可在线阅读,更多相关《mplayer 源码分析(9月11日).pptx(9页珍藏版)》请在金锄头文库上搜索。

1、学 海 无 涯 一.Mplayer 支持的格式 MPlayer 是一个LINUX 下的视频播放器,它支持相当多的媒体格式,无论在音频播放还是 在视频播放方面,可以说它支持的格式是相当全面的。 视频格式支持:MPEG、AVI、ASF 与WMV、QuickTime 与 OGG/OGM、SDP、PVA、 GIF。 音频格式支持:MP3、WAV、OGG/OGM 文件(Vorbis)、WMA 与 ASF、MP4、CD 音 频、XMMS。 二. Mplayer 中头文件的功能分析 1. config.h / 各种本地配置宏定义头,2. version.h / 版本定义头 #define VERSION 1

2、.0pre7try2-3.4.2,3. mp_msg.h / 消息处理头,4. help_mp.h / 根据配置自动生成的帮助头 #include help/help_mpen.h,5. cfg-mplayer-def.h / Mplayer 运行时的选项缺省值头文件 char*,6. default_config =,7. sub_reader.h / 拥有格式自动发现功能的字幕(subtitle)阅读器,8. libvo/video_out.h / 该文件包含 libvo 视频输出的公共函数、变量,9. libvo/font_load.h / 有关字体装载的例程,10. libao2/au

3、dio_out.h / 音频输出驱动程序相关结构定义和全局数据,11. libmpcodecs/dec_audio.h / 音频解码,12. libmpcodecs/dec_video.h / 视频解码,13. libmpdemux/matroska.h / 多路解复用,媒体容器格式 matroska 处理头,14. libmpdemux/stream.h / 流处理,15. libmpdemux/demuxer.h / 多路解复用头文件,16. libmpdemux/stheader.h / 媒体流头处理,17. get_path.c / 路径获取头文件,18. spudec.h / SPU

4、 子画面单元头,DVD 字幕流,19. edl.h / 剪辑控制清单,20. m_option.h / 选项类型处理头,21. m_config.h / 配置处理头文件,三. MPlayer.main 主流程简要说明,1. int main() ,1,2. 1) 变量声明,电影信息 movie info:,3. 2) 初始化,消息系统,4. play_next_file:,5. 3)播放文件 filename 的循环 goto play_next_file 开始,学 海 无 涯,6. main:,7. 4) 主处理 main,8. 5) 播放真正主循环 2010 3541 while (!eo

5、f),9. while (!eof) ,10. 5.1) 播放音频 PLAY AUDIO 2017 2064 decode_audio(sh_audio, .);,11. 5.2) 播放视频 PLAY VIDEO, 2068 2300 decode_video(sh_video, .);,12. 5.3) 处理暂停 PAUSE,13. 5.4) 处理 EDL,14. 5.5) 键盘事件处理, 搜索 24003216 while (!brk_cmd ,2. m_config_register_options(mconfig,mplayer_opts);,3. / TODO : add somet

6、hing to let modules register their options,4. mp_input_register_options(mconfig);,5. parse_cfgfiles(mconfig); 初始化 mpctx 结构体,mpctx 应该是mplayer context 的意思,顾名思义是一个统筹全局 的变量。 cpp view plaincopy 1. static MPContext *mpctx = ,2. / Not all functions in mplayer.c take the context as an argument yet,3. static

7、 MPContext mpctx_s = ,4. .osd_function = OSD_PLAY,5. .begin_skip = MP_NOPTS_VALUE,6. .play_tree_step = 1,7. .global_sub_pos = -1,2,学 海 无 涯,8. .set_of_sub_pos = -1,9. .file_format = DEMUXER_TYPE_UNKNOWN,10. .loop_times = -1,11. #ifdef HAS_DVBIN_SUPPORT,12. .last_dvb_step = 1,13. #endif,14. ;,原型,1. /真

8、正统筹全局的结构,3,2. typedef struct MPContext ,3.int osd_show_percentage;,4.int osd_function;,5.const ao_functions_t *audio_out;,6.play_tree_t *playtree;,7.play_tree_iter_t *playtree_iter;,8.int eof;,9.int play_tree_step;,10.int loop_times;,11.,12.stream_t *stream;,13.demuxer_t *demuxer;,14.sh_audio_t *sh_

9、audio;,15.sh_video_t *sh_video;,16.demux_stream_t *d_audio;,17.demux_stream_t *d_video;,18.demux_stream_t *d_sub;,19.mixer_t mixer;,20.const vo_functions_t *video_out;,21./ Frames buffered in the vo ready to flip. Currently always 0 or 1.,22./ This is really a vo variable but currently theres no sui

10、table vo,23./ struct.,24.int num_buffered_frames;,25.,26./ used to retry decoding after startup/seeking to compensate for codec delay,27.int startup_decode_retry;,28./ how long until we need to display the current frame,29.float time_frame;,30.,31./ AV sync: the next frame should be shown when the a

11、udio out has this,32./ much (in seconds) buffered data left. Increased when more data is,学 海 无 涯 33./ written to the ao, decreased when moving to the next frame.,34./ In the audio-only case used as a timer since the last seek,35./ by the audio CPU usage meter.,36.double delay;,37. float begin_skip;

12、/ start time of the current skip while on edlout mo de / audio is muted if either EDL or user activates mute,4,40.short edl_muted; / Stores whether EDL is currently in muted mode.,41.short user_muted; / Stores whether user wanted muted mode.,42.,43.int global_sub_size; / this encompasses all subtitl

13、e sources,44.int global_sub_pos; / this encompasses all subtitle sources,45.int set_of_sub_pos;,46.int set_of_sub_size;,47.int sub_countsSUB_SOURCES;,48. #ifdef CONFIG_ASS,49./ set_of_ass_tracksi contains subtitles from set_of_subtitlesi,50./ parsed by libass or NULL if format unsupported,51.ASS_Tra

14、ck* set_of_ass_tracksMAX_SUBTITLE_FILES;,52. #endif,53.sub_data* set_of_subtitlesMAX_SUBTITLE_FILES;,54.,55.int file_format;,56.,57. #ifdef CONFIG_DVBIN,58.int last_dvb_step;,59.int dvbin_reopen;,60. #endif,61.,62.int was_paused;,63.,64. #ifdef CONFIG_DVDNAV,65.struct mp_image *nav_smpi;/ last decod

15、ed dvdnav video image,66.unsigned char *nav_buffer;/ last read dvdnav video frame,67.unsigned char *nav_start;/ pointer to last read video buffer,68.intnav_in_size; / last read size,69. #endif,70. MPContext;,学 海 无 涯 一些 GUI 相关的操作 打开字幕流 打开音视频流 1. mpctx-stream=open_stream(filename,0,2. fileformat 文件还是

16、TV 流DEMUXER_TYPE_PLAYLIST 或DEMUXER_TYPE_UNKNOWN,3. DEMUXER_TYPE_TV,4. current_module 记录状态vobsub open_stream handle_playlist dumpstream,5. stream_reset(mpctx-stream);,6. stream_seek(mpctx-stream,mpctx-stream-start_pos);,7. f=fopen(stream_dump_name,”wb”); dump 文件流,8. stream-type=STREAMTYPE_DVD,/= Open DEMUXERS DETECT file type = Demux。分离视频流和音频流 1. mpctx-demuxer=demux_open(mpctx-stream,m

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 高等教育 > 其它相关文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号