[MPlayer-cvslog] r25603 - in trunk/libmpdemux: demuxer.c demuxer.h

nicodvb subversion at mplayerhq.hu
Sat Jan 5 15:28:57 CET 2008


Author: nicodvb
Date: Sat Jan  5 15:28:57 2008
New Revision: 25603

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

Modified:
   trunk/libmpdemux/demuxer.c
   trunk/libmpdemux/demuxer.h

Modified: trunk/libmpdemux/demuxer.c
==============================================================================
--- trunk/libmpdemux/demuxer.c	(original)
+++ trunk/libmpdemux/demuxer.c	Sat Jan  5 15:28:57 2008
@@ -1287,3 +1287,52 @@ int demuxer_chapter_count(demuxer_t *dem
         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;
+}

Modified: trunk/libmpdemux/demuxer.h
==============================================================================
--- trunk/libmpdemux/demuxer.h	(original)
+++ trunk/libmpdemux/demuxer.h	Sat Jan  5 15:28:57 2008
@@ -397,5 +397,11 @@ char *demuxer_chapter_display_name(demux
 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 */



More information about the MPlayer-cvslog mailing list