check for video

This commit is contained in:
j 2010-07-28 16:25:06 +02:00
parent 76348dbaa9
commit c7806ff0cc

View file

@ -267,6 +267,7 @@ int extract_frame_ogv(oxstate *state) {
int fps_num = 25;
int fps_denom = 1;
int granuleshift = 6;
int has_video = 0;
long offset;
OggPlay * player;
@ -284,13 +285,18 @@ int extract_frame_ogv(oxstate *state) {
if (oggplay_get_track_type (player, i) == OGGZ_CONTENT_THEORA) {
oggplay_set_callback_num_frames (player, i, 1);
oggplay_get_video_fps(player, i, &fps_denom, &fps_num);
has_video=1;
}
oggplay_set_track_active(player, i);
}
if(!has_video) {
fprintf (stderr, "no video track found\n");
exit (1);
}
oggplay_set_data_callback(player, dump_frame_callback, state);
offset = 500 + 1000 * ((1 << granuleshift) - 1) * fps_denom / fps_num;
fprintf (stderr, "granule: %d offset %ld\n", granuleshift, offset);
//fprintf (stderr, "granule: %d offset %ld\n", granuleshift, offset);
state->duration = oggplay_get_duration(player);