Browse code

frame stepping patch by (Wolfgang Hesseler <qv at multimediaware dot com>)

Originally committed as revision 2632 to svn://svn.ffmpeg.org/ffmpeg/trunk

Wolfgang Hesseler authored on 2003/12/28 10:19:41
Showing 1 changed files
... ...
@@ -166,6 +166,7 @@ static int show_status;
166 166
 static int av_sync_type = AV_SYNC_AUDIO_MASTER;
167 167
 static int64_t start_time = AV_NOPTS_VALUE;
168 168
 static int debug = 0;
169
+static int step = 0;
169 170
 
170 171
 /* current context */
171 172
 static int is_full_screen;
... ...
@@ -919,6 +920,9 @@ static int video_thread(void *arg)
919 919
             }
920 920
         }
921 921
         av_free_packet(pkt);
922
+        if (step) 
923
+            if (cur_stream)
924
+                stream_pause(cur_stream);
922 925
     }
923 926
  the_end:
924 927
     av_free(frame);
... ...
@@ -1584,6 +1588,17 @@ void toggle_pause(void)
1584 1584
 {
1585 1585
     if (cur_stream)
1586 1586
         stream_pause(cur_stream);
1587
+    step = 0;
1588
+}
1589
+
1590
+void step_to_next_frame(void)
1591
+{
1592
+    if (cur_stream) {
1593
+        if (cur_stream->paused)
1594
+            cur_stream->paused=0;
1595
+        cur_stream->video_current_pts = get_video_clock(cur_stream);
1596
+    }
1597
+    step = 1;
1587 1598
 }
1588 1599
 
1589 1600
 void do_exit(void)
... ...
@@ -1627,6 +1642,9 @@ void event_loop(void)
1627 1627
             case SDLK_SPACE:
1628 1628
                 toggle_pause();
1629 1629
                 break;
1630
+            case SDLK_s: //S: Step to next frame
1631
+                step_to_next_frame();
1632
+                break;
1630 1633
             case SDLK_a:
1631 1634
                 if (cur_stream) 
1632 1635
                     stream_cycle_channel(cur_stream, CODEC_TYPE_AUDIO);