[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