Subversion Repositories Kolibri OS

Rev

Rev 5021 | Rev 5603 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5021 Rev 5592
Line 21... Line 21...
21
 
21
 
Line 22... Line 22...
22
uint32_t win_width, win_height;
22
uint32_t win_width, win_height;
Line 23... Line 23...
23
 
23
 
-
 
24
void decoder();
Line 24... Line 25...
24
void decoder();
25
int fplay_init_context(AVCodecContext *avctx);
25
 
26
 
26
AVFormatContext *pFormatCtx;
27
AVFormatContext *pFormatCtx;
27
AVCodecContext  *pCodecCtx;
28
AVCodecContext  *pCodecCtx;
Line 51... Line 52...
51
extern double audio_base;
52
extern double audio_base;
Line 52... Line 53...
52
 
53
 
53
double get_audio_base()
54
double get_audio_base()
54
{
-
 
55
 
55
{
56
  return (double)av_q2d(pFormatCtx->streams[audioStream]->time_base)*1000;
-
 
57
 
56
  return (double)av_q2d(pFormatCtx->streams[audioStream]->time_base)*1000;
Line 58... Line -...
58
};
-
 
59
 
57
};
60
 
58
 
61
 
59
 
62
int main( int argc, char *argv[])
60
int main( int argc, char *argv[])
Line 76... Line 74...
76
    else movie_file = argv[1];
74
    else movie_file = argv[1];
77
 
75
 
Line 78... Line 76...
78
    /* register all codecs, demux and protocols */
76
    /* register all codecs, demux and protocols */
Line 79... Line -...
79
 
-
 
80
#if 0
-
 
81
    {
-
 
82
        int fd, i;
-
 
83
        char *buff;
-
 
84
        uint32_t start, stop;
-
 
85
 
-
 
86
        fd = open(movie_file,O_RDONLY);
-
 
87
 
-
 
88
        if(fd < 0)
-
 
89
            return 0;
-
 
90
 
-
 
91
        buff = user_alloc(65536);
-
 
92
        memset(buff, 0, 65536);
-
 
93
 
-
 
94
        start = get_tick_count();
-
 
95
 
-
 
96
        for(i = 0; i < 1024*1024*1024; i+=65536)
-
 
97
        {
-
 
98
            if(read(fd, buff, 65536) < 0)
-
 
99
                break;
-
 
100
 
-
 
101
        };
-
 
102
        stop = get_tick_count();
-
 
103
 
-
 
104
        printf("average speed %d Kbytes/c\n", ((i/1024)*100)/(stop-start));
-
 
105
    };
-
 
106
    return 0;
-
 
107
};
-
 
108
 
-
 
109
#else
-
 
110
 
77
 
Line 111... Line 78...
111
    av_log_set_level(AV_LOG_FATAL);
78
    av_log_set_level(AV_LOG_FATAL);
112
 
79
 
113
    avcodec_register_all();
80
    avcodec_register_all();
Line 114... Line -...
114
    avdevice_register_all();
-
 
115
    av_register_all();
-
 
116
 
81
    avdevice_register_all();
117
//    init_pixlib(HW_BIT_BLIT|HW_TEX_BLIT);
82
    av_register_all();
118
 
83
 
119
    if( avformat_open_input(&pFormatCtx, movie_file, NULL, NULL) < 0)
84
    if( avformat_open_input(&pFormatCtx, movie_file, NULL, NULL) < 0)
120
    {
85
    {
Line 174... Line 139...
174
        printf("Video stream not detected\n\r");
139
        printf("Video stream not detected\n\r");
175
        return -1; // Didn't find a video stream
140
        return -1; // Didn't find a video stream
176
    };
141
    };
177
 
142
 
Line 178... Line -...
178
#if 0
-
 
179
    {
-
 
180
        AVPacket  packet;
-
 
181
        int psize = 0;
-
 
182
        uint32_t start, stop;
-
 
183
 
-
 
184
        int err;
-
 
185
        start = get_tick_count();
-
 
186
 
-
 
187
        while(psize < 1024*1024*1024)
-
 
188
        {
-
 
189
            err = av_read_frame(pFormatCtx, &packet);
-
 
190
            if(err != 0)
-
 
191
                break;
-
 
192
            psize+= packet.size;
-
 
193
            av_free_packet(&packet);
-
 
194
        };
-
 
195
 
-
 
196
        stop = get_tick_count();
-
 
197
 
-
 
198
        printf("average speed %d Kbytes/c\n", ((psize/1024)*100)/(stop-start));
-
 
199
 
-
 
200
        return 1;
-
 
201
    };
-
 
202
};
-
 
203
#else
-
 
204
 
-
 
205
 
-
 
206
  //   __asm__ __volatile__("int3");
143
  //   __asm__ __volatile__("int3");
Line 207... Line 144...
207
 
144
 
208
    // Get a pointer to the codec context for the video stream
145
    // Get a pointer to the codec context for the video stream
209
    pCodecCtx=pFormatCtx->streams[videoStream]->codec;
146
    pCodecCtx = pFormatCtx->streams[videoStream]->codec;
Line 210... Line 147...
210
    aCodecCtx=pFormatCtx->streams[audioStream]->codec;
147
    aCodecCtx = pFormatCtx->streams[audioStream]->codec;
Line 211... Line -...
211
 
-
 
Line 212... Line 148...
212
  // Find the decoder for the video stream
148
 
Line 213... Line 149...
213
 
149
  // Find the decoder for the video stream
Line 378... Line 314...
378
    int       ret, vret, aret;
314
    int       ret, vret, aret;
379
 
315
 
Line 380... Line 316...
380
    int64_t   min_pos, max_pos;
316
    int64_t   min_pos, max_pos;
Line -... Line 317...
-
 
317
 
-
 
318
//    av_log_set_level(AV_LOG_DEBUG);
381
 
319
 
382
    while( player_state != CLOSED )
320
    while( player_state != CLOSED )
383
    {
321
    {
Line 384... Line 322...
384
        int err;
322
        int err;
Line 503... Line 441...
503
    delay(50);
441
    delay(50);
504
    player_state = CLOSED;
442
    player_state = CLOSED;
505
    delay(300);
443
    delay(300);
506
};
444
};
507
#endif
445
>
508
#endif
-
 
509
>
446