码迷,mamicode.com
首页 > 其他好文 > 详细

ijkplayer 阅读笔记01

时间:2015-07-16 19:49:44      阅读:1028      评论:0      收藏:0      [点我收藏+]

标签:

         ijkplayer 一款国人开发的Android 和 iOS 双平台视频播放器,代码风格简洁统一,值得深入学习。简单记录下学习笔记,方便自己以后查询。

     https://github.com/Bilibili/ijkplayer.git

    技术分享   

    ijkplayer基于ffplay实现,简单的描述下解码和显示流程:

(a)创建解码和显示模块

ffpipeline_create_from_ffplay

   IJKFF_Pipeline* pipeline = ffpipeline_alloc(&g_pipeline_class, sizeof(IJKFF_Pipeline_Opaque));

   IJKFF_Pipeline_Opaque *opaque = pipeline->opaque;

   opaque->ffp                   = ffp;

   pipeline->func_destroy            = func_destroy;

   pipeline->func_open_video_decoder = func_open_video_decoder;

   pipeline->func_open_video_output  = func_open_video_output;

   

(b)解码流程

   func_open_video_decoder   

      |-- ffpipenode_create_video_decoder_from_android_mediacodec

      |     func_run_sync

      |       SDL_JNI_SetupThreadEnv  attach thread to JniEnv

      |     enqueue_thread_func 创建线程,从队列获取数据,解码

      |         feed_input_buffer

      |           ffp_packet_queue_get_or_buffering

      |           SDL_AMediaCodec_dequeueInputBuffer

      |           SDL_AMediaCodec_getInputBuffer

      |           copy_size = FFMIN(input_buffer_size, d->pkt_temp.size);

      |           memcpy(input_buffer_ptr, d->pkt_temp.data, copy_size);

      |           SDL_AMediaCodec_queueInputBuffer

      |       drain_output_buffer

      |         drain_output_buffer_l

      |           SDL_AMediaCodec_dequeueOutputBuffer

      |           amc_queue_picture_buffer

      |

      |     ffp_video_thread

      |       ffplay_video_thread

      |         get_video_frame

      |            queue_picture

      |              SDL_VoutFFmpeg_ConvertFrame

      |                 overlay_fill


(c)显示流程

func_open_video_output

      |--ffpipenode_create_video_output_from_android_mediacodec

      |   func_run_sync

      |     ffp_video_refresh_thread     

      |       video_refresh

      |          frame_queue_peek(&is->pictq);

      |          video_display2

      |            video_image_display2

      |               SDL_VoutDisplayYUVOverlay

      |                  vout->display_overlay(vout, overlay);

      |                     voud_display_overlay_l         

      |                      //释放MediaCodec

      |                      case: SDL_VoutOverlayAMediaCodec_releaseFrame

      |                      //nativewindows显示解码视频数据 

      |                      case: SDL_Android_NativeWindow_display_l

      |      AndroidHalFourccDescriptor *voutDesc = native_window_get_desc(curr_format);

      |                            voutDesc->render(&out_buffer, overlay);

      |                                android_render_on_rgb8888

      |                                   android_render_rgb_on_rgb

      |                                      nativewindows显示    

      |          frame_queue_next  


版权声明:本文为博主原创文章,未经博主允许不得转载。

ijkplayer 阅读笔记01

标签:

原文地址:http://blog.csdn.net/peckjerry/article/details/46915037

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!