Fplay:cleanup

git-svn-id: svn://kolibrios.org@5592 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2015-07-21 14:28:32 +00:00
parent 1d9f0687b9
commit c63fea095e
3 changed files with 8 additions and 71 deletions

View File

@ -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

View File

@ -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();

View File

@ -11,6 +11,7 @@
#include <math.h>
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[];