[MPlayer-cvslog] r36136 - in trunk: Changelog DOCS/man/en/mplayer.1 mplayer.c

reimar subversion at mplayerhq.hu
Wed Apr 3 13:52:42 CEST 2013


Author: reimar
Date: Wed Apr  3 13:52:42 2013
New Revision: 36136

Log:
Add limited -endpos support when dumping.

In theory this should even make -endpos with a time work with -dumpstream of
DVDs but I could not test it - testers very welcome!

Modified:
   trunk/Changelog
   trunk/mplayer.c

Changes in other areas also in this revision:
Modified:
   trunk/DOCS/man/en/mplayer.1

Modified: trunk/Changelog
==============================================================================
--- trunk/Changelog	Wed Apr  3 11:40:30 2013	(r36135)
+++ trunk/Changelog	Wed Apr  3 13:52:42 2013	(r36136)
@@ -14,6 +14,7 @@ MPlayer
     * Fixes for DVB, teletext and closed-caption based subtitles.
     * Support teletext and CC subtitles in WTV.
     * Support binding keys corresponding to non-ASCII characters.
+    * Limited -endpos support for -dump*
 
     Ports:
     * Windows: support file names as UTF-8 in slave mode and passing

Modified: trunk/mplayer.c
==============================================================================
--- trunk/mplayer.c	Wed Apr  3 11:40:30 2013	(r36135)
+++ trunk/mplayer.c	Wed Apr  3 13:52:42 2013	(r36136)
@@ -1750,7 +1750,7 @@ double playing_audio_pts(sh_audio_t *sh_
 static int is_at_end(MPContext *mpctx, m_time_size_t *end_at, double pts)
 {
     switch (end_at->type) {
-    case END_AT_TIME: return end_at->pos <= pts;
+    case END_AT_TIME: return pts != MP_NOPTS_VALUE && end_at->pos <= pts;
     case END_AT_SIZE: return end_at->pos <= stream_tell(mpctx->stream);
     }
     return 0;
@@ -3269,6 +3269,11 @@ play_next_file:
         }
         stream_dump_progress_start();
         while (!mpctx->stream->eof && !async_quit_request) {
+            double pts;
+            if (stream_control(mpctx->stream, STREAM_CTRL_GET_CURRENT_TIME, &pts) != STREAM_OK)
+                pts = MP_NOPTS_VALUE;
+            if (is_at_end(mpctx, &end_at, pts))
+                break;
             len = stream_read(mpctx->stream, buf, 4096);
             if (len > 0) {
                 if (fwrite(buf, len, 1, f) != 1) {
@@ -3473,7 +3478,10 @@ goto_enable_cache:
         stream_dump_progress_start();
         while (!ds->eof) {
             unsigned char *start;
-            int in_size = ds_get_packet(ds, &start);
+            double pts;
+            int in_size = ds_get_packet_pts(ds, &start, &pts);
+            if (is_at_end(mpctx, &end_at, pts))
+                break;
             if ((mpctx->demuxer->file_format == DEMUXER_TYPE_AVI || mpctx->demuxer->file_format == DEMUXER_TYPE_ASF || mpctx->demuxer->file_format == DEMUXER_TYPE_MOV)
                 && stream_dump_type == 2)
                 fwrite(&in_size, 1, 4, f);


More information about the MPlayer-cvslog mailing list