1
mirror of https://github.com/mpv-player/mpv synced 2024-12-24 07:33:46 +01:00

wrapper functions to get/set angle: the wrapping is needed to RESYNC the demuxer; patch by oattila chello hu

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25603 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
nicodvb 2008-01-05 14:28:57 +00:00
parent 4af051b6c3
commit a913d90614
2 changed files with 55 additions and 0 deletions

View File

@ -1287,3 +1287,52 @@ int demuxer_chapter_count(demuxer_t *demuxer) {
return demuxer->num_chapters;
}
int demuxer_angles_count(demuxer_t *demuxer) {
int ris, angles=-1;
ris = stream_control(demuxer->stream, STREAM_CTRL_GET_NUM_ANGLES, &angles);
if(ris == STREAM_UNSUPPORTED) return -1;
return angles;
}
int demuxer_get_current_angle(demuxer_t *demuxer) {
int ris, curr_angle=-1;
ris = stream_control(demuxer->stream, STREAM_CTRL_GET_ANGLE, &curr_angle);
if(ris == STREAM_UNSUPPORTED) return -1;
return curr_angle;
}
int demuxer_set_angle(demuxer_t *demuxer, int angle) {
int ris, angles=-1;
sh_video_t *sh_video = demuxer->video->sh;
sh_audio_t *sh_audio = demuxer->audio->sh;
angles = demuxer_angles_count(demuxer);
if((angles < 1) || (angle > angles)) return -1;
if(demuxer->video->sh)
ds_free_packs(demuxer->video);
if(demuxer->audio->sh)
ds_free_packs(demuxer->audio);
if(demuxer->sub->id >= 0)
ds_free_packs(demuxer->sub);
ris = stream_control(demuxer->stream, STREAM_CTRL_SET_ANGLE, &angle);
if(ris == STREAM_UNSUPPORTED) return -1;
demux_control(demuxer, DEMUXER_CTRL_RESYNC, NULL);
if(sh_video) {
ds_fill_buffer(demuxer->video);
resync_video_stream(sh_video);
}
if(sh_audio) {
ds_fill_buffer(demuxer->audio);
resync_audio_stream(sh_audio);
}
return angle;
}

View File

@ -397,5 +397,11 @@ char *demuxer_chapter_display_name(demuxer_t *demuxer, int chapter);
float demuxer_chapter_time(demuxer_t *demuxer, int chapter, float *end);
/// Get total chapter number.
int demuxer_chapter_count(demuxer_t *demuxer);
/// Get current angle index.
int demuxer_get_current_angle(demuxer_t *demuxer);
/// Set angle.
int demuxer_set_angle(demuxer_t *demuxer, int angle);
/// Get number of angles.
int demuxer_angles_count(demuxer_t *demuxer);
#endif /* DEMUXER_H */