struct vpx_rational framerate;
int use_i420;
struct wcap_decoder *wcap;
+ uint32_t output_msecs;
};
static inline int rgb_to_yuv(uint32_t format, uint32_t p, int *u, int *v)
}
else if (file_type == FILE_TYPE_WCAP)
{
- if (!wcap_decoder_get_frame(input->wcap))
- return 0;
+ if (input->wcap->count == 0) {
+ wcap_decoder_get_frame(input->wcap);
+ input->output_msecs = input->wcap->msecs;
+ }
+
+ while (input->output_msecs > input->wcap->msecs)
+ if (!wcap_decoder_get_frame(input->wcap))
+ return 0;
convert_to_yv12(input->wcap, img);
+ input->output_msecs +=
+ input->framerate.den * 1000 / input->framerate.num;
}
else
{
}
-void open_input_file(struct input_state *input)
+void open_input_file(struct input_state *input, struct global_config *global)
{
unsigned int fourcc;
input->file_type = FILE_TYPE_WCAP;
input->w = input->wcap->width;
input->h = input->wcap->height;
- input->framerate.num = 30;
- input->framerate.den = 1;
+ input->framerate = global->framerate;
input->use_i420 = 0;
}
else
{
int frames_in = 0;
- open_input_file(&input);
+ open_input_file(&input, &global);
/* If the input file doesn't specify its w/h (raw files), try to get
* the data from the first stream's configuration.
return 0;
header = decoder->p;
+ decoder->msecs = header->msecs;
+ decoder->count++;
rects = (void *) (header + 1);
decoder->p = (uint32_t *) (rects + header->nrects);
header = decoder->map;
decoder->format = header->format;
+ decoder->count = 0;
decoder->width = header->width;
decoder->height = header->height;
decoder->p = header + 1;