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

ijkplayer阅读笔记01

时间:2015-08-14 19:22:17      阅读:1215      评论:0      收藏:0      [点我收藏+]

标签:

                                                                        ijkplayer阅读笔记01

1.这章解决ijkplayer播放库初始化部分,直接贴上流程伪代码如下:

IjkMediaPlayer_native_setup
{
   ijkmp_android_create(message_loop){
      mp->ffplayer->vout = SDL_VoutAndroid_CreateForAndroidSurface();{
        SDL_VoutAndroid_CreateForANativeWindow();{
           vout->create_overlay  = vout_create_overlay;{
              SDL_VoutAMediaCodec_CreateOverlay; or SDL_VoutFFmpeg_CreateOverlay;
           }
        }
        vout->display_overlay = voud_display_overlay;{
           SDL_VoutOverlayAMediaCodec_releaseFrame(overlay, NULL, true);
           Or SDL_Android_NativeWindow_display_l(native_window, overlay);
        }
      }
      mp->ffplayer->aout = SDL_AoutAndroid_CreateForAudioTrack();{
         aout->open_audio   = aout_open_audio;{
            aout_open_audio_n{
               SDL_CreateThreadEx(&opaque->_audio_tid, aout_thread);{
                  aout_thread_n{
                     while (!opaque->abort_request) {
                        audio_cblk(userdata, buffer, copy_size);{
                           sdl_audio_callback(void *opaque, Uint8 *stream, int len){
                              while (len > 0) {
                                 audio_size = audio_decode_frame(ffp);{
                                   af = frame_queue_peek_readable(&is->sampq)
                                   is->audio_buf = af->frame->data[0];
                                 }
                                 memcpy(stream, (uint8_t *)is->audio_buf + is->audio_buf_index, len1);
                               }
                           }
                        }
                     }
                  }
               }
            }
         }
      }
      mp->ffplayer->pipeline = ffpipeline_create_from_android(mp->ffplayer);{
         pipeline->func_destroy            = func_destroy;
         pipeline->func_open_video_decoder = func_open_video_decoder;
         {  
             if (opaque->mediacodec_enabled)
                node = ffpipenode_create_video_decoder_from_android_mediacodec(ffp);{
                   func_run_sync{
                      SDL_CreateThreadEx(enqueue_thread_func){
                          while (!q->abort_request) {
                             feed_input_buffer{ 
                                ffp_packet_queue_get_or_buffering
                                SDL_AMediaCodec_dequeueInputBuffer
                                input_buffer_ptr = SDL_AMediaCodec_getInputBuffer
                                memcpy(input_buffer_ptr, d->pkt_temp.data, copy_size);
                               SDL_AMediaCodec_queueInputBuffer
                             }
                          }
                      }
                      while{
                         drain_output_buffer
                      }
                   }
                }
             if (!node)
                 node = ffpipenode_create_video_decoder_from_ffplay(ffp);
                 {
                     func_run_sync{
                         ffp_video_thread(opaque->ffp);{
                            for (;;) {
                                get_video_frame(ffp, frame);
                                queue_picture
                            }
                         }
                     } 
                 }
          }
          pipeline->func_open_video_output  = func_open_video_output;{
             ffpipenode_create_video_output_from_android_mediacodec(ffp);
             node->func_run_sync = func_run_sync;{
                 ffp_video_refresh_thread(opaque->ffp);
             }
          }
      }
      ffpipeline_set_vout(mp->ffplayer->pipeline, mp->ffplayer->vout);
   }
   jni_set_media_player
}


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

ijkplayer阅读笔记01

标签:

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

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