1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-30 11:02:10 +00:00

Merge svn changes up to r28549

This commit is contained in:
Uoti Urpala 2009-02-13 03:52:51 +02:00
commit 738f66b1bc
17 changed files with 376 additions and 455 deletions

View File

@ -1,4 +1,4 @@
.\" Synced with r28279
.\" Synced with r28520
.\" MPlayer (C) 2000-2009 MPlayer Team
.\" Ezt a man oldalt Gabucino, Diego Biurrun és Jonas Jermann készíti/készítette
.\" Karbantartó: Gabrov
@ -33,7 +33,7 @@
.\" Név
.\" --------------------------------------------------------------------------
.
.TH MPlayer 1 "2009. 01. 10." "MPlayer Project" "A film lejátszó"
.TH MPlayer 1 "2009. 02. 12." "MPlayer Project" "A film lejátszó"
.
.SH NÉV
mplayer \- film lejátszó
@ -732,7 +732,7 @@ alaphelyzetben megakad
megfelelően a kocsi visszát (pl.\& \\r).
.
.TP
.B \-priority <prio> (csak Windows alatt)
.B \-priority <prio> (csak Windows és OS/2 alatt)
Az MPlayer processz proirítását állítja be a Windows alatt elérhető
előre definiált értékeknek megfelelően.
A <prio> lehetséges értékei:
@ -3575,7 +3575,9 @@ Mac OS X CoreVideo kimeneti vide
.PD 0
.RSs
.IPs device_id=<szám>
Teljes képernyõs lejátszásnál a használni kívánt képernyõ eszköz.
Teljes képernyős lejátszásnál a használni kívánt képernyő eszköz, vagy -1-re állítva
mindig ugyan azt a képernyőt használja, amelyiken a videó ablak van (alapértelmezett: \-1 \- auto).
.
.IPs shared_buffer
A kimenetet egy osztott memória bufferbe írja a megjelenítése helyett és
megpróbál megnyitni egy létező NSConnection-t a GUI-val történő kommunikációhoz.
@ -9124,6 +9126,10 @@ Jelenleg csak akkor m
(sc_threshold=1000000000).
.
.TP
.B "gmc\ \ \ \ "
A Global Motion Compensation engedélyezése.
.
.TP
.B (no)lowdelay
Beállítja az alacsony késleltetési jelzést az MPEG-1/2-nél (letiltja a B-kockákat, alapértelmezett: ki).
.

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- synced with r27843 -->
<!-- synced with r28510 -->
<chapter id="encoding-guide">
<title>Kódolás a <application>MEncoder</application>rel</title>
@ -3779,7 +3779,7 @@ Kérlek vedd figyelembe, hogy a forrásanyagodtól, a géped típusától
<para>
Az <systemitem class="library">x264</systemitem> egy szabad függvénykönyvtár
a H.264/AVC videó folyamok kódolásához.
Mielőtt elkezdenél kódolni, <link linkend="codec-x264">be kell
Mielőtt elkezdenél kódolni, <link linkend="x264">be kell
állítanod a <application>MEncoder</application>ben a támogatását</link>.
</para>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- synced with r28207 -->
<!-- synced with r28531 -->
<chapter id="faq" xreflabel="FAQ">
<title>Gyakran ismételt kérdések</title>
@ -227,17 +227,6 @@ Kérünk olvasd el a <link linkend="bugreports">hiba jelentési útmutatót</lin
</para></answer>
</qandaentry>
<qandaentry>
<question><para>
Problémám van a ... codec-kel történő lejátszással. Egyáltalán használható?
</para></question>
<answer><para>
Ellenőrizd a <ulink url="../../codecs-status.html">codec státusz</ulink>
oldalt, ha nem tartalmazza a te codecedet, olvasd el a
<ulink url="../../tech/win32-codec-howto">Win32 codec HOWTO</ulink>-t és keress meg minket.
</para></answer>
</qandaentry>
<qandaentry>
<question><para>
Egy core dump-ot kapok, amikor folyamokat dump-olok, mi a baj?
@ -394,27 +383,6 @@ cseréld ki az <systemitem>#undef FAST_OSD</systemitem> sort
</para></answer>
</qandaentry>
<qandaentry>
<question><para>
Nem érem el a GUI menüt. Jobb gombbal kattintok, de semelyik menüelemet
sem tudom elérni!
</para></question>
<answer><para>
FVWM-et használsz? Próbáld ki ezt:
<orderedlist>
<listitem><para>
<menuchoice><guimenu>Start</guimenu><guisubmenu>Settings</guisubmenu>
<guisubmenu>Configuration</guisubmenu>
<guimenuitem>Base Configuration</guimenuitem></menuchoice>
</para></listitem>
<listitem><para>
Állítsd át a <systemitem>Use Applications position hints</systemitem>-et
<systemitem>Yes</systemitem>-re!
</para></listitem>
</orderedlist>
</para></answer>
</qandaentry>
<qandaentry>
<question><para>
Hogy tudom az <application>MPlayer</application> a háttérben futtatni?
@ -707,18 +675,6 @@ fel a fájlt az FTP-re.
</para></answer>
</qandaentry>
<qandaentry>
<question><para>
A számítógépem az MS DivX AVI-kat ~ 640x300-as felbontásban játssza le, sztereó MP3
hanggal, és lassú.
Ha használom a <option>-nosound</option> kapcsolót, minden rendben (csak nincs hang).
</para></question>
<answer><para>
A géped túl lassú vagy a hangkártyád vezérlője hibás. Nézd végig a dokumentációt,
hogy megtudd, hogyan javíthatsz a teljesítményen.
</para></answer>
</qandaentry>
<qandaentry>
<question><para>
Hogy tudom használni a <application>dmix</application>-et az
@ -848,21 +804,6 @@ neked magadnak kell megcsinálnod, de vigyázz, nagy fába vágod a fejszédet.
</para></answer>
</qandaentry>
<qandaentry>
<question><para>
Nem tudok egyetlen újabb DVD-t sem megnézni a Sony Pictures/BMG-től.
</para></question>
<answer><para>
Ez normális; átvertek, egy szándékosan elrontott lemezt adtak el neked.
Az egyetlen módszer ezen DVD-k lejátszására a hibás blokkok kikerülése
az mpdvdkit2 helyett a DVDnav használatával.
Ezt úgy teheted meg, hogy az <application>MPlayer</application> DVDnav
támogatással fordítod le, majd a parancssori dvd:// dvdnav://-ra cseréled.
A DVDnav nagyon nagy mértékben kizárja az mpdvdkit2-et, győződj meg róla, hogy
a <option>--disable-mpdvdkit</option> opciót megadtad a configure-nak.
</para></answer>
</qandaentry>
<qandaentry>
<question><para>
Mi van a feliratokkal? Meg tudja őket jeleníteni az <application>MPlayer</application>?
@ -1288,7 +1229,7 @@ Használd az <filename>avisubdump.c</filename> fájlt a
<qandaentry>
<question><para>
Az MPlayer nem...
A MEncoder nem...
</para></question>
<answer><para>
Nézz bele a <filename class="directory">TOOLS</filename>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- synced with r28422 -->
<!-- synced with r28510 -->
<chapter id="install">
<title>Telepítés</title>
@ -405,7 +405,7 @@ alapértelmezett, mivel jobb a sebessége.
<!-- ********** -->
<sect2 id="codec-x264">
<sect2 id="x264">
<title><systemitem class="library">x264</systemitem></title>
<para>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- synced with r26990 -->
<!-- synced with r28532 -->
<chapter id="usage">
<title>Használat</title>
@ -501,18 +501,19 @@ leírt blokkok kihagyása.
</para>
</sect2>
</sect1>
</chapter>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<sect1 id="advaudio" xreflabel="Advanced Audio">
<title>Továbbfejlesztett audió</title>
<chapter id="advaudio" xreflabel="Advanced Audio">
<title>Továbbfejlesztett audió használata</title>
<sect2 id="advaudio-surround">
<sect1 id="advaudio-surround">
<title>Térhatású/többcsatornás lejátszás</title>
<sect3 id="advaudio-surround-DVD">
<sect2 id="advaudio-surround-DVD">
<title>DVD-k</title>
<para>
@ -532,10 +533,10 @@ kvadrafónikus lejátszás alapértelmezetté tételéhez írd be ezt a sort:
Az <application>MPlayer</application> ekkor az audiót négy csatornán fogja
lejátszani, ha mind a négy csatorna elérhető.
</para>
</sect3>
</sect2>
<sect3 id="advaudio-surround-stereoinfour">
<sect2 id="advaudio-surround-stereoinfour">
<title>Sztereó fájlok lejátszása négy hangszórón</title>
<para>
@ -545,10 +546,10 @@ ahogy a legtöbb audió vezérlő sem. Ha ilyet akarsz, kézzel kell megadnod:
Lásd a <link linkend="advaudio-channels-copying">csatorna másolásról</link>
szóló rész a magyarázatért.
</para>
</sect3>
</sect2>
<sect3 id="advaudio-surround-passthrough">
<sect2 id="advaudio-surround-passthrough">
<title>AC-3/DTS áteresztés</title>
<para>
@ -600,10 +601,10 @@ amiben nincs AC-3-as vagy DTS audió. Az <option>afm=hwac3</option>
sorba nem kell vessző; az <application>MPlayer</application> mindenképpen vált
ha egy audió család van megadva.
</para>
</sect3>
</sect2>
<sect3 id="hwmpa-surround-passthrough">
<sect2 id="hwmpa-surround-passthrough">
<title>MPEG audió áteresztés</title>
<para>
@ -619,10 +620,10 @@ az audió adatok dekódolásával.
To use this codec:
<screen> mplayer -ac hwmpa </screen>
</para>
</sect3>
</sect2>
<sect3 id="advaudio-surround-matrix">
<sect2 id="advaudio-surround-matrix">
<title>Mátrix-kódolású audió</title>
<para>
@ -653,10 +654,10 @@ Jó link-ek:
</para></listitem>
</itemizedlist>
</para>
</sect3>
</sect2>
<sect3 id="advaudio-surround-hrtf">
<sect2 id="advaudio-surround-hrtf">
<title>Térhatás emulálása fülhallgatóval</title>
<para>
@ -691,10 +692,10 @@ történő lejátszáshoz újra kell mintáznod:
mplayer <replaceable>fájlnév</replaceable> -channels 6 -af resample=48000,hrtf
</screen>
</para>
</sect3>
</sect2>
<sect3 id="advaudio-surround-troubleshooting">
<sect2 id="advaudio-surround-troubleshooting">
<title>Hibajavítás</title>
<para>
@ -702,15 +703,15 @@ Ha nem hallasz semmilyen hangot a térhatású csatornáidból, ellenőrizd a mi
beállításait egy mixer programmal, mint pl. az <application>alsamixer</application>;
az audió kimenetek gyakran le vannak némítva és nulla hangerőre vannak állítva alapértelmezésben.
</para>
</sect3>
</sect2>
</sect1>
<!-- ********** -->
<sect2 id="advaudio-channels">
<sect1 id="advaudio-channels">
<title>Csatorna többszörözés</title>
<sect3 id="advaudio-channels-general">
<sect2 id="advaudio-channels-general">
<title>Általános információk</title>
<para>
@ -780,10 +781,10 @@ vagy eltávolítására, a hangkártya felé kiküldött csatornák számának b
való. Lásd a következő fejezeteket a csatorna manipulációval kapcsolatos bővebb
információkért.
</para>
</sect3>
</sect2>
<sect3 id="advaudio-channels-mono">
<sect2 id="advaudio-channels-mono">
<title>Mono lejátszása két hangszóróval</title>
<para>
@ -807,10 +808,10 @@ kikísérletezed és megkeresed a helyes hangerőt. Például:
mplayer <replaceable>filename</replaceable> -af extrastereo=0,volume=5
</screen>
</para>
</sect3>
</sect2>
<sect3 id="advaudio-channels-copying">
<sect2 id="advaudio-channels-copying">
<title>Csatorna másolás/mozgatás</title>
<para>
@ -909,10 +910,10 @@ Az alopciók összeállításával kapjuk:
mplayer <replaceable>fájlnév</replaceable> -af channels=4:4:0:2:0:0:1:3:1:1
</screen>
</para>
</sect3>
</sect2>
<sect3 id="advaudio-channels-mixing">
<sect2 id="advaudio-channels-mixing">
<title>Csatorna keverés</title>
<para>
@ -1077,12 +1078,12 @@ Ezen opciók összevonásával születik meg az eredmény:
mplayer <replaceable>dvd://1</replaceable> -channels 6 -af pan=5:1:0:0:0:0:0:1:0:0:0:0:0:1:0:0:0:0:0:1:0:0:0:0:0:1:0.5:0.5:0:0:0
</screen>
</para>
</sect3>
</sect2>
</sect1>
<!-- ********** -->
<sect2 id="advaudio-volume">
<sect1 id="advaudio-volume">
<title>Szoftveres hangerő állítás</title>
<para>
@ -1122,6 +1123,5 @@ meg, a <option>volume</option>-nek lehet, hogy le kell csípnie a jelet, hogy
megakadályozza a hangkártyád elfogadható tartományán kívül eső adatok küldését;
ez zavart audiót eredményez.
</para>
</sect2>
</sect1>
</chapter>

View File

@ -935,16 +935,18 @@ uninstall:
rm -f $(MANDIR)/man1/mplayer.1 $(MANDIR)/man1/mencoder.1
rm -f $(foreach lang,$(MAN_LANGS),$(foreach man,mplayer.1 mencoder.1,$(MANDIR)/$(lang)/man1/$(man)))
ADD_ALL_EXESUFS = $(foreach exesuf,$(EXESUFS_ALL),$(1) $(1)$(exesuf))
clean:
rm -f $(foreach dir,$(DIRS),$(foreach suffix,/*.o /*.a /*.ho /*~, $(addsuffix $(suffix),$(dir))))
rm -f mplayer$(EXESUF) mencoder$(EXESUF)
-rm -f $(foreach dir,$(DIRS),$(foreach suffix,/*.o /*.a /*.ho /*~, $(addsuffix $(suffix),$(dir))))
-rm -f $(foreach file,mplayer mencoder,$(call ADD_ALL_EXESUFS,$(file)))
distclean: clean testsclean toolsclean driversclean dhahelperclean dhahelperwinclean
rm -rf DOCS/tech/doxygen
rm -f $(foreach dir,$(DIRS),$(foreach suffix,/*.d, $(addsuffix $(suffix),$(dir))))
rm -f configure.log config.mak config.h codecs.conf.h help_mp.h \
version.h $(VIDIX_PCI_FILES) \
codec-cfg$(EXESUF) cpuinfo$(EXESUF) TAGS tags
-rm -rf DOCS/tech/doxygen
-rm -f $(foreach dir,$(DIRS),$(foreach suffix,/*.d, $(addsuffix $(suffix),$(dir))))
-rm -f configure.log config.mak config.h codecs.conf.h help_mp.h \
version.h $(VIDIX_PCI_FILES) TAGS tags
-rm -f $(foreach file,codec-cfg cpuinfo,$(call ADD_ALL_EXESUFS,$(file)))
doxygen:
doxygen DOCS/tech/Doxyfile
@ -978,43 +980,32 @@ loader/qtx/list$(EXESUF) loader/qtx/qtxload$(EXESUF): $(LOADER_TEST_OBJS)
mp3lib/test$(EXESUF) mp3lib/test2$(EXESUF): $(filter mp3lib/%,$(SRCS_COMMON:.c=.o)) libvo/aclib.o cpudetect.o $(TEST_OBJS)
TESTS = codecs2html$(EXESUF) codec-cfg-test$(EXESUF) \
liba52/test$(EXESUF) libvo/aspecttest$(EXESUF) \
mp3lib/test$(EXESUF) mp3lib/test2$(EXESUF)
TESTS = codecs2html codec-cfg-test liba52/test libvo/aspecttest \
mp3lib/test mp3lib/test2
ifdef ARCH_X86
TESTS += loader/qtx/list$(EXESUF) loader/qtx/qtxload$(EXESUF)
TESTS += loader/qtx/list loader/qtx/qtxload
endif
tests: $(TESTS)
tests: $(addsuffix $(EXESUF),$(TESTS))
testsclean:
rm -f $(TESTS)
-rm -f $(foreach file,$(TESTS),$(call ADD_ALL_EXESUFS,$(file)))
TOOLS = TOOLS/alaw-gen$(EXESUF) \
TOOLS/asfinfo$(EXESUF) \
TOOLS/avi-fix$(EXESUF) \
TOOLS/avisubdump$(EXESUF) \
TOOLS/compare$(EXESUF) \
TOOLS/dump_mp4$(EXESUF) \
TOOLS/movinfo$(EXESUF) \
TOOLS/netstream$(EXESUF) \
TOOLS/subrip$(EXESUF) \
TOOLS/vivodump$(EXESUF) \
TOOLS = $(addprefix TOOLS/,alaw-gen asfinfo avi-fix avisubdump compare dump_mp4 movinfo netstream subrip vivodump)
ifdef ARCH_X86
TOOLS += TOOLS/modify_reg$(EXESUF)
TOOLS += TOOLS/modify_reg
endif
ALLTOOLS = $(TOOLS) \
TOOLS/bmovl-test$(EXESUF) \
TOOLS/vfw2menc$(EXESUF) \
ALLTOOLS = $(TOOLS) TOOLS/bmovl-test TOOLS/vfw2menc
tools: $(TOOLS)
alltools: $(ALLTOOLS)
tools: $(addsuffix $(EXESUF),$(TOOLS))
alltools: $(addsuffix $(EXESUF),$(ALLTOOLS))
toolsclean:
rm -f $(ALLTOOLS) TOOLS/fastmem*-* TOOLS/realcodecs/*.so.6.0
-rm -f $(foreach file,$(ALLTOOLS),$(call ADD_ALL_EXESUFSx,$(file)))
-rm -f TOOLS/fastmem*-* TOOLS/realcodecs/*.so.6.0
TOOLS/bmovl-test$(EXESUF): -lSDL_image
@ -1082,7 +1073,7 @@ install-drivers: $(DRIVER_OBJS)
-ln -s /dev/radeon_vid /dev/rage128_vid
driversclean:
rm -f $(DRIVER_OBJS) drivers/*~
-rm -f $(DRIVER_OBJS) drivers/*~
dhahelper: vidix/dhahelper/dhahelper.o vidix/dhahelper/test
@ -1096,7 +1087,7 @@ install-dhahelper: vidix/dhahelper/dhahelper.o
-mknod /dev/dhahelper c 180 0
dhahelperclean:
rm -f vidix/dhahelper/*.o vidix/dhahelper/*~ vidix/dhahelper/test
-rm -f vidix/dhahelper/*.o vidix/dhahelper/*~ vidix/dhahelper/test
dhahelperwin: vidix/dhahelperwin/dhasetup.exe vidix/dhahelperwin/dhahelper.sys
@ -1128,7 +1119,7 @@ install-dhahelperwin:
vidix/dhahelperwin/dhasetup.exe install
dhahelperwinclean:
rm -f $(addprefix vidix/dhahelperwin/,*.o *~ dhahelper.sys dhasetup.exe base.tmp temp.exp)
-rm -f $(addprefix vidix/dhahelperwin/,*.o *~ dhahelper.sys dhasetup.exe base.tmp temp.exp)

1
configure vendored
View File

@ -8025,6 +8025,7 @@ HELP_FILE = $_mp_help
TIMER = $_timer
EXESUF = $_exesuf
EXESUFS_ALL = .exe
$_target_arch
$_target_arch_x86

View File

@ -1250,7 +1250,7 @@ static char help_text[]=
#define MSGTR_AO_ALSA_ErrorSetBlockMode "[AL_ALSA] Fehler beim Setzen des block-Modus %s.\n"
#define MSGTR_AO_ALSA_UnableToGetInitialParameters "[AO_ALSA] Kann Startparameter nicht ermitteln: %s\n"
#define MSGTR_AO_ALSA_UnableToSetAccessType "[AO_ALSA] Kann Zugriffstyp nicht setzen: %s\n"
#define MSGTR_AO_ALSA_FormatNotSupportedByHardware "[AO_ALSA] Format %s wird von der Hardware nicht unterstütz, versuche Standard.\n"
#define MSGTR_AO_ALSA_FormatNotSupportedByHardware "[AO_ALSA] Format %s wird von der Hardware nicht unterstützt, versuche Standard.\n"
#define MSGTR_AO_ALSA_UnableToSetFormat "[AO_ALSA] Kann Format nicht setzen: %s\n"
#define MSGTR_AO_ALSA_UnableToSetChannels "[AO_ALSA] Kann Kanäle nicht ermitteln: %s\n"
#define MSGTR_AO_ALSA_UnableToDisableResampling "[AO_ALSA] Kann Resampling nicht deaktivieren: %s\n"

View File

@ -16,11 +16,11 @@
#include "vd_internal.h"
static const vd_info_t info = {
"FFmpeg's libavcodec codec family",
"ffmpeg",
"A'rpi",
"A'rpi, Michael, Alex",
"native codecs"
"FFmpeg's libavcodec codec family",
"ffmpeg",
"A'rpi",
"A'rpi, Michael, Alex",
"native codecs"
};
LIBVD_EXTERN(ffmpeg)
@ -52,10 +52,6 @@ typedef struct {
int lowres;
} vd_ffmpeg_ctx;
//#ifdef CONFIG_LIBPOSTPROC
//unsigned int lavc_pp=0;
//#endif
#include "m_option.h"
static int get_buffer(AVCodecContext *avctx, AVFrame *pic);
@ -68,7 +64,7 @@ static int mc_get_buffer(AVCodecContext *avctx, AVFrame *pic);
static void mc_release_buffer(AVCodecContext *avctx, AVFrame *pic);
static void mc_render_slice(struct AVCodecContext *s,
const AVFrame *src, int offset[4],
int y, int type, int height);
int y, int type, int height);
#endif
const m_option_t lavc_decode_opts_conf[]={
@ -82,9 +78,7 @@ const m_option_t lavc_decode_opts_conf[]={
OPT_INTRANGE("vismv", lavc_param.vismv, 0, 0, 9999999),
OPT_INTRANGE("st", lavc_param.skip_top, 0, 0, 999),
OPT_INTRANGE("sb", lavc_param.skip_bottom, 0, 0, 999),
#ifdef CODEC_FLAG2_FAST
OPT_FLAG_CONSTANTS("fast", lavc_param.fast, 0, 0, CODEC_FLAG2_FAST),
#endif
OPT_STRING("lowres", lavc_param.lowres_str, 0),
OPT_STRING("skiploopfilter", lavc_param.skip_loop_filter_str, 0),
OPT_STRING("skipidct", lavc_param.skip_idct_str, 0),
@ -115,30 +109,30 @@ static int control(sh_video_t *sh,int cmd,void* arg,...){
case VDCTRL_QUERY_FORMAT:
{
int format =(*((int*)arg));
if( format == ctx->best_csp ) return CONTROL_TRUE;//supported
// possible conversions:
switch( format ){
if( format == ctx->best_csp ) return CONTROL_TRUE;//supported
// possible conversions:
switch( format ){
case IMGFMT_YV12:
case IMGFMT_IYUV:
case IMGFMT_I420:
// "converted" using pointer/stride modification
if(avctx->pix_fmt==PIX_FMT_YUV420P) return CONTROL_TRUE;// u/v swap
if(avctx->pix_fmt==PIX_FMT_YUV422P && !ctx->do_dr1) return CONTROL_TRUE;// half stride
break;
// "converted" using pointer/stride modification
if(avctx->pix_fmt==PIX_FMT_YUV420P) return CONTROL_TRUE;// u/v swap
if(avctx->pix_fmt==PIX_FMT_YUV422P && !ctx->do_dr1) return CONTROL_TRUE;// half stride
break;
#if CONFIG_XVMC
case IMGFMT_XVMC_IDCT_MPEG2:
case IMGFMT_XVMC_MOCO_MPEG2:
if(avctx->pix_fmt==PIX_FMT_XVMC_MPEG2_IDCT) return CONTROL_TRUE;
#endif
}
}
return CONTROL_FALSE;
}
break;
case VDCTRL_RESYNC_STREAM:
avcodec_flush_buffers(avctx);
return CONTROL_TRUE;
return CONTROL_TRUE;
case VDCTRL_QUERY_UNSEEN_FRAMES:
return avctx->has_b_frames + 10;
return avctx->has_b_frames + 10;
}
return CONTROL_UNKNOWN;
}
@ -211,21 +205,21 @@ static int init(sh_video_t *sh){
ctx = sh->context = malloc(sizeof(vd_ffmpeg_ctx));
if (!ctx)
return 0;
return 0;
memset(ctx, 0, sizeof(vd_ffmpeg_ctx));
lavc_codec = (AVCodec *)avcodec_find_decoder_by_name(sh->codec->dll);
if(!lavc_codec){
mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_MissingLAVCcodec,sh->codec->dll);
mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_MissingLAVCcodec,sh->codec->dll);
uninit(sh);
return 0;
return 0;
}
if(sh->opts->vd_use_slices && (lavc_codec->capabilities&CODEC_CAP_DRAW_HORIZ_BAND) && !do_vis_debug)
ctx->do_slices=1;
ctx->do_slices=1;
if(lavc_codec->capabilities&CODEC_CAP_DR1 && !do_vis_debug && lavc_codec->id != CODEC_ID_H264 && lavc_codec->id != CODEC_ID_INTERPLAY_VIDEO && lavc_codec->id != CODEC_ID_ROQ)
ctx->do_dr1=1;
ctx->do_dr1=1;
ctx->b_age= ctx->ip_age[0]= ctx->ip_age[1]= 256*256*256*64;
ctx->ip_count= ctx->b_count= 0;
@ -235,11 +229,7 @@ static int init(sh_video_t *sh){
#if CONFIG_XVMC
#ifdef CODEC_CAP_HWACCEL
if(lavc_codec->capabilities & CODEC_CAP_HWACCEL){
#else
if(lavc_codec->id == CODEC_ID_MPEG2VIDEO_XVMC){
#endif /* CODEC_CAP_HWACCEL */
mp_msg(MSGT_DECVIDEO, MSGL_INFO, MSGTR_MPCODECS_XVMCAcceleratedCodec);
assert(ctx->do_dr1);//these are must to!
assert(ctx->do_slices); //it is (vo_)ffmpeg bug if this fails
@ -252,25 +242,20 @@ static int init(sh_video_t *sh){
}else
#endif /* CONFIG_XVMC */
if(ctx->do_dr1){
avctx->flags|= CODEC_FLAG_EMU_EDGE;
avctx->flags|= CODEC_FLAG_EMU_EDGE;
avctx->get_buffer= get_buffer;
avctx->release_buffer= release_buffer;
avctx->reget_buffer= get_buffer;
}
#ifdef CODEC_FLAG_NOT_TRUNCATED
avctx->flags|= CODEC_FLAG_NOT_TRUNCATED;
#endif
avctx->flags|= lavc_param->bitexact;
avctx->width = sh->disp_w;
avctx->height= sh->disp_h;
avctx->workaround_bugs= lavc_param->workaround_bugs;
avctx->error_recognition= lavc_param->error_resilience;
if(lavc_param->gray) avctx->flags|= CODEC_FLAG_GRAY;
#ifdef CODEC_FLAG2_FAST
avctx->flags2|= lavc_param->fast;
#endif
avctx->codec_tag= sh->format;
avctx->stream_codec_tag= sh->video.fccHandler;
avctx->idct_algo= lavc_param->idct_algo;
@ -306,37 +291,37 @@ static int init(sh_video_t *sh){
/* SVQ3 extradata can show up as sh->ImageDesc if demux_mov is used, or
in the phony AVI header if demux_lavf is used. The first case is
handled here; the second case falls through to the next section. */
if (sh->ImageDesc) {
avctx->extradata_size = (*(int*)sh->ImageDesc) - sizeof(int);
avctx->extradata = av_mallocz(avctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
memcpy(avctx->extradata, ((int*)sh->ImageDesc)+1, avctx->extradata_size);
break;
}
/* fallthrough */
if (sh->ImageDesc) {
avctx->extradata_size = (*(int*)sh->ImageDesc) - sizeof(int);
avctx->extradata = av_mallocz(avctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
memcpy(avctx->extradata, ((int*)sh->ImageDesc)+1, avctx->extradata_size);
break;
}
/* fallthrough */
case mmioFOURCC('A','V','R','n'):
case mmioFOURCC('M','J','P','G'):
/* AVRn stores huffman table in AVI header */
/* Pegasus MJPEG stores it also in AVI header, but it uses the common
MJPG fourcc :( */
if (!sh->bih || sh->bih->biSize <= sizeof(BITMAPINFOHEADER))
break;
avctx->flags |= CODEC_FLAG_EXTERN_HUFF;
avctx->extradata_size = sh->bih->biSize-sizeof(BITMAPINFOHEADER);
avctx->extradata = av_mallocz(avctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
memcpy(avctx->extradata, sh->bih+1, avctx->extradata_size);
if (!sh->bih || sh->bih->biSize <= sizeof(BITMAPINFOHEADER))
break;
avctx->flags |= CODEC_FLAG_EXTERN_HUFF;
avctx->extradata_size = sh->bih->biSize-sizeof(BITMAPINFOHEADER);
avctx->extradata = av_mallocz(avctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
memcpy(avctx->extradata, sh->bih+1, avctx->extradata_size);
#if 0
{
int x;
uint8_t *p = avctx->extradata;
for (x=0; x<avctx->extradata_size; x++)
mp_msg(MSGT_DECVIDEO, MSGL_INFO,"[%x] ", p[x]);
mp_msg(MSGT_DECVIDEO, MSGL_INFO,"\n");
}
{
int x;
uint8_t *p = avctx->extradata;
for (x=0; x<avctx->extradata_size; x++)
mp_msg(MSGT_DECVIDEO, MSGL_INFO,"[%x] ", p[x]);
mp_msg(MSGT_DECVIDEO, MSGL_INFO,"\n");
}
#endif
break;
break;
case mmioFOURCC('R', 'V', '1', '0'):
case mmioFOURCC('R', 'V', '1', '3'):
@ -347,27 +332,27 @@ static int init(sh_video_t *sh){
/* only 1 packet per frame & sub_id from fourcc */
avctx->extradata_size= 8;
avctx->extradata = av_mallocz(avctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
((uint32_t*)avctx->extradata)[0] = 0;
((uint32_t*)avctx->extradata)[1] =
(sh->format == mmioFOURCC('R', 'V', '1', '3')) ? 0x10003001 : 0x10000000;
((uint32_t*)avctx->extradata)[0] = 0;
((uint32_t*)avctx->extradata)[1] =
(sh->format == mmioFOURCC('R', 'V', '1', '3')) ? 0x10003001 : 0x10000000;
} else {
/* has extra slice header (demux_rm or rm->avi streamcopy) */
avctx->extradata_size = sh->bih->biSize-sizeof(BITMAPINFOHEADER);
avctx->extradata = av_mallocz(avctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
memcpy(avctx->extradata, sh->bih+1, avctx->extradata_size);
}
avctx->sub_id= AV_RB32(avctx->extradata+4);
/* has extra slice header (demux_rm or rm->avi streamcopy) */
avctx->extradata_size = sh->bih->biSize-sizeof(BITMAPINFOHEADER);
avctx->extradata = av_mallocz(avctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
memcpy(avctx->extradata, sh->bih+1, avctx->extradata_size);
}
avctx->sub_id= AV_RB32(avctx->extradata+4);
// printf("%X %X %d %d\n", extrahdr[0], extrahdr[1]);
break;
default:
if (!sh->bih || sh->bih->biSize <= sizeof(BITMAPINFOHEADER))
break;
avctx->extradata_size = sh->bih->biSize-sizeof(BITMAPINFOHEADER);
avctx->extradata = av_mallocz(avctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
memcpy(avctx->extradata, sh->bih+1, avctx->extradata_size);
break;
if (!sh->bih || sh->bih->biSize <= sizeof(BITMAPINFOHEADER))
break;
avctx->extradata_size = sh->bih->biSize-sizeof(BITMAPINFOHEADER);
avctx->extradata = av_mallocz(avctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
memcpy(avctx->extradata, sh->bih+1, avctx->extradata_size);
break;
}
/* Pass palette to codec */
if (sh->bih && (sh->bih->biBitCount <= 8)) {
@ -381,10 +366,10 @@ static int init(sh_video_t *sh){
/* Palette size in biClrUsed */
memcpy(avctx->palctrl->palette, sh->bih+1,
FFMIN(sh->bih->biClrUsed * 4, AVPALETTE_SIZE));
}
}
if(sh->bih)
avctx->bits_per_coded_sample= sh->bih->biBitCount;
avctx->bits_per_coded_sample= sh->bih->biBitCount;
if(lavc_param->threads > 1)
avcodec_thread_init(avctx, lavc_param->threads);
@ -402,13 +387,13 @@ static int init(sh_video_t *sh){
static void uninit(sh_video_t *sh){
vd_ffmpeg_ctx *ctx = sh->context;
AVCodecContext *avctx = ctx->avctx;
if(sh->opts->lavc_param.vstats){
int i;
for(i=1; i<32; i++){
mp_msg(MSGT_DECVIDEO, MSGL_INFO,"QP: %d, count: %d\n", i, ctx->qp_stat[i]);
}
mp_msg(MSGT_DECVIDEO, MSGL_INFO,MSGTR_MPCODECS_ArithmeticMeanOfQP,
mp_msg(MSGT_DECVIDEO, MSGL_INFO,MSGTR_MPCODECS_ArithmeticMeanOfQP,
ctx->qp_sum / avctx->coded_frame->coded_picture_number,
1.0/(ctx->inv_qp_sum / avctx->coded_frame->coded_picture_number)
);
@ -426,12 +411,12 @@ static void uninit(sh_video_t *sh){
av_freep(&avctx);
av_freep(&ctx->pic);
if (ctx)
free(ctx);
free(ctx);
}
static void draw_slice(struct AVCodecContext *s,
const AVFrame *src, int offset[4],
int y, int type, int height){
int y, int type, int height){
sh_video_t * sh = s->opaque;
uint8_t *source[3]= {src->data[0] + offset[0], src->data[1] + offset[1], src->data[2] + offset[2]};
#if 0
@ -442,18 +427,18 @@ static void draw_slice(struct AVCodecContext *s,
uint8_t *skip= &s->coded_frame->mbskip_table[(y>>4)*skip_stride];
int threshold= s->coded_frame->age;
if(s->pict_type!=B_TYPE){
for(i=0; i*16<width+16; i++){
for(i=0; i*16<width+16; i++){
if(i*16>=width || skip[i]>=threshold){
if(start==i) start++;
else{
uint8_t *src2[3]= {src[0] + start*16,
src[1] + start*8,
uint8_t *src2[3]= {src[0] + start*16,
src[1] + start*8,
src[2] + start*8};
//printf("%2d-%2d x %d\n", start, i, y);
mpcodecs_draw_slice (sh,src2, stride, (i-start)*16, height, start*16, y);
start= i+1;
}
}
}
}
}else
#endif
@ -476,57 +461,57 @@ static int init_vo(sh_video_t *sh, enum PixelFormat pix_fmt){
// if sh->ImageDesc is non-NULL, it means we decode QuickTime(tm) video.
// use dimensions from BIH to avoid black borders at the right and bottom.
if (sh->bih && sh->ImageDesc) {
width = sh->bih->biWidth >> ctx->lowres;
height = sh->bih->biHeight >> ctx->lowres;
width = sh->bih->biWidth >> ctx->lowres;
height = sh->bih->biHeight >> ctx->lowres;
}
// it is possible another vo buffers to be used after vo config()
// lavc reset its buffers on width/heigh change but not on aspect change!!!
if (av_cmp_q(avctx->sample_aspect_ratio, ctx->last_sample_aspect_ratio) ||
width != sh->disp_w ||
height != sh->disp_h ||
pix_fmt != ctx->pix_fmt ||
!ctx->vo_initialized)
width != sh->disp_w ||
height != sh->disp_h ||
pix_fmt != ctx->pix_fmt ||
!ctx->vo_initialized)
{
mp_msg(MSGT_DECVIDEO, MSGL_V, "[ffmpeg] aspect_ratio: %f\n", aspect);
if (sh->aspect == 0 ||
av_cmp_q(avctx->sample_aspect_ratio,
ctx->last_sample_aspect_ratio))
sh->aspect = aspect;
ctx->last_sample_aspect_ratio = avctx->sample_aspect_ratio;
sh->disp_w = width;
sh->disp_h = height;
ctx->pix_fmt = pix_fmt;
switch(pix_fmt){
// YUVJ are YUV formats that use the full Y range and not just
// 16 - 235 (see colorspaces.txt).
// Currently they are all treated the same way.
case PIX_FMT_YUV410P: ctx->best_csp=IMGFMT_YVU9;break; //svq1
case PIX_FMT_YUVJ420P:
case PIX_FMT_YUV420P: ctx->best_csp=IMGFMT_YV12;break; //mpegs
case PIX_FMT_YUVJ422P:
case PIX_FMT_YUV422P: ctx->best_csp=IMGFMT_422P;break; //mjpeg / huffyuv
case PIX_FMT_YUVJ444P:
case PIX_FMT_YUV444P: ctx->best_csp=IMGFMT_444P;break; //photo jpeg
case PIX_FMT_YUV411P: ctx->best_csp=IMGFMT_411P;break; //dv ntsc
case PIX_FMT_YUYV422: ctx->best_csp=IMGFMT_YUY2;break; //huffyuv perhaps in the future
case PIX_FMT_RGB24 : ctx->best_csp=IMGFMT_RGB24;break; //qtrle
case PIX_FMT_RGB32: ctx->best_csp=IMGFMT_BGR32;break; //huffyuv / mjpeg
case PIX_FMT_BGR24 : ctx->best_csp=IMGFMT_BGR24;break; //8bps
case PIX_FMT_RGB555: ctx->best_csp=IMGFMT_BGR15;break; //rpza,cram
case PIX_FMT_RGB565: ctx->best_csp=IMGFMT_BGR16;break; //4xm
case PIX_FMT_GRAY8: ctx->best_csp=IMGFMT_Y800;break; // gray jpeg
case PIX_FMT_PAL8: ctx->best_csp=IMGFMT_BGR8;break; //8bps,mrle,cram
mp_msg(MSGT_DECVIDEO, MSGL_V, "[ffmpeg] aspect_ratio: %f\n", aspect);
if (sh->aspect == 0 ||
av_cmp_q(avctx->sample_aspect_ratio,
ctx->last_sample_aspect_ratio))
sh->aspect = aspect;
ctx->last_sample_aspect_ratio = avctx->sample_aspect_ratio;
sh->disp_w = width;
sh->disp_h = height;
ctx->pix_fmt = pix_fmt;
switch(pix_fmt){
// YUVJ are YUV formats that use the full Y range and not just
// 16 - 235 (see colorspaces.txt).
// Currently they are all treated the same way.
case PIX_FMT_YUV410P: ctx->best_csp=IMGFMT_YVU9;break; //svq1
case PIX_FMT_YUVJ420P:
case PIX_FMT_YUV420P: ctx->best_csp=IMGFMT_YV12;break; //mpegs
case PIX_FMT_YUVJ422P:
case PIX_FMT_YUV422P: ctx->best_csp=IMGFMT_422P;break; //mjpeg / huffyuv
case PIX_FMT_YUVJ444P:
case PIX_FMT_YUV444P: ctx->best_csp=IMGFMT_444P;break; //photo jpeg
case PIX_FMT_YUV411P: ctx->best_csp=IMGFMT_411P;break; //dv ntsc
case PIX_FMT_YUYV422: ctx->best_csp=IMGFMT_YUY2;break; //huffyuv perhaps in the future
case PIX_FMT_RGB24 : ctx->best_csp=IMGFMT_RGB24;break; //qtrle
case PIX_FMT_RGB32: ctx->best_csp=IMGFMT_BGR32;break; //huffyuv / mjpeg
case PIX_FMT_BGR24 : ctx->best_csp=IMGFMT_BGR24;break; //8bps
case PIX_FMT_RGB555: ctx->best_csp=IMGFMT_BGR15;break; //rpza,cram
case PIX_FMT_RGB565: ctx->best_csp=IMGFMT_BGR16;break; //4xm
case PIX_FMT_GRAY8: ctx->best_csp=IMGFMT_Y800;break; // gray jpeg
case PIX_FMT_PAL8: ctx->best_csp=IMGFMT_BGR8;break; //8bps,mrle,cram
#if CONFIG_XVMC
case PIX_FMT_XVMC_MPEG2_MC:ctx->best_csp=IMGFMT_XVMC_MOCO_MPEG2;break;
case PIX_FMT_XVMC_MPEG2_IDCT:ctx->best_csp=IMGFMT_XVMC_IDCT_MPEG2;break;
#endif
default:
ctx->best_csp=0;
}
if (!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h, ctx->best_csp))
return -1;
ctx->vo_initialized = 1;
default:
ctx->best_csp=0;
}
if (!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h, ctx->best_csp))
return -1;
ctx->vo_initialized = 1;
}
return 0;
}
@ -596,32 +581,32 @@ static int get_buffer(AVCodecContext *avctx, AVFrame *pic){
}
mpi= mpcodecs_get_image(sh,type, flags,
(width+align)&(~align), (height+align)&(~align));
(width+align)&(~align), (height+align)&(~align));
// ok, let's see what did we get:
if( mpi->flags&MP_IMGFLAG_DRAW_CALLBACK &&
!(mpi->flags&MP_IMGFLAG_DIRECT)){
// nice, filter/vo likes draw_callback :)
avctx->draw_horiz_band= draw_slice;
// nice, filter/vo likes draw_callback :)
avctx->draw_horiz_band= draw_slice;
} else
avctx->draw_horiz_band= NULL;
avctx->draw_horiz_band= NULL;
// Palette support: libavcodec copies palette to *data[1]
if (mpi->bpp == 8)
mpi->planes[1] = av_malloc(AVPALETTE_SIZE);
// Palette support: libavcodec copies palette to *data[1]
if (mpi->bpp == 8)
mpi->planes[1] = av_malloc(AVPALETTE_SIZE);
pic->data[0]= mpi->planes[0];
pic->data[1]= mpi->planes[1];
pic->data[2]= mpi->planes[2];
#if 0
#if 0
assert(mpi->width >= ((width +align)&(~align)));
assert(mpi->height >= ((height+align)&(~align)));
assert(mpi->stride[0] >= mpi->width);
if(mpi->imgfmt==IMGFMT_I420 || mpi->imgfmt==IMGFMT_YV12 || mpi->imgfmt==IMGFMT_IYUV){
const int y_size= mpi->stride[0] * (mpi->h-1) + mpi->w;
const int c_size= mpi->stride[1] * ((mpi->h>>1)-1) + (mpi->w>>1);
assert(mpi->planes[0] > mpi->planes[1] || mpi->planes[0] + y_size <= mpi->planes[1]);
assert(mpi->planes[0] > mpi->planes[2] || mpi->planes[0] + y_size <= mpi->planes[2]);
assert(mpi->planes[1] > mpi->planes[0] || mpi->planes[1] + c_size <= mpi->planes[0]);
@ -650,13 +635,13 @@ else
#endif
if(pic->reference){
pic->age= ctx->ip_age[0];
ctx->ip_age[0]= ctx->ip_age[1]+1;
ctx->ip_age[1]= 1;
ctx->b_age++;
}else{
pic->age= ctx->b_age;
ctx->ip_age[0]++;
ctx->ip_age[1]++;
ctx->b_age=1;
@ -671,7 +656,7 @@ static void release_buffer(struct AVCodecContext *avctx, AVFrame *pic){
vd_ffmpeg_ctx *ctx = sh->context;
int i;
//printf("release buffer %d %d %d\n", mpi ? mpi->flags&MP_IMGFLAG_PRESERVE : -99, ctx->ip_count, ctx->b_count);
//printf("release buffer %d %d %d\n", mpi ? mpi->flags&MP_IMGFLAG_PRESERVE : -99, ctx->ip_count, ctx->b_count);
if(ctx->ip_count <= 2 && ctx->b_count<=1){
if(mpi->flags&MP_IMGFLAG_PRESERVE)
@ -680,9 +665,9 @@ static void release_buffer(struct AVCodecContext *avctx, AVFrame *pic){
ctx->b_count--;
}
// Palette support: free palette buffer allocated in get_buffer
if ( mpi && (mpi->bpp == 8))
av_freep(&mpi->planes[1]);
// Palette support: free palette buffer allocated in get_buffer
if ( mpi && (mpi->bpp == 8))
av_freep(&mpi->planes[1]);
if(pic->type!=FF_BUFFER_TYPE_USER){
avcodec_default_release_buffer(avctx, pic);
@ -698,10 +683,10 @@ static void release_buffer(struct AVCodecContext *avctx, AVFrame *pic){
// copypaste from demux_real.c - it should match to get it working!
//FIXME put into some header
typedef struct dp_hdr_s {
uint32_t chunks; // number of chunks
uint32_t chunks; // number of chunks
uint32_t timestamp; // timestamp from packet header
uint32_t len; // length of actual data
uint32_t chunktab; // offset to chunk offset array
uint32_t len; // length of actual data
uint32_t chunktab; // offset to chunk offset array
} dp_hdr_t;
static void swap_palette(void *pal) {
@ -729,13 +714,13 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
avctx->draw_horiz_band=NULL;
avctx->opaque=sh;
if(ctx->vo_initialized && !(flags&3) && !dr1){
mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, MP_IMGFLAG_PRESERVE |
(ctx->do_slices?MP_IMGFLAG_DRAW_CALLBACK:0),
sh->disp_w, sh->disp_h);
if(mpi && mpi->flags&MP_IMGFLAG_DRAW_CALLBACK){
// vd core likes slices!
avctx->draw_horiz_band=draw_slice;
}
mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, MP_IMGFLAG_PRESERVE |
(ctx->do_slices?MP_IMGFLAG_DRAW_CALLBACK:0),
sh->disp_w, sh->disp_h);
if(mpi && mpi->flags&MP_IMGFLAG_DRAW_CALLBACK){
// vd core likes slices!
avctx->draw_horiz_band=draw_slice;
}
}
avctx->hurry_up=(flags&3)?((flags&2)?2:1):0;
@ -743,7 +728,7 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
mp_msg(MSGT_DECVIDEO, MSGL_DBG2, "vd_ffmpeg data: %04x, %04x, %04x, %04x\n",
((int *)data)[0], ((int *)data)[1], ((int *)data)[2], ((int *)data)[3]);
ret = avcodec_decode_video(avctx, pic,
&got_picture, data, len);
&got_picture, data, len);
dr1= ctx->do_dr1;
if(ret<0) mp_msg(MSGT_DECVIDEO,MSGL_WARN, "Error while decoding frame!\n");
@ -756,7 +741,7 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
static int frame_number=0;
static double all_frametime=0.0;
AVFrame *pic= avctx->coded_frame;
double quality=0.0;
double quality=0.0;
if(!fvstats) {
time_t today2;
@ -774,19 +759,19 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
}
}
// average MB quantizer
{
int x, y;
int w = ((avctx->width << ctx->lowres)+15) >> 4;
int h = ((avctx->height << ctx->lowres)+15) >> 4;
int8_t *q = pic->qscale_table;
for( y = 0; y < h; y++ ) {
for( x = 0; x < w; x++ )
quality += (double)*(q+x);
q += pic->qstride;
}
quality /= w * h;
}
// average MB quantizer
{
int x, y;
int w = ((avctx->width << ctx->lowres)+15) >> 4;
int h = ((avctx->height << ctx->lowres)+15) >> 4;
int8_t *q = pic->qscale_table;
for( y = 0; y < h; y++ ) {
for( x = 0; x < w; x++ )
quality += (double)*(q+x);
q += pic->qstride;
}
quality /= w * h;
}
all_len+=len;
all_frametime+=sh->frametime;
@ -795,48 +780,48 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
fprintf(fvstats, "time= %0.3f br= %7.1fkbits/s avg_br= %7.1fkbits/s ",
all_frametime, (double)(len*8)/sh->frametime/1000.0,
(double)(all_len*8)/all_frametime/1000.0);
switch(pic->pict_type){
case FF_I_TYPE:
switch(pic->pict_type){
case FF_I_TYPE:
fprintf(fvstats, "type= I\n");
break;
case FF_P_TYPE:
break;
case FF_P_TYPE:
fprintf(fvstats, "type= P\n");
break;
case FF_S_TYPE:
break;
case FF_S_TYPE:
fprintf(fvstats, "type= S\n");
break;
case FF_B_TYPE:
break;
case FF_B_TYPE:
fprintf(fvstats, "type= B\n");
break;
default:
break;
default:
fprintf(fvstats, "type= ? (%d)\n", pic->pict_type);
break;
}
break;
}
ctx->qp_stat[(int)(quality+0.5)]++;
ctx->qp_sum += quality;
ctx->inv_qp_sum += 1.0/(double)quality;
break;
}
//--
if(!got_picture) return NULL; // skipped image
if(!got_picture) return NULL; // skipped image
if(init_vo(sh,avctx->pix_fmt) < 0) return NULL;
if(dr1 && pic->opaque){
mpi= (mp_image_t*)pic->opaque;
}
if(!mpi)
mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, MP_IMGFLAG_PRESERVE,
avctx->width, avctx->height);
if(!mpi){ // temporary!
mp_msg(MSGT_DECVIDEO, MSGL_WARN, MSGTR_MPCODECS_CouldntAllocateImageForCodec);
return NULL;
avctx->width, avctx->height);
if(!mpi){ // temporary!
mp_msg(MSGT_DECVIDEO, MSGL_WARN, MSGTR_MPCODECS_CouldntAllocateImageForCodec);
return NULL;
}
if(!dr1){
mpi->planes[0]=pic->data[0];
mpi->planes[1]=pic->data[1];
@ -845,16 +830,16 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
mpi->stride[1]=pic->linesize[1];
mpi->stride[2]=pic->linesize[2];
}
if (!mpi->planes[0])
return NULL;
return NULL;
if(avctx->pix_fmt==PIX_FMT_YUV422P && mpi->chroma_y_shift==1){
// we have 422p but user wants 420p
mpi->stride[1]*=2;
mpi->stride[2]*=2;
// we have 422p but user wants 420p
mpi->stride[1]*=2;
mpi->stride[2]*=2;
}
#ifdef WORDS_BIGENDIAN
// FIXME: this might cause problems for buffers with FF_BUFFER_HINTS_PRESERVE
if (mpi->bpp == 8)
@ -867,14 +852,14 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
mpi->qscale_type= pic->qscale_type;
mpi->fields = MP_IMGFIELD_ORDERED;
if(pic->interlaced_frame) mpi->fields |= MP_IMGFIELD_INTERLACED;
if(pic->top_field_first ) mpi->fields |= MP_IMGFIELD_TOP_FIRST;
if(pic->top_field_first ) mpi->fields |= MP_IMGFIELD_TOP_FIRST;
if(pic->repeat_pict == 1) mpi->fields |= MP_IMGFIELD_REPEAT_FIRST;
return mpi;
}
#if CONFIG_XVMC
static enum PixelFormat get_format(struct AVCodecContext * avctx,
static enum PixelFormat get_format(struct AVCodecContext * avctx,
const enum PixelFormat * fmt){
sh_video_t * sh = avctx->opaque;
int i;
@ -893,7 +878,7 @@ int i;
for(i=0;fmt[i]!=-1;i++){
mp_msg(MSGT_DECVIDEO, MSGL_INFO, MSGTR_MPCODECS_TryingPixfmt,i);
if( init_vo(sh,fmt[i]) >= 0)
return fmt[i];
return fmt[i];
}
return fmt[0];
}
@ -903,9 +888,9 @@ static int mc_get_buffer(AVCodecContext *avctx, AVFrame *pic){
vd_ffmpeg_ctx *ctx = sh->context;
mp_image_t* mpi=NULL;
struct xvmc_render_state * render;
int flags= MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_PREFER_ALIGNED_STRIDE|
int flags= MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_PREFER_ALIGNED_STRIDE|
MP_IMGFLAG_DRAW_CALLBACK;
// printf("vd_ffmpeg::mc_get_buffer (xvmc) %d %d %d\n", pic->reference, ctx->ip_count, ctx->b_count);
if(!avctx->xvmc_acceleration){
mp_msg(MSGT_DECVIDEO, MSGL_INFO, MSGTR_MPCODECS_McGetBufferShouldWorkOnlyWithXVMC);
@ -941,14 +926,14 @@ static int mc_get_buffer(AVCodecContext *avctx, AVFrame *pic){
exit(1);
// return -1;//!!fixme check error conditions in ffmpeg
};
if( (mpi->flags & MP_IMGFLAG_DIRECT) == 0){
mp_msg(MSGT_DECVIDEO, MSGL_ERR, MSGTR_MPCODECS_OnlyBuffersAllocatedByVoXvmcAllowed);
assert(0);
exit(1);
// return -1;//!!fixme check error conditions in ffmpeg
}
pic->data[0]= mpi->planes[0];
pic->data[1]= mpi->planes[1];
pic->data[2]= mpi->planes[2];
@ -966,14 +951,14 @@ static int mc_get_buffer(AVCodecContext *avctx, AVFrame *pic){
if(pic->reference){
//I or P frame
pic->age= ctx->ip_age[0];
ctx->ip_age[0]= ctx->ip_age[1]+1;
ctx->ip_age[1]= 1;
ctx->b_age++;
}else{
//B frame
pic->age= ctx->b_age;
ctx->ip_age[0]++;
ctx->ip_age[1]++;
ctx->b_age=1;
@ -1021,14 +1006,14 @@ static void mc_release_buffer(AVCodecContext *avctx, AVFrame *pic){
static void mc_render_slice(struct AVCodecContext *s,
const AVFrame *src, int offset[4],
int y, int type, int height){
int y, int type, int height){
int width= s->width;
sh_video_t * sh = s->opaque;
uint8_t *source[3]= {src->data[0], src->data[1], src->data[2]};
assert(src->linesize[0]==0 && src->linesize[1]==0 && src->linesize[2]==0);
assert(offset[0]==0 && offset[1]==0 && offset[2]==0);
mpcodecs_draw_slice (sh, source, src->linesize, width, height, 0, y);
}

View File

@ -19,4 +19,6 @@
#define vo_screenheight global_vo->opts->vo_screenheight
#define vidmode global_vo->opts->vidmode
#define movie_aspect global_vo->opts->movie_aspect
#define calc_src_dst_rects(...) calc_src_dst_rects(global_vo, __VA_ARGS__)
#endif

View File

@ -416,6 +416,66 @@ int lookup_keymap_table(const struct keymap *map, int key) {
return map->to;
}
/**
* \brief helper function for the kind of panscan-scaling that needs a source
* and destination rectangle like Direct3D and VDPAU
*/
static void src_dst_split_scaling(int src_size, int dst_size, int scaled_src_size,
int *src_start, int *src_end, int *dst_start, int *dst_end) {
if (scaled_src_size > dst_size) {
int border = src_size * (scaled_src_size - dst_size) / scaled_src_size;
// round to a multiple of 2, this is at least needed for vo_direct3d and ATI cards
border = (border / 2 + 1) & ~1;
*src_start = border;
*src_end = src_size - border;
*dst_start = 0;
*dst_end = dst_size;
} else {
*src_start = 0;
*src_end = src_size;
*dst_start = (dst_size - scaled_src_size) / 2;
*dst_end = *dst_start + scaled_src_size;
}
}
/**
* Calculate the appropriate source and destination rectangle to
* get a correctly scaled picture, including pan-scan.
* Can be extended to take future cropping support into account.
*
* \param crop specifies the cropping border size in the left, right, top and bottom members, may be NULL
*/
void calc_src_dst_rects(struct vo *vo, int src_width, int src_height, struct vo_rect *src, struct vo_rect *dst, struct vo_rect *crop) {
static const struct vo_rect no_crop = {0, 0, 0, 0, 0, 0};
int scaled_width = 0;
int scaled_height = 0;
if (!crop) crop = &no_crop;
src_width -= crop->left + crop->right;
src_height -= crop->top + crop->bottom;
if (src_width < 2) src_width = 2;
if (src_height < 2) src_height = 2;
dst->left = 0; dst->right = vo->dwidth;
dst->top = 0; dst->bottom = vo->dheight;
src->left = 0; src->right = src_width;
src->top = 0; src->bottom = src_height;
if (vo_fs) {
aspect(vo, &scaled_width, &scaled_height, A_ZOOM);
panscan_calc(vo);
scaled_width += vo->panscan_x;
scaled_height += vo->panscan_y;
src_dst_split_scaling(src_width, vo->dwidth, scaled_width,
&src->left, &src->right, &dst->left, &dst->right);
src_dst_split_scaling(src_height, vo->dheight, scaled_height,
&src->top, &src->bottom, &dst->top, &dst->bottom);
}
src->left += crop->left; src->right += crop->left;
src->top += crop->top; src->bottom += crop->top;
src->width = src->right - src->left;
src->height = src->bottom - src->top;
dst->width = dst->right - dst->left;
dst->height = dst->bottom - dst->top;
}
#if defined(CONFIG_FBDEV) || defined(CONFIG_VESA)
/* Borrowed from vo_fbdev.c
Monitor ranges related functions*/

View File

@ -318,5 +318,9 @@ struct keymap {
int to;
};
int lookup_keymap_table(const struct keymap *map, int key);
struct vo_rect {
int left, right, top, bottom, width, height;
};
void calc_src_dst_rects(struct vo *vo, int src_width, int src_height, struct vo_rect *src, struct vo_rect *dst, struct vo_rect *crop);
#endif /* MPLAYER_VIDEO_OUT_H */

View File

@ -147,47 +147,18 @@ typedef enum back_buffer_action {
*/
static void calc_fs_rect(void)
{
int scaled_height = 0;
int scaled_width = 0;
struct vo_rect src_rect;
struct vo_rect dst_rect;
calc_src_dst_rects(priv->src_width, priv->src_height, &src_rect, &dst_rect, NULL);
// set default values
priv->fs_movie_rect.left = 0;
priv->fs_movie_rect.right = vo_dwidth;
priv->fs_movie_rect.top = 0;
priv->fs_movie_rect.bottom = vo_dheight;
priv->fs_panscan_rect.left = 0;
priv->fs_panscan_rect.right = priv->src_width;
priv->fs_panscan_rect.top = 0;
priv->fs_panscan_rect.bottom = priv->src_height;
if (!vo_fs)
return;
// adjust for fullscreen aspect and panscan
aspect(&scaled_width, &scaled_height, A_ZOOM);
panscan_calc();
scaled_width += vo_panscan_x;
scaled_height += vo_panscan_y;
// note: border is rounded to a multiple of two since at least
// ATI drivers can not handle odd values with YV12 input
if (scaled_width > vo_dwidth) {
int border = priv->src_width * (scaled_width - vo_dwidth) / scaled_width;
border = (border / 2 + 1) & ~1;
priv->fs_panscan_rect.left = border;
priv->fs_panscan_rect.right = priv->src_width - border;
} else {
priv->fs_movie_rect.left = (vo_dwidth - scaled_width) / 2;
priv->fs_movie_rect.right = priv->fs_movie_rect.left + scaled_width;
}
if (scaled_height > vo_dheight) {
int border = priv->src_height * (scaled_height - vo_dheight) / scaled_height;
border = (border / 2 + 1) & ~1;
priv->fs_panscan_rect.top = border;
priv->fs_panscan_rect.bottom = priv->src_height - border;
} else {
priv->fs_movie_rect.top = (vo_dheight - scaled_height) / 2;
priv->fs_movie_rect.bottom = priv->fs_movie_rect.top + scaled_height;
}
priv->fs_movie_rect.left = dst_rect.left;
priv->fs_movie_rect.right = dst_rect.right;
priv->fs_movie_rect.top = dst_rect.top;
priv->fs_movie_rect.bottom = dst_rect.bottom;
priv->fs_panscan_rect.left = src_rect.left;
priv->fs_panscan_rect.right = src_rect.right;
priv->fs_panscan_rect.top = src_rect.top;
priv->fs_panscan_rect.bottom = src_rect.bottom;
mp_msg(MSGT_VO, MSGL_V,
"<vo_direct3d>Fullscreen movie rectangle: t: %ld, l: %ld, r: %ld, b:%ld\n",

View File

@ -106,7 +106,8 @@ struct xvctx {
uint32_t image_height;
uint32_t image_format;
int is_paused;
uint32_t drwX, drwY;
struct vo_rect src_rect;
struct vo_rect dst_rect;
uint32_t max_width, max_height; // zero means: not set
int event_fd_registered; // for uninit called from preinit
int mode_switched;
@ -180,6 +181,17 @@ static void draw_alpha_null(void *p, int x0, int y0, int w, int h,
static void deallocate_xvimage(struct vo *vo, int foo);
static void resize(struct vo *vo)
{
struct xvctx *ctx = vo->priv;
calc_src_dst_rects(vo, ctx->image_width, ctx->image_height, &ctx->src_rect,
&ctx->dst_rect, NULL);
struct vo_rect *dst = &ctx->dst_rect;
vo_x11_clearwindow_part(vo, vo->x11->window, dst->width, dst->height, 1);
vo_xv_draw_colorkey(vo, dst->left, dst->top, dst->width, dst->height);
}
/*
* connect to server, create and map window,
* allocate colors and (shared) memory
@ -307,17 +319,8 @@ static int config(struct vo *vo, uint32_t width, uint32_t height,
if ((flags & VOFLAG_FULLSCREEN) && WinID <= 0)
vo_fs = 1;
vo_calc_drwXY(vo, &ctx->drwX, &ctx->drwY);
panscan_calc(vo);
vo_xv_draw_colorkey(vo, ctx->drwX - (vo->panscan_x >> 1),
ctx->drwY - (vo->panscan_y >> 1),
vo->dwidth + vo->panscan_x - 1,
vo->dheight + vo->panscan_y - 1);
mp_msg(MSGT_VO, MSGL_V, "[xv] dx: %d dy: %d dw: %d dh: %d\n", ctx->drwX,
ctx->drwY, vo->dwidth, vo->dheight);
resize(vo);
return 0;
}
@ -391,22 +394,20 @@ static inline void put_xvimage(struct vo *vo, XvImage *xvi)
{
struct xvctx *ctx = vo->priv;
struct vo_x11_state *x11 = vo->x11;
struct vo_rect *src = &ctx->src_rect;
struct vo_rect *dst = &ctx->dst_rect;
#ifdef HAVE_SHM
if (ctx->Shmem_Flag) {
XvShmPutImage(x11->display, x11->xv_port, x11->window, x11->vo_gc, xvi,
0, 0, ctx->image_width, ctx->image_height,
ctx->drwX - (vo->panscan_x >> 1),
ctx->drwY - (vo->panscan_y >> 1),
vo->dwidth + vo->panscan_x, vo->dheight + vo->panscan_y,
src->left, src->top, src->width, src->height,
dst->left, dst->top, dst->width, dst->height,
False);
} else
#endif
{
XvPutImage(x11->display, x11->xv_port, x11->window, x11->vo_gc, xvi, 0,
0, ctx->image_width, ctx->image_height,
ctx->drwX - (vo->panscan_x >> 1),
ctx->drwY - (vo->panscan_y >> 1),
vo->dwidth + vo->panscan_x, vo->dheight + vo->panscan_y);
XvPutImage(x11->display, x11->xv_port, x11->window, x11->vo_gc, xvi,
src->left, src->top, src->width, src->height,
dst->left, dst->top, dst->width, dst->height);
}
}
@ -428,15 +429,8 @@ static void check_events(struct vo *vo)
struct vo_x11_state *x11 = vo->x11;
int e = vo_x11_check_events(vo);
if (e & VO_EVENT_RESIZE)
vo_calc_drwXY(vo, &ctx->drwX, &ctx->drwY);
if (e & VO_EVENT_EXPOSE || e & VO_EVENT_RESIZE) {
vo_xv_draw_colorkey(vo, ctx->drwX - (vo->panscan_x >> 1),
ctx->drwY - (vo->panscan_y >> 1),
vo->dwidth + vo->panscan_x - 1,
vo->dheight + vo->panscan_y - 1);
}
if (e & VO_EVENT_EXPOSE || e & VO_EVENT_RESIZE)
resize(vo);
if ((e & VO_EVENT_EXPOSE || e & VO_EVENT_RESIZE) && ctx->is_paused) {
/* did we already draw a buffer */
@ -831,13 +825,7 @@ static int control(struct vo *vo, uint32_t request, void *data)
panscan_calc(vo);
if (old_y != vo->panscan_y) {
vo_x11_clearwindow_part(vo, x11->window,
vo->dwidth + vo->panscan_x - 1,
vo->dheight + vo->panscan_y - 1, 1);
vo_xv_draw_colorkey(vo, ctx->drwX - (vo->panscan_x >> 1),
ctx->drwY - (vo->panscan_y >> 1),
vo->dwidth + vo->panscan_x - 1,
vo->dheight + vo->panscan_y - 1);
resize(vo);
flip_page(vo);
}
}

View File

@ -81,7 +81,6 @@ static int top_field_first;
static int image_width,image_height;
static int image_format;
static uint32_t drwX,drwY;
#define NO_SUBPICTURE 0
#define OVERLAY_SUBPICTURE 1
@ -676,11 +675,6 @@ skip_surface_allocation:
}
if ((flags & VOFLAG_FULLSCREEN) && WinID <= 0) vo_fs = 1;
vo_calc_drwXY(&drwX, &drwY);
panscan_calc();
mp_msg(MSGT_VO,MSGL_V, "[xvmc] dx: %d dy: %d dw: %d dh: %d\n",drwX,drwY,vo_dwidth,vo_dheight );
//end vo_xv
@ -950,19 +944,16 @@ int status,rez;
static void put_xvmc_image(struct xvmc_render_state * p_render_surface,
int draw_ck){
int rez;
int clipX,clipY,clipW,clipH;
struct vo_rect src_rect, dst_rect;
int i;
if(p_render_surface == NULL)
return;
clipX = drwX-(vo_panscan_x>>1);
clipY = drwY-(vo_panscan_y>>1);
clipW = vo_dwidth+vo_panscan_x;
clipH = vo_dheight+vo_panscan_y;
calc_src_dst_rects(image_width, image_height, &src_rect, &dst_rect, NULL);
if(draw_ck)
vo_xv_draw_colorkey(clipX,clipY,clipW,clipH);
vo_xv_draw_colorkey(dst_rect.left, dst_rect.top, dst_rect.width, dst_rect.height);
if(benchmark)
return;
@ -971,8 +962,8 @@ int i;
int field = top_field_first ? i : i ^ 3;
rez = XvMCPutSurface(mDisplay, p_render_surface->p_surface,
vo_window,
0, 0, image_width, image_height,
clipX, clipY, clipW, clipH,
src_rect.left, src_rect.top, src_rect.width, src_rect.height,
dst_rect.left, dst_rect.top, dst_rect.width, dst_rect.height,
bob_deinterlace ? field : 3);
//p_render_surface_to_show->display_flags);
if(rez != Success){
@ -1036,8 +1027,6 @@ int e=vo_x11_check_events(mDisplay);
if(e&VO_EVENT_RESIZE)
{
e |= VO_EVENT_EXPOSE;
vo_calc_drwXY(&drwX, &drwY);
}
if ( e & VO_EVENT_EXPOSE )
{

View File

@ -811,8 +811,12 @@ int vo_x11_check_events(struct vo *vo)
// if (vo_fs && Event.xconfigure.width != opts->vo_screenwidth && Event.xconfigure.height != opts->vo_screenheight) break;
if (x11->window == None)
break;
vo_x11_update_geometry(vo);
ret |= VO_EVENT_RESIZE;
{
int old_w = vo->dwidth, old_h = vo->dheight;
vo_x11_update_geometry(vo);
if (vo->dwidth != old_w || vo->dheight != old_h)
ret |= VO_EVENT_RESIZE;
}
break;
case KeyPress:
{
@ -1868,24 +1872,6 @@ uint32_t vo_x11_get_equalizer(char *name, int *value)
return VO_TRUE;
}
void vo_calc_drwXY(struct vo *vo, uint32_t *drwX, uint32_t *drwY)
{
struct MPOpts *opts = vo->opts;
*drwX = *drwY = 0;
if (vo_fs) {
aspect(vo, &vo->dwidth, &vo->dheight, A_ZOOM);
vo->dwidth = FFMIN(vo->dwidth, opts->vo_screenwidth);
vo->dheight = FFMIN(vo->dheight, opts->vo_screenheight);
*drwX = (opts->vo_screenwidth - vo->dwidth) / 2;
*drwY = (opts->vo_screenheight - vo->dheight) / 2;
mp_msg(MSGT_VO, MSGL_V, "[xv-fs] dx: %d dy: %d dw: %d dh: %d\n", *drwX,
*drwY, vo->dwidth, vo->dheight);
} else if (WinID == 0) {
*drwX = vo->dx;
*drwY = vo->dy;
}
}
#ifdef CONFIG_XV
int vo_xv_set_eq(struct vo *vo, uint32_t xv_port, char *name, int value)
{

View File

@ -172,8 +172,6 @@ void vo_vm_close(struct vo *vo);
void update_xinerama_info(struct vo *vo);
int vo_find_depth_from_visuals(Display *dpy, int screen, Visual **visual_return);
void vo_calc_drwXY(struct vo *vo, uint32_t *drwX, uint32_t *drwY);
void xscreensaver_heartbeat(struct vo_x11_state *x11);
// Old VOs use incompatible function calls, translate them to new
@ -204,7 +202,6 @@ void xscreensaver_heartbeat(struct vo_x11_state *x11);
#define vo_x11_classhint(display, window, name) vo_x11_classhint(global_vo, window, name)
#define vo_x11_setlayer(display, window, layer) vo_x11_setlayer(global_vo, window, layer)
#define xv_setup_colorkeyhandling(a, b) xv_setup_colorkeyhandling(global_vo, a, b)
#define vo_calc_drwXY(drwX, drwY) vo_calc_drwXY(global_vo, drwX, drwY)
#define mDisplay global_vo->x11->display
#define vo_depthonscreen global_vo->x11->depthonscreen