check for video
This commit is contained in:
parent
76348dbaa9
commit
c7806ff0cc
1 changed files with 7 additions and 1 deletions
|
@ -267,6 +267,7 @@ int extract_frame_ogv(oxstate *state) {
|
||||||
int fps_num = 25;
|
int fps_num = 25;
|
||||||
int fps_denom = 1;
|
int fps_denom = 1;
|
||||||
int granuleshift = 6;
|
int granuleshift = 6;
|
||||||
|
int has_video = 0;
|
||||||
long offset;
|
long offset;
|
||||||
|
|
||||||
OggPlay * player;
|
OggPlay * player;
|
||||||
|
@ -284,13 +285,18 @@ int extract_frame_ogv(oxstate *state) {
|
||||||
if (oggplay_get_track_type (player, i) == OGGZ_CONTENT_THEORA) {
|
if (oggplay_get_track_type (player, i) == OGGZ_CONTENT_THEORA) {
|
||||||
oggplay_set_callback_num_frames (player, i, 1);
|
oggplay_set_callback_num_frames (player, i, 1);
|
||||||
oggplay_get_video_fps(player, i, &fps_denom, &fps_num);
|
oggplay_get_video_fps(player, i, &fps_denom, &fps_num);
|
||||||
|
has_video=1;
|
||||||
}
|
}
|
||||||
oggplay_set_track_active(player, i);
|
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);
|
oggplay_set_data_callback(player, dump_frame_callback, state);
|
||||||
|
|
||||||
offset = 500 + 1000 * ((1 << granuleshift) - 1) * fps_denom / fps_num;
|
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);
|
state->duration = oggplay_get_duration(player);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue