tv.tv_usec = 0;
n = select(1, &rfds, NULL, NULL, &tv);
if (n > 0) {
- if (read(0, &ch, 1) == 1)
+ n = read(0, &ch, 1);
+ if (n == 1)
return ch;
+
+ return n;
}
return -1;
}
static int read_key(void)
{
- return -1;
+ return 0;
}
#endif
int n1, n2, nb, i, ret, frame_number, dec_frame_rate;
AVPicture *picture, *picture2, *pict;
AVPicture picture_tmp1, picture_tmp2;
- UINT8 *video_buffer;
+ static UINT8 *video_buffer;
UINT8 *buf = NULL, *buf1 = NULL;
AVCodecContext *enc, *dec;
if (nb <= 0)
return;
- video_buffer= av_malloc(VIDEO_BUFFER_SIZE);
+ if (!video_buffer)
+ video_buffer= av_malloc(VIDEO_BUFFER_SIZE);
if(!video_buffer) return;
/* deinterlace : must be done before any resize */
the_end:
av_free(buf);
av_free(buf1);
- av_free(video_buffer);
}
static void do_video_stats(AVOutputStream *ost,
INT64 min_pts, start_time;
AVInputFile *file_table;
AVFormatContext *stream_no_data;
+ int key;
file_table= (AVInputFile*) av_mallocz(nb_input_files * sizeof(AVInputFile));
if (!file_table)
start_time = gettime();
min_pts = 0;
stream_no_data = 0;
+ key = -1;
for(;;) {
int file_index, ist_index;
redo:
/* if 'q' pressed, exits */
- if (read_key() == 'q')
- break;
+ if (key) {
+ /* read_key() returns 0 on EOF */
+ key = read_key();
+ if (key == 'q')
+ break;
+ }
/* select the input file with the smallest pts */
file_index = -1;