[PATCH] Add size based support for -endpos in MPlayer

Clément Bœsch ubitux at gmail.com
Sat Dec 25 16:50:38 CET 2010


---
 DOCS/man/en/mplayer.1 |    3 +--
 help/help_mp-cs.h     |    1 -
 help/help_mp-de.h     |    1 -
 help/help_mp-en.h     |    1 -
 help/help_mp-es.h     |    1 -
 help/help_mp-fr.h     |    1 -
 help/help_mp-hu.h     |    1 -
 help/help_mp-it.h     |    1 -
 help/help_mp-pl.h     |    1 -
 help/help_mp-ru.h     |    1 -
 help/help_mp-tr.h     |    1 -
 help/help_mp-uk.h     |    1 -
 help/help_mp-zh_CN.h  |    1 -
 help/help_mp-zh_TW.h  |    1 -
 mplayer.c             |   15 +++++----------
 15 files changed, 6 insertions(+), 25 deletions(-)

diff --git a/DOCS/man/en/mplayer.1 b/DOCS/man/en/mplayer.1
index 71d234c..966d3dd 100644
--- a/DOCS/man/en/mplayer.1
+++ b/DOCS/man/en/mplayer.1
@@ -1552,8 +1552,7 @@ on how to use this.
 Stop at given time or byte position.
 .br
 .I NOTE:
-Byte position is enabled only for MEncoder and will not be accurate, as it can
-only stop at a frame boundary.
+Byte position may not be accurate, as it can only stop at a frame boundary.
 When used in conjunction with \-ss option, \-endpos time will shift forward by
 seconds specified with \-ss.
 .sp 1
diff --git a/help/help_mp-cs.h b/help/help_mp-cs.h
index 5bb2197..72a6c8a 100644
--- a/help/help_mp-cs.h
+++ b/help/help_mp-cs.h
@@ -190,7 +190,6 @@ static const char help_text[]=
 #define MSGTR_EdloutBadStop "EDL: Vynechání zrušeno, poslední start > stop\n"
 #define MSGTR_EdloutStartSkip "EDL: Začátek vynechaného bloku, stiskněte znovu 'i' pro ukončení bloku.\n"
 #define MSGTR_EdloutEndSkip "EDL: Konec vynechaného bloku, řádek zapsán.\n"
-#define MSGTR_MPEndposNoSizeBased "Volba -endpos v MPlayeru zatím nepodporuje rozměrové jednotky.\n"
 
 // mplayer.c OSD
 #define MSGTR_OSDenabled "zapnuto"
diff --git a/help/help_mp-de.h b/help/help_mp-de.h
index 4ea1674..f0bd108 100644
--- a/help/help_mp-de.h
+++ b/help/help_mp-de.h
@@ -207,7 +207,6 @@ static const char help_text[]=
 #define MSGTR_EdloutBadStop "EDL-Sprung abgebrochen, letzter Start > Stop\n"
 #define MSGTR_EdloutStartSkip "EDL-Sprung begonnen, drücke 'i' erneut, um den Block zu beenden.\n"
 #define MSGTR_EdloutEndSkip "EDL-Sprung beendet, Zeile geschrieben.\n"
-#define MSGTR_MPEndposNoSizeBased "Die Option -endpos unterstützt für MPlayer noch keine Größenangaben.\n"
 
 // mplayer.c OSD
 #define MSGTR_OSDenabled "aktiviert"
diff --git a/help/help_mp-en.h b/help/help_mp-en.h
index c3a7fa7..93d861f 100644
--- a/help/help_mp-en.h
+++ b/help/help_mp-en.h
@@ -199,7 +199,6 @@ static const char help_text[]=
 #define MSGTR_EdloutBadStop "EDL skip canceled, last start > stop\n"
 #define MSGTR_EdloutStartSkip "EDL skip start, press 'i' again to end block.\n"
 #define MSGTR_EdloutEndSkip "EDL skip end, line written.\n"
-#define MSGTR_MPEndposNoSizeBased "Option -endpos in MPlayer does not yet support size units.\n"
 
 // mplayer.c OSD
 #define MSGTR_OSDenabled "enabled"
diff --git a/help/help_mp-es.h b/help/help_mp-es.h
index 3809664..73bd13c 100644
--- a/help/help_mp-es.h
+++ b/help/help_mp-es.h
@@ -206,7 +206,6 @@ static const char help_text[]=
 #define MSGTR_EdloutBadStop "EDL skip cancelado, último comienzo > parada\n"
 #define MSGTR_EdloutStartSkip "EDL skip comenzado, presione 'i' denuevo para terminar con el bloque.\n"
 #define MSGTR_EdloutEndSkip "EDL skip terminado, operación guardada.\n"
-#define MSGTR_MPEndposNoSizeBased "La opción -endpos en MPlayer aun no soporta unidades de tamaño.\n"
 
 // mplayer.c OSD
 #define MSGTR_OSDenabled "habilitado"
diff --git a/help/help_mp-fr.h b/help/help_mp-fr.h
index bea92ad..5a58561 100644
--- a/help/help_mp-fr.h
+++ b/help/help_mp-fr.h
@@ -194,7 +194,6 @@ static const char help_text[]=
 #define MSGTR_EdloutBadStop "Saut EDL annulé, dernier début > arrêt\n"
 #define MSGTR_EdloutStartSkip "EDL saute le début, presse 'i' encore une fois pour fin du bloc.\n"
 #define MSGTR_EdloutEndSkip "EDL saute la fin, ligne écrite.\n"
-#define MSGTR_MPEndposNoSizeBased "Option -endpos dans MPlayer ne supporte pas encore les unités de taille.\n"
 
 
 // mplayer.c OSD
diff --git a/help/help_mp-hu.h b/help/help_mp-hu.h
index 6e8c440..6c071ca 100644
--- a/help/help_mp-hu.h
+++ b/help/help_mp-hu.h
@@ -199,7 +199,6 @@ static const char help_text[]=
 #define MSGTR_EdloutBadStop "EDL skip visszavonva, az utolsó start > stop\n"
 #define MSGTR_EdloutStartSkip "EDL skip eleje, nyomd meg az 'i'-t a blokk befejezéséhez.\n"
 #define MSGTR_EdloutEndSkip "EDL skip vége, a sor kiírva.\n"
-#define MSGTR_MPEndposNoSizeBased "Az MPlayer -endpos opciója jelenleg még nem támogatja a méretbeli megadást.\n"
 
 // mplayer.c OSD
 #define MSGTR_OSDenabled "bekapcsolva"
diff --git a/help/help_mp-it.h b/help/help_mp-it.h
index 9b51b77..989ea85 100644
--- a/help/help_mp-it.h
+++ b/help/help_mp-it.h
@@ -197,7 +197,6 @@ static const char help_text[]=
 #define MSGTR_EdloutBadStop "Salto EDL ingnorato, ultimo start > stop\n"
 #define MSGTR_EdloutStartSkip "Tempo di start EDL impostato, ripremere 'i' per impostare lo stop.\n"
 #define MSGTR_EdloutEndSkip "Fine del blocco EDL, riga scritta.\n"
-#define MSGTR_MPEndposNoSizeBased "L'opzione -endpos in MPlayer non supporta ancora unità di mis. di dimensione.\n"
 
 // mplayer.c OSD
 #define MSGTR_OSDenabled "abilitat"
diff --git a/help/help_mp-pl.h b/help/help_mp-pl.h
index f7f53d9..95fe350 100644
--- a/help/help_mp-pl.h
+++ b/help/help_mp-pl.h
@@ -189,7 +189,6 @@ static const char help_text[]=
 #define MSGTR_EdloutBadStop "Pominięcie EDL odwołane, ostatni start > stop\n"
 #define MSGTR_EdloutStartSkip "Pominięcie EDL rozpoczęte, wciśnij ponownie 'i' by zakończyć blok.\n"
 #define MSGTR_EdloutEndSkip "Pominięcie EDL zakończone, wiersz zapisany.\n"
-#define MSGTR_MPEndposNoSizeBased "Opcja MPlayer -endpos nie obsługuje jeszcze jednostek rozmiaru.\n"
 
 // mplayer.c OSD
 
diff --git a/help/help_mp-ru.h b/help/help_mp-ru.h
index 4afb3f7..23e27b2 100644
--- a/help/help_mp-ru.h
+++ b/help/help_mp-ru.h
@@ -191,7 +191,6 @@ static const char help_text[]=
 #define MSGTR_EdloutBadStop "EDL пропуск отменён, последний start > stop\n"
 #define MSGTR_EdloutStartSkip "Начало EDL пропуска, нажмите 'i' ещё раз для завершения блока.\n"
 #define MSGTR_EdloutEndSkip "Конец EDL пропуска, строка записана.\n"
-#define MSGTR_MPEndposNoSizeBased "В MPlayer опция -endpos пока не поддерживает единицы размера.\n"
 
 // mplayer.c OSD
 #define MSGTR_OSDenabled "включено"
diff --git a/help/help_mp-tr.h b/help/help_mp-tr.h
index 834edc9..0b53327 100644
--- a/help/help_mp-tr.h
+++ b/help/help_mp-tr.h
@@ -194,7 +194,6 @@ static const char help_text[]=
 #define MSGTR_EdloutStartSkip "EDL atlaması başlangıcı, bloğu bitirmek için\n"\
 "'i' tuşuna tekrar basın.\n"
 #define MSGTR_EdloutEndSkip "EDL atlaması sonu, satır yazıldı.\n"
-#define MSGTR_MPEndposNoSizeBased "MPlayer'da -endpos seçeneği henüz boyut birimlerini desteklemiyor.\n"
 
 // mplayer.c OSD
 
diff --git a/help/help_mp-uk.h b/help/help_mp-uk.h
index ec3c601..296aaeb 100644
--- a/help/help_mp-uk.h
+++ b/help/help_mp-uk.h
@@ -185,7 +185,6 @@ static const char help_text[]=
 #define MSGTR_EdloutBadStop "Ігнорування EDL відмінено, останній start > stop\n"
 #define MSGTR_EdloutStartSkip "Старт EDL пропуску, натисніть 'i' знов, щоб завершити блок.\n"
 #define MSGTR_EdloutEndSkip "Кінець EDL пропуску, рядок записано.\n"
-#define MSGTR_MPEndposNoSizeBased "Опція -endpos у MPlayer ще не підтримує одиниці ромзіру.\n"
 
 // mplayer.c OSD
 #define MSGTR_OSDenabled "увімкнено"
diff --git a/help/help_mp-zh_CN.h b/help/help_mp-zh_CN.h
index 0ac6a40..1140b2c 100644
--- a/help/help_mp-zh_CN.h
+++ b/help/help_mp-zh_CN.h
@@ -196,7 +196,6 @@ static const char help_text[]=
 #define MSGTR_EdloutBadStop "取消 EDL 跳跃,上一个开始位置 > 停止位置\n"
 #define MSGTR_EdloutStartSkip "开始 EDL 跳跃,再按键‘i’以指定跳过内容的结尾。\n"
 #define MSGTR_EdloutEndSkip "结束 EDL 跳跃,文本行已写入。\n"
-#define MSGTR_MPEndposNoSizeBased "MPlayer 的选项 -endpos 还不支持指定尺寸大小的单位。\n"
 
 // mplayer.c OSD
 #define MSGTR_OSDenabled "已启用"
diff --git a/help/help_mp-zh_TW.h b/help/help_mp-zh_TW.h
index 5f1a321..100b22f 100644
--- a/help/help_mp-zh_TW.h
+++ b/help/help_mp-zh_TW.h
@@ -193,7 +193,6 @@ static const char help_text[]=
 #define MSGTR_EdloutBadStop "EDL 跳躍已取消, 上次開始位置 > 停止位置\n"
 #define MSGTR_EdloutStartSkip "EDL 跳躍開始, 再按鍵 'i' 以停止。\n"
 #define MSGTR_EdloutEndSkip "EDL 跳躍結束, 綫已寫入。\n"
-#define MSGTR_MPEndposNoSizeBased "MPlayer 的選項 -endpos 還不支持大小單位。\n"
 
 // mplayer.c OSD
 
diff --git a/mplayer.c b/mplayer.c
index c0e540e..7d623d2 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -3663,11 +3663,6 @@ if (seek_to_sec) {
     end_at.pos += seek_to_sec;
 }
 
-if (end_at.type == END_AT_SIZE) {
-    mp_msg(MSGT_CPLAYER, MSGL_WARN, MSGTR_MPEndposNoSizeBased);
-    end_at.type = END_AT_NONE;
-}
-
 #ifdef CONFIG_DVDNAV
 mp_dvdnav_context_free(mpctx);
 if (mpctx->stream->type == STREAMTYPE_DVDNAV) {
@@ -3711,7 +3706,8 @@ if(!mpctx->sh_video) {
   if(!quiet)
     print_status(a_pos, 0, 0);
 
-  if(end_at.type == END_AT_TIME && end_at.pos < a_pos)
+  if(end_at.type == END_AT_TIME && end_at.pos < a_pos ||
+     end_at.type == END_AT_SIZE && end_at.pos < stream_tell(mpctx->stream))
     mpctx->eof = PT_NEXT_ENTRY;
   update_subtitles(NULL, a_pos, mpctx->d_sub, 0);
   update_osd_msg();
@@ -3819,10 +3815,9 @@ if(auto_quality>0){
      if (play_n_frames <= 0) mpctx->eof = PT_NEXT_ENTRY;
  }
 
-
-// FIXME: add size based support for -endpos
- if (end_at.type == END_AT_TIME &&
-         !frame_time_remaining && end_at.pos <= mpctx->sh_video->pts)
+ if (!frame_time_remaining &&
+     ((end_at.type == END_AT_TIME &&       mpctx->sh_video->pts >= end_at.pos) ||
+      (end_at.type == END_AT_SIZE && stream_tell(mpctx->stream) >= end_at.pos)))
      mpctx->eof = PT_NEXT_ENTRY;
 
 } // end if(mpctx->sh_video)
-- 
1.7.3.4


--qMm9M+Fa2AknHoGS--


More information about the MPlayer-dev-eng mailing list