From c63fea095e9663646badfec81c9604fa3733f2cf Mon Sep 17 00:00:00 2001 From: "Sergey Semyonov (Serge)" Date: Tue, 21 Jul 2015 14:28:32 +0000 Subject: [PATCH] Fplay:cleanup git-svn-id: svn://kolibrios.org@5592 a494cfbc-eb01-0410-851d-a64ba20cac60 --- contrib/media/fplay/fplay.c | 75 +++---------------------------------- contrib/media/fplay/fplay.h | 3 +- contrib/media/fplay/video.c | 1 + 3 files changed, 8 insertions(+), 71 deletions(-) diff --git a/contrib/media/fplay/fplay.c b/contrib/media/fplay/fplay.c index 8f6039dd3a..88d53e7697 100644 --- a/contrib/media/fplay/fplay.c +++ b/contrib/media/fplay/fplay.c @@ -23,6 +23,7 @@ volatile enum player_state sound_state = STOP; uint32_t win_width, win_height; void decoder(); +int fplay_init_context(AVCodecContext *avctx); AVFormatContext *pFormatCtx; AVCodecContext *pCodecCtx; @@ -53,13 +54,10 @@ extern double audio_base; double get_audio_base() { - return (double)av_q2d(pFormatCtx->streams[audioStream]->time_base)*1000; - }; - int main( int argc, char *argv[]) { int i; @@ -78,45 +76,12 @@ int main( int argc, char *argv[]) /* register all codecs, demux and protocols */ -#if 0 - { - int fd, i; - char *buff; - uint32_t start, stop; - - fd = open(movie_file,O_RDONLY); - - if(fd < 0) - return 0; - - buff = user_alloc(65536); - memset(buff, 0, 65536); - - start = get_tick_count(); - - for(i = 0; i < 1024*1024*1024; i+=65536) - { - if(read(fd, buff, 65536) < 0) - break; - - }; - stop = get_tick_count(); - - printf("average speed %d Kbytes/c\n", ((i/1024)*100)/(stop-start)); - }; - return 0; -}; - -#else - av_log_set_level(AV_LOG_FATAL); avcodec_register_all(); avdevice_register_all(); av_register_all(); -// init_pixlib(HW_BIT_BLIT|HW_TEX_BLIT); - if( avformat_open_input(&pFormatCtx, movie_file, NULL, NULL) < 0) { printf("Cannot open file %s\n\r", movie_file); @@ -176,43 +141,14 @@ int main( int argc, char *argv[]) return -1; // Didn't find a video stream }; -#if 0 - { - AVPacket packet; - int psize = 0; - uint32_t start, stop; - - int err; - start = get_tick_count(); - - while(psize < 1024*1024*1024) - { - err = av_read_frame(pFormatCtx, &packet); - if(err != 0) - break; - psize+= packet.size; - av_free_packet(&packet); - }; - - stop = get_tick_count(); - - printf("average speed %d Kbytes/c\n", ((psize/1024)*100)/(stop-start)); - - return 1; - }; -}; -#else - - // __asm__ __volatile__("int3"); // Get a pointer to the codec context for the video stream - pCodecCtx=pFormatCtx->streams[videoStream]->codec; - aCodecCtx=pFormatCtx->streams[audioStream]->codec; + pCodecCtx = pFormatCtx->streams[videoStream]->codec; + aCodecCtx = pFormatCtx->streams[audioStream]->codec; // Find the decoder for the video stream -// init_hw_context(pCodecCtx); pCodec=avcodec_find_decoder(pCodecCtx->codec_id); @@ -380,6 +316,8 @@ void decoder() int64_t min_pos, max_pos; +// av_log_set_level(AV_LOG_DEBUG); + while( player_state != CLOSED ) { int err; @@ -505,5 +443,4 @@ void decoder() player_state = CLOSED; delay(300); }; -#endif -#endif + diff --git a/contrib/media/fplay/fplay.h b/contrib/media/fplay/fplay.h index ffb262dff2..98faa22310 100644 --- a/contrib/media/fplay/fplay.h +++ b/contrib/media/fplay/fplay.h @@ -134,8 +134,7 @@ static inline void GetNotify(void *event) ::"a"(68),"b"(14),"c"(event)); } - +int fplay_vaapi_init(void); int init_fontlib(); -//int draw_text_ext(void *pixmap, uint32_t pitch, FT_Face face, char *text, rect_t *rc, int color); char *get_moviefile(); diff --git a/contrib/media/fplay/video.c b/contrib/media/fplay/video.c index f8c58e8542..9b087555ce 100644 --- a/contrib/media/fplay/video.c +++ b/contrib/media/fplay/video.c @@ -11,6 +11,7 @@ #include int fplay_blit_bitmap(bitmap_t *bitmap, int dst_x, int dst_y,int w, int h); +void draw_va_picture(render_t *render, AVPicture *picture); extern int res_pause_btn[]; extern int res_pause_btn_pressed[];