1
0
mirror of https://github.com/mpv-player/mpv synced 2025-03-31 07:51:55 +00:00

Merge svn changes up to r28038

This commit is contained in:
Uoti Urpala 2008-11-25 21:12:01 +02:00
commit 835511ac39
20 changed files with 2549 additions and 2579 deletions

View File

@ -1,4 +1,4 @@
.\" synced with r27906 .\" synced with r27979
.\" Encoding: iso-8859-1 .\" Encoding: iso-8859-1
.\" MPlayer (C) 2000-2008 MPlayer Team .\" MPlayer (C) 2000-2008 MPlayer Team
.\" The English man page was/is done by Gabucino, Diego Biurrun, Jonas Jermann .\" The English man page was/is done by Gabucino, Diego Biurrun, Jonas Jermann
@ -3435,8 +3435,9 @@ La position initiale d
défini. défini.
Fontionnera généralement uniquement avec "\-fstype \-fullscreen" ou Fontionnera généralement uniquement avec "\-fstype \-fullscreen" ou
"\-fstype none". "\-fstype none".
Cette option ne convient pour définir l'écran de démarrage (de même pour Cette option ne convient pas pour définir l'écran de démarrage (car l'affichage
l'écran en mode plein écran), \-geometry est plus approprié. se fera toujours en plein écran sur le moniteur donné), \-geometry est plus
approprié.
Géré par les pilotes de sortie vidéo gl, gl2, x11, et xv. Géré par les pilotes de sortie vidéo gl, gl2, x11, et xv.
. .
.TP .TP
@ -3684,6 +3685,10 @@ Comme pour vidix
VIDIX tournant sous Windows. VIDIX tournant sous Windows.
. .
.TP .TP
.B direct3d (Windows uniquement) (CODE BÉTA!)
Pilote de sortie vidéo utilisant l'interface Direct3D (utilse sous Vista).
.
.TP
.B directx (Windows uniquement) .B directx (Windows uniquement)
Pilote de sortie vidéo utilisant l'interface DirectX. Pilote de sortie vidéo utilisant l'interface DirectX.
.PD 0 .PD 0

View File

@ -1096,137 +1096,141 @@ rozdzielczości DVD) żeby dobrze wyglądać.
</sect2> </sect2>
<!-- ********** --> <!-- ********** -->
<!-- synced 'till here -->
<sect2 id="menc-feat-dvd-mpeg4-filtering"> <sect2 id="menc-feat-dvd-mpeg4-filtering">
<title>Filtering</title> <title>Filtrowanie</title>
<para> <para>
Learning how to use <application>MEncoder</application>'s video filters Bardzo ważne do robienia dobrych kodowań jest nauczenie się posługiwania
is essential to producing good encodes. systemem filtrów <application>MEncodera</application>.
All video processing is performed through the filters -- cropping, Całe przetwarzanie video jest wykonywane przez filtry &ndash; kadrowanie, skalowanie,
scaling, color adjustment, noise removal, sharpening, deinterlacing, dopasowywanie kolorów, usuwanie szumu, telecine, odwrócone telecine, usuwanie
telecine, inverse telecine, and deblocking, just to name a few. bloków żeby wymienić choć część.
Along with the vast number of supported input formats, the variety of Poza dużą ilością obsługiwanych formatów wejściowych to właśnie zakres
filters available in <application>MEncoder</application> is one of its dostępnych filtrów jest jedną z głównych przewag
main advantages over other similar programs. <application>MEncodera</application> nad podobnymi programami.
</para> </para>
<para> <para>
Filters are loaded in a chain using the -vf option: Filtry są ładowane do łańcucha przy pomocy opcji -vf:
<screen>-vf filter1=options,filter2=options,...</screen> <screen>-vf filtr1=opcje,filtr2=opcje,...</screen>
Most filters take several numeric options separated by colons, but Większość filtrów przyjmuje kilka parametrów numerycznych oddzielanych
the syntax for options varies from filter to filter, so read the man dwukropkami, ale dokładna składnia zależy od filtru więc szczegóły odnośnie
page for details on the filters you wish to use. filtrów, które chcesz zastosować, znajdziesz na stronie man.
</para> </para>
<para> <para>
Filters operate on the video in the order they are loaded. Filtry działają na filmie w kolejnoścy w jakiej zostały załadowane.
For example, the following chain: Na przykład następujący łańcuch:
<screen>-vf crop=688:464:12:4,scale=640:464</screen> <screen>-vf crop=688:464:12:4,scale=640:464</screen>
will first crop the 688x464 region of the picture with upper-left najpierw skadruje fragment 688x464 filmu z lewym górnym rogiem na pozycji
corner at (12,4), and then scale the result down to 640x464. (12,4) a potem zmniejszy rozdzielczość wyniku do 640x464.
</para> </para>
<para> <para>
Certain filters need to be loaded at or near the beginning of the Niektóre filtry trzeba ładować na początku lub blisko początku łańcucha,
filter chain, in order to take advantage of information from the ponieważ korzystają one z informacji którą następne filtry mogą zgubić lub
video decoder that will be lost or invalidated by other filters. unieważnić.
The principal examples are <option>pp</option> (postprocessing, only Sztandarowym przykłądem jest <option>pp</option> (postprocessing, tylko gdy
when it is performing deblock or dering operations), wykonuje operacje usuwania bloków lub pierścieni),
<option>spp</option> (another postprocessor to remove MPEG artifacts), <option>spp</option> (inny postprocessor do usuwania artefaktów MPEG),
<option>pullup</option> (inverse telecine), and <option>pullup</option> (odwrócone telecine) i
<option>softpulldown</option> (for converting soft telecine to hard telecine). <option>softpulldown</option> (konwertuje miękkie telecine na twarde).
</para> </para>
<para> <para>
In general, you want to do as little filtering as possible to the movie W ogólności chcesz przeprowadzać jak najmniej filtrowania żeby film pozostał
in order to remain close to the original DVD source. Cropping is often możliwie bliski oryginałowi.
necessary (as described above), but avoid to scale the video. Although Kadrowanie często jest niezbęne (jak opisano powyżej) ale staraj się uniknąć
scaling down is sometimes preferred to using higher quantizers, we want skalowania.
to avoid both these things: remember that we decided from the start to Chociaż czasami zmniejszenie rozdzielczości jest lepszym wyjściem niż użycie
trade bits for quality. wyższego kwantyzatora, chcemy uniknąć obu: pamiętajmy, że od początku
zdecydowaliśmy się wybrać jakość kosztem wielkości.
</para> </para>
<para> <para>
Also, do not adjust gamma, contrast, brightness, etc. What looks good Nie należy też dostosowywać gammy, kontrastu, jasności itp.
on your display may not look good on others. These adjustments should Co wygląda dobrze na Twoim ekranie może nie być tak dobre na innych.
be done on playback only. Takie dostrojenia powinny być wykonywane tylko przy odtwarzaniu.
</para> </para>
<para> <para>
One thing you might want to do, however, is pass the video through a Jedną rzeczą którą możesz chcieć zrobić, jest przepuszczenie filmu przez bardzo
very light denoise filter, such as <option>-vf hqdn3d=2:1:2</option>. lekkie usuwanie szumów, takie jak <option>-vf hqdn3d=2:1:2</option>.
Again, it is a matter of putting those bits to better use: why waste them Znów, to kwestia lepszego zastosowania bitów: po co marnować je na zakodowanie
encoding noise when you can just add that noise back in during playback? szumu skoro można dodać ten szum przy odtwarzaniu?
Increasing the parameters for <option>hqdn3d</option> will further Zwiększenie parametrów dla <option>hqdn3d</option> jeszcze bardziej poprawi
improve compressibility, but if you increase the values too much, you kompresowalność, ale jeśli przesadzisz to zauważalnie zniekształcisz obraz.
risk degrading the image visibly. The suggested values above Wartości sugerowane powyżej (<option>2:1:2</option>) są dość konserwatywne; nie
(<option>2:1:2</option>) are quite conservative; you should feel free to bój się eksperymentować z wyższymi wartościami i samemu oceniać wyniki.
experiment with higher values and observe the results for yourself.
</para> </para>
</sect2> </sect2>
<!-- ********** --> <!-- ********** -->
<sect2 id="menc-feat-dvd-mpeg4-interlacing"> <sect2 id="menc-feat-dvd-mpeg4-interlacing">
<title>Interlacing and Telecine</title> <title>Przeplot i telecine</title>
<para> <para>
Almost all movies are shot at 24 fps. Because NTSC is 30000/1001 fps, some Prawie wszystkie filmy są kręcone przy 24 fps.
processing must be done to this 24 fps video to make it run at the correct Ponieważ NTSC ma 30000/1001 fps potrzebna jest pewna przeróbka żeby film 24 fps
NTSC framerate. The process is called 3:2 pulldown, commonly referred to mógł być wyświetlany z prawidłową szybkością NTSC.
as telecine (because pulldown is often applied during the telecine Ten proces nazywa się 3:2 pulldown, często zwany też telecine (ponieważ jest
process), and, naively described, it works by slowing the film down to używany przy konwersji z kina do telewizji) i, w uproszczeniu, jest to
24000/1001 fps, and repeating every fourth frame. spowolnienie filmu do 24000/1001 fps i powtórzenie co czwartej klatki.
</para> </para>
<para> <para>
No special processing, however, is done to the video for PAL DVDs, which Filmy DVD PAL, odtwarzanie przy 25 fps, nie wymagają żadnego specjalnego
run at 25 fps. (Technically, PAL can be telecined, called 2:2 pulldown, traktowania.
but this does not become an issue in practice.) The 24 fps film is simply (Technicznie rzecz ujmując, PAL może być poddany telecine, nazywanemu 2:2
played back at 25 fps. The result is that the movie runs slightly faster, pulldown, ale w praktyce nie jest to problemem.)
but unless you are an alien, you probably will not notice the difference. Po prostu film 24 fps jest odtwarzany przy 25 fps.
Most PAL DVDs have pitch-corrected audio, so when they are played back at W wyniku tego film jest odtwarzany odrobinkę szybciej, ale jeśli nie masz
25 fps things will sound right, even though the audio track (and hence the nieziemskich zmysłów to tego nie zauważysz.
whole movie) has a running time that is 4% less than NTSC DVDs. Większość DVD PAL ma skorygowaną wysokość dźwięku, więc kiedy są odtwarzane
przy 25 fps dźwięk będzie brzmiał poprawnie, mimo tego że ścieżka dźwiekowa
(jak i cały film) jest o 4% krótsza niż DVD NTSC.
</para> </para>
<para> <para>
Because the video in a PAL DVD has not been altered, you need not worry Ponieważ film na DVD PAL nie został zmieniony, nie ma powodu za bardzo
much about framerate. The source is 25 fps, and your rip will be 25 przejmować się framerate.
fps. However, if you are ripping an NTSC DVD movie, you may need to Oryginał ma 25 fps i Twój rip też będzie miał 25 fps.
apply inverse telecine. Jednak jeśli ripujesz film z DVD NTSC możesz być zmuszony do zastosowania
odwrotnego telecine.
</para> </para>
<para> <para>
For movies shot at 24 fps, the video on the NTSC DVD is either telecined Dla filmów nagrywanych przy 24 fps obraz na DVD NTSC jest albo poddany telecine
30000/1001, or else it is progressive 24000/1001 fps and intended to be na 30000/1001 albo jest progresywny przy 24000/1001 i&nbsp;przeznaczony do poddania
telecined on-the-fly by a DVD player. On the other hand, TV series are usually telecine w locie przez odtwarzacz DVD.
only interlaced, not telecined. This is not a hard rule: some TV series Z drugiej strony seriale telewizyjne zazwyczaj mają tylko przeplot, nie są poddane telecine.
are interlaced (such as Buffy the Vampire Slayer) whereas some are a Nie jest to reguła: Niektóre seriale (na przykład Buffy Łowca Wampirów) mają
mixture of progressive and interlaced (such as Angel, or 24). przeplot, a inne są mieszanką progresywnego i&nbsp;przeplotu (Angel, 24).
</para> </para>
<para> <para>
It is highly recommended that you read the section on Jest wysoce zalecane żebyś przeczytał sekcję
<!-- TODO przetłumaczyć tytuł -->
<link linkend="menc-feat-telecine">How to deal with telecine and interlacing in NTSC DVDs</link> <link linkend="menc-feat-telecine">How to deal with telecine and interlacing in NTSC DVDs</link>
to learn how to handle the different possibilities. żeby dowiedzieć się jak sobie radzić z&nbsp;różnymi możliwościami.
</para> </para>
<para> <para>
However, if you are mostly just ripping movies, likely you are either Jednak jeśli zazwyczaj tylko ripujesz filmy, prawdopodobnie masz doczynienia
dealing with 24 fps progressive or telecined video, in which case you can z filmem 24 fps progresywnym lub poddanym telecine, a w takim przypadku możesz
use the <option>pullup</option> filter <option>-vf użyć filtra <option>pullup</option> podając parametr
pullup,softskip</option>. <option>-vf pullup,softskip</option>.
</para> </para>
</sect2> </sect2>
<!-- ********** --> <!-- ********** -->
<!-- synced 'till here -->
<sect2 id="menc-feat-dvd-mpeg4-encoding-interlaced"> <sect2 id="menc-feat-dvd-mpeg4-encoding-interlaced">
<title>Encoding interlaced video</title> <title>Encoding interlaced video</title>

32
configure vendored
View File

@ -1488,7 +1488,7 @@ if test "`basename $_cc`" = "icc" || test "`basename $_cc`" = "ecc"; then
cc_version="v. ?.??, bad" cc_version="v. ?.??, bad"
cc_fail=yes cc_fail=yes
;; ;;
10.1) 10.1|11.0)
cc_version="$cc_version, ok" cc_version="$cc_version, ok"
;; ;;
*) *)
@ -3582,9 +3582,23 @@ if test "$_macosx" = auto ; then
fi fi
if test "$_macosx" = yes ; then if test "$_macosx" = yes ; then
cat > $TMPC <<EOF cat > $TMPC <<EOF
#include <CoreAudio/CoreAudio.h>
int main(void) { return 0; }
EOF
if cc_check -framework CoreAudio; then
_ld_extra="$_ld_extra -framework CoreAudio -framework AudioUnit -framework AudioToolbox"
_coreaudio=yes
_def_coreaudio='#define CONFIG_COREAUDIO 1'
_aosrc="$_aosrc ao_macosx.c"
_aomodules="macosx $_aomodules"
else
_coreaudio=no
_def_coreaudio='#undef CONFIG_COREAUDIO'
_noaomodules="macosx $_noaomodules"
fi
cat > $TMPC <<EOF
#include <Carbon/Carbon.h> #include <Carbon/Carbon.h>
#include <QuickTime/QuickTime.h> #include <QuickTime/QuickTime.h>
#include <CoreAudio/CoreAudio.h>
int main(void) { int main(void) {
EnterMovies(); EnterMovies();
ExitMovies(); ExitMovies();
@ -3592,21 +3606,15 @@ int main(void) {
return 0; return 0;
} }
EOF EOF
if cc_check -framework Carbon -framework QuickTime -framework CoreAudio; then if cc_check -framework Carbon -framework QuickTime; then
_ld_extra="$_ld_extra -framework Carbon -framework QuickTime -framework CoreAudio -framework AudioUnit -framework AudioToolbox" _ld_extra="$_ld_extra -framework Carbon -framework QuickTime"
_coreaudio=yes _quartz=yes
_def_coreaudio='#define CONFIG_COREAUDIO 1'
_aosrc="$_aosrc ao_macosx.c"
_aomodules="macosx $_aomodules"
_def_quartz='#define CONFIG_QUARTZ 1' _def_quartz='#define CONFIG_QUARTZ 1'
_vosrc="$_vosrc vo_quartz.c" _vosrc="$_vosrc vo_quartz.c"
_vomodules="quartz $_vomodules" _vomodules="quartz $_vomodules"
_def_quicktime='#define CONFIG_QUICKTIME 1' _def_quicktime='#define CONFIG_QUICKTIME 1'
else else
_macosx=no _quartz=yes
_coreaudio=no
_def_coreaudio='#undef CONFIG_COREAUDIO'
_noaomodules="macosx $_noaomodules"
_def_quartz='#undef CONFIG_QUARTZ' _def_quartz='#undef CONFIG_QUARTZ'
_novomodules="quartz $_novomodules" _novomodules="quartz $_novomodules"
_def_quicktime='#undef CONFIG_QUICKTIME' _def_quicktime='#undef CONFIG_QUICKTIME'

View File

@ -57,10 +57,17 @@ static int has_cpuid(void)
long a, c; long a, c;
// code from libavcodec: // code from libavcodec:
#ifdef ARCH_X86_64
#define PUSHF "pushfq\n\t"
#define POPF "popfq\n\t"
#else
#define PUSHF "pushfl\n\t"
#define POPF "popfl\n\t"
#endif
__asm__ volatile ( __asm__ volatile (
/* See if CPUID instruction is supported ... */ /* See if CPUID instruction is supported ... */
/* ... Get copies of EFLAGS into eax and ecx */ /* ... Get copies of EFLAGS into eax and ecx */
"pushf\n\t" PUSHF
"pop %0\n\t" "pop %0\n\t"
"mov %0, %1\n\t" "mov %0, %1\n\t"
@ -68,15 +75,17 @@ static int has_cpuid(void)
/* to the EFLAGS reg */ /* to the EFLAGS reg */
"xor $0x200000, %0\n\t" "xor $0x200000, %0\n\t"
"push %0\n\t" "push %0\n\t"
"popf\n\t" POPF
/* ... Get the (hopefully modified) EFLAGS */ /* ... Get the (hopefully modified) EFLAGS */
"pushf\n\t" PUSHF
"pop %0\n\t" "pop %0\n\t"
: "=a" (a), "=c" (c) : "=a" (a), "=c" (c)
: :
: "cc" : "cc"
); );
#undef PUSHF
#undef POPF
return a != c; return a != c;
} }

View File

@ -3491,6 +3491,15 @@ audiocodec vorbis
driver libvorbis driver libvorbis
dll "libvorbis" dll "libvorbis"
audiocodec tremor
info "OggVorbis audio decoder"
status working
comment "OggVorbis fixed-point decoder useful for ARM based systems"
fourcc vrbs
format 0x566F
driver tremor
dll "tremor"
audiocodec vorbisacm audiocodec vorbisacm
info "OggVorbis ACM" info "OggVorbis ACM"
status working status working

View File

@ -12,7 +12,11 @@
static const ad_info_t info = static const ad_info_t info =
{ {
"Ogg/Vorbis audio decoder", "Ogg/Vorbis audio decoder",
#ifdef CONFIG_TREMOR
"tremor",
#else
"libvorbis", "libvorbis",
#endif
"Felix Buenemann, A'rpi", "Felix Buenemann, A'rpi",
"libvorbis", "libvorbis",
"" ""

View File

@ -41,11 +41,11 @@ struct vf_priv_s {
//===========================================================================// //===========================================================================//
static int config(struct vf_instance* vf, static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height, int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt) unsigned int flags, unsigned int outfmt)
{ {
vf->priv->ctx=sws_getContextFromCmdLine(width, height, outfmt, vf->priv->ctx=sws_getContextFromCmdLine(width, height, outfmt,
d_width, d_height, IMGFMT_RGB24); d_width, d_height, IMGFMT_RGB24);
vf->priv->outbuffer_size = d_width * d_height * 3 * 2; vf->priv->outbuffer_size = d_width * d_height * 3 * 2;
vf->priv->outbuffer = realloc(vf->priv->outbuffer, vf->priv->outbuffer_size); vf->priv->outbuffer = realloc(vf->priv->outbuffer, vf->priv->outbuffer_size);
@ -72,10 +72,10 @@ static void write_png(struct vf_priv_s *priv)
fp = fopen (fname, "wb"); fp = fopen (fname, "wb");
if (fp == NULL) { if (fp == NULL) {
mp_msg(MSGT_VFILTER,MSGL_ERR,"\nPNG Error opening %s for writing!\n", fname); mp_msg(MSGT_VFILTER,MSGL_ERR,"\nPNG Error opening %s for writing!\n", fname);
return; return;
} }
pic.data[0] = priv->buffer; pic.data[0] = priv->buffer;
pic.linesize[0] = priv->stride; pic.linesize[0] = priv->stride;
size = avcodec_encode_video(priv->avctx, priv->outbuffer, priv->outbuffer_size, &pic); size = avcodec_encode_video(priv->avctx, priv->outbuffer, priv->outbuffer_size, &pic);
@ -95,11 +95,11 @@ static int fexists(char *fname)
static void gen_fname(struct vf_priv_s* priv) static void gen_fname(struct vf_priv_s* priv)
{ {
do { do {
snprintf (priv->fname, 100, "shot%04d.png", ++priv->frameno); snprintf (priv->fname, 100, "shot%04d.png", ++priv->frameno);
} while (fexists(priv->fname) && priv->frameno < 100000); } while (fexists(priv->fname) && priv->frameno < 100000);
if (fexists(priv->fname)) { if (fexists(priv->fname)) {
priv->fname[0] = '\0'; priv->fname[0] = '\0';
return; return;
} }
mp_msg(MSGT_VFILTER,MSGL_INFO,"*** screenshot '%s' ***\n",priv->fname); mp_msg(MSGT_VFILTER,MSGL_INFO,"*** screenshot '%s' ***\n",priv->fname);
@ -110,96 +110,99 @@ static void scale_image(struct vf_priv_s* priv, mp_image_t *mpi)
{ {
uint8_t *dst[3]; uint8_t *dst[3];
int dst_stride[3]; int dst_stride[3];
dst_stride[0] = priv->stride; dst_stride[0] = priv->stride;
dst_stride[1] = dst_stride[2] = 0; dst_stride[1] = dst_stride[2] = 0;
if (!priv->buffer) if (!priv->buffer)
priv->buffer = memalign(16, dst_stride[0]*priv->dh); priv->buffer = memalign(16, dst_stride[0]*priv->dh);
dst[0] = priv->buffer; dst[0] = priv->buffer;
dst[1] = dst[2] = 0; dst[1] = dst[2] = 0;
sws_scale_ordered(priv->ctx, mpi->planes, mpi->stride, 0, priv->dh, dst, dst_stride); sws_scale_ordered(priv->ctx, mpi->planes, mpi->stride, 0, priv->dh, dst, dst_stride);
} }
static void start_slice(struct vf_instance* vf, mp_image_t *mpi){ static void start_slice(struct vf_instance* vf, mp_image_t *mpi)
{
vf->dmpi=vf_get_image(vf->next,mpi->imgfmt, vf->dmpi=vf_get_image(vf->next,mpi->imgfmt,
mpi->type, mpi->flags, mpi->width, mpi->height); mpi->type, mpi->flags, mpi->width, mpi->height);
if (vf->priv->shot) { if (vf->priv->shot) {
vf->priv->store_slices = 1; vf->priv->store_slices = 1;
if (!vf->priv->buffer) if (!vf->priv->buffer)
vf->priv->buffer = memalign(16, vf->priv->stride*vf->priv->dh); vf->priv->buffer = memalign(16, vf->priv->stride*vf->priv->dh);
} }
} }
static void draw_slice(struct vf_instance* vf, static void draw_slice(struct vf_instance* vf, unsigned char** src,
unsigned char** src, int* stride, int w,int h, int x, int y){ int* stride, int w,int h, int x, int y)
{
if (vf->priv->store_slices) { if (vf->priv->store_slices) {
uint8_t *dst[3]; uint8_t *dst[3];
int dst_stride[3]; int dst_stride[3];
dst_stride[0] = vf->priv->stride; dst_stride[0] = vf->priv->stride;
dst_stride[1] = dst_stride[2] = 0; dst_stride[1] = dst_stride[2] = 0;
dst[0] = vf->priv->buffer; dst[0] = vf->priv->buffer;
dst[1] = dst[2] = 0; dst[1] = dst[2] = 0;
sws_scale_ordered(vf->priv->ctx, src, stride, y, h, dst, dst_stride); sws_scale_ordered(vf->priv->ctx, src, stride, y, h, dst, dst_stride);
} }
vf_next_draw_slice(vf,src,stride,w,h,x,y); vf_next_draw_slice(vf,src,stride,w,h,x,y);
} }
static void get_image(struct vf_instance* vf, mp_image_t *mpi){ static void get_image(struct vf_instance* vf, mp_image_t *mpi)
{
// FIXME: should vf.c really call get_image when using slices?? // FIXME: should vf.c really call get_image when using slices??
if (mpi->flags & MP_IMGFLAG_DRAW_CALLBACK) if (mpi->flags & MP_IMGFLAG_DRAW_CALLBACK)
return; return;
vf->dmpi= vf_get_image(vf->next, mpi->imgfmt, vf->dmpi= vf_get_image(vf->next, mpi->imgfmt,
mpi->type, mpi->flags/* | MP_IMGFLAG_READABLE*/, mpi->width, mpi->height); mpi->type, mpi->flags/* | MP_IMGFLAG_READABLE*/, mpi->width, mpi->height);
mpi->planes[0]=vf->dmpi->planes[0]; mpi->planes[0]=vf->dmpi->planes[0];
mpi->stride[0]=vf->dmpi->stride[0]; mpi->stride[0]=vf->dmpi->stride[0];
if(mpi->flags&MP_IMGFLAG_PLANAR){ if(mpi->flags&MP_IMGFLAG_PLANAR){
mpi->planes[1]=vf->dmpi->planes[1]; mpi->planes[1]=vf->dmpi->planes[1];
mpi->planes[2]=vf->dmpi->planes[2]; mpi->planes[2]=vf->dmpi->planes[2];
mpi->stride[1]=vf->dmpi->stride[1]; mpi->stride[1]=vf->dmpi->stride[1];
mpi->stride[2]=vf->dmpi->stride[2]; mpi->stride[2]=vf->dmpi->stride[2];
} }
mpi->width=vf->dmpi->width; mpi->width=vf->dmpi->width;
mpi->flags|=MP_IMGFLAG_DIRECT; mpi->flags|=MP_IMGFLAG_DIRECT;
mpi->priv=(void*)vf->dmpi; mpi->priv=(void*)vf->dmpi;
} }
static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts) static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts)
{ {
mp_image_t *dmpi = (mp_image_t *)mpi->priv; mp_image_t *dmpi = (mp_image_t *)mpi->priv;
if (mpi->flags & MP_IMGFLAG_DRAW_CALLBACK) if (mpi->flags & MP_IMGFLAG_DRAW_CALLBACK)
dmpi = vf->dmpi; dmpi = vf->dmpi;
else else
if(!(mpi->flags&MP_IMGFLAG_DIRECT)){ if(!(mpi->flags&MP_IMGFLAG_DIRECT)){
dmpi=vf_get_image(vf->next,mpi->imgfmt, dmpi=vf_get_image(vf->next,mpi->imgfmt,
MP_IMGTYPE_EXPORT, 0, MP_IMGTYPE_EXPORT, 0,
mpi->width, mpi->height); mpi->width, mpi->height);
vf_clone_mpi_attributes(dmpi, mpi); vf_clone_mpi_attributes(dmpi, mpi);
dmpi->planes[0]=mpi->planes[0]; dmpi->planes[0]=mpi->planes[0];
dmpi->planes[1]=mpi->planes[1]; dmpi->planes[1]=mpi->planes[1];
dmpi->planes[2]=mpi->planes[2]; dmpi->planes[2]=mpi->planes[2];
dmpi->stride[0]=mpi->stride[0]; dmpi->stride[0]=mpi->stride[0];
dmpi->stride[1]=mpi->stride[1]; dmpi->stride[1]=mpi->stride[1];
dmpi->stride[2]=mpi->stride[2]; dmpi->stride[2]=mpi->stride[2];
dmpi->width=mpi->width; dmpi->width=mpi->width;
dmpi->height=mpi->height; dmpi->height=mpi->height;
} }
if(vf->priv->shot) { if(vf->priv->shot) {
if (vf->priv->shot==1) if (vf->priv->shot==1)
vf->priv->shot=0; vf->priv->shot=0;
gen_fname(vf->priv); gen_fname(vf->priv);
if (vf->priv->fname[0]) { if (vf->priv->fname[0]) {
if (!vf->priv->store_slices) if (!vf->priv->store_slices)
scale_image(vf->priv, dmpi); scale_image(vf->priv, dmpi);
write_png(vf->priv); write_png(vf->priv);
} }
vf->priv->store_slices = 0; vf->priv->store_slices = 0;
} }
return vf_next_put_image(vf, dmpi, pts); return vf_next_put_image(vf, dmpi, pts);
@ -212,15 +215,15 @@ static int control (vf_instance_t *vf, int request, void *data)
* 1: take screenshots with each frame until the same command is given once again * 1: take screenshots with each frame until the same command is given once again
**/ **/
if(request==VFCTRL_SCREENSHOT) { if(request==VFCTRL_SCREENSHOT) {
if (data && *(int*)data) { // repeated screenshot mode if (data && *(int*)data) { // repeated screenshot mode
if (vf->priv->shot==2) if (vf->priv->shot==2)
vf->priv->shot=0; vf->priv->shot=0;
else else
vf->priv->shot=2; vf->priv->shot=2;
} else { // single screenshot } else { // single screenshot
if (!vf->priv->shot) if (!vf->priv->shot)
vf->priv->shot=1; vf->priv->shot=1;
} }
return CONTROL_TRUE; return CONTROL_TRUE;
} }
return vf_next_control (vf, request, data); return vf_next_control (vf, request, data);
@ -243,19 +246,27 @@ static int query_format(struct vf_instance* vf, unsigned int fmt)
case IMGFMT_BGR15: case IMGFMT_BGR15:
case IMGFMT_RGB32: case IMGFMT_RGB32:
case IMGFMT_RGB24: case IMGFMT_RGB24:
case IMGFMT_Y800: case IMGFMT_Y800:
case IMGFMT_Y8: case IMGFMT_Y8:
case IMGFMT_YVU9: case IMGFMT_YVU9:
case IMGFMT_IF09: case IMGFMT_IF09:
case IMGFMT_444P: case IMGFMT_444P:
case IMGFMT_422P: case IMGFMT_422P:
case IMGFMT_411P: case IMGFMT_411P:
return vf_next_query_format(vf, fmt); return vf_next_query_format(vf, fmt);
} }
return 0; return 0;
} }
static void uninit(vf_instance_t *vf); static void uninit(vf_instance_t *vf)
{
av_freep(&vf->priv->avctx);
if(vf->priv->ctx) sws_freeContext(vf->priv->ctx);
if (vf->priv->buffer) free(vf->priv->buffer);
free(vf->priv->outbuffer);
free(vf->priv);
}
// open conflicts with stdio.h at least under MinGW // open conflicts with stdio.h at least under MinGW
static int screenshot_open(vf_instance_t *vf, char* args) static int screenshot_open(vf_instance_t *vf, char* args)
{ {
@ -283,15 +294,6 @@ static int screenshot_open(vf_instance_t *vf, char* args)
return 1; return 1;
} }
static void uninit(vf_instance_t *vf)
{
av_freep(&vf->priv->avctx);
if(vf->priv->ctx) sws_freeContext(vf->priv->ctx);
if (vf->priv->buffer) free(vf->priv->buffer);
free(vf->priv->outbuffer);
free(vf->priv);
}
const vf_info_t vf_info_screenshot = { const vf_info_t vf_info_screenshot = {
"screenshot to file", "screenshot to file",

View File

@ -265,7 +265,7 @@ void mpeg2_idct_init (uint32_t accel)
mpeg2_idct_altivec_init (); mpeg2_idct_altivec_init ();
} else } else
#endif #endif
#ifdef HAVE_VIS #ifdef HAVE_MVI
if (accel & MPEG2_ACCEL_ALPHA_MVI) { if (accel & MPEG2_ACCEL_ALPHA_MVI) {
mpeg2_idct_copy = mpeg2_idct_copy_mvi; mpeg2_idct_copy = mpeg2_idct_copy_mvi;
mpeg2_idct_add = mpeg2_idct_add_mvi; mpeg2_idct_add = mpeg2_idct_add_mvi;

View File

@ -111,7 +111,7 @@
} else } else
#endif #endif
-#ifdef ARCH_ALPHA -#ifdef ARCH_ALPHA
+#ifdef HAVE_VIS +#ifdef HAVE_MVI
if (accel & MPEG2_ACCEL_ALPHA_MVI) { if (accel & MPEG2_ACCEL_ALPHA_MVI) {
mpeg2_idct_copy = mpeg2_idct_copy_mvi; mpeg2_idct_copy = mpeg2_idct_copy_mvi;
mpeg2_idct_add = mpeg2_idct_add_mvi; mpeg2_idct_add = mpeg2_idct_add_mvi;

View File

@ -286,8 +286,6 @@ extern int vo_colorkey;
extern int WinID; extern int WinID;
#if defined(CONFIG_FBDEV) || defined(CONFIG_VESA)
typedef struct { typedef struct {
float min; float min;
float max; float max;
@ -300,6 +298,4 @@ extern char *monitor_hfreq_str;
extern char *monitor_vfreq_str; extern char *monitor_vfreq_str;
extern char *monitor_dotclock_str; extern char *monitor_dotclock_str;
#endif /* defined(CONFIG_FBDEV) || defined(CONFIG_VESA) */
#endif /* MPLAYER_VIDEO_OUT_H */ #endif /* MPLAYER_VIDEO_OUT_H */

View File

@ -52,9 +52,9 @@ const LIBVO_EXTERN(direct3d)
static struct global_priv { static struct global_priv {
int is_paused; /**< 1 = Movie is paused, int is_paused; /**< 1 = Movie is paused,
0 = Movie is not paused */ 0 = Movie is not paused */
int is_cfg_finished; /**< Synchronization "semaphore". 1 when int is_clear_needed; /**< 1 = Clear the backbuffer before StretchRect
instance of reconfigure_d3d is finished */ 0 = (default) Don't clear it */
D3DLOCKED_RECT locked_rect; /**< The locked Offscreen surface */
RECT fs_movie_rect; /**< Rect (upscaled) of the movie when displayed RECT fs_movie_rect; /**< Rect (upscaled) of the movie when displayed
in fullscreen */ in fullscreen */
RECT fs_panscan_rect; /**< PanScan source surface cropping in RECT fs_panscan_rect; /**< PanScan source surface cropping in
@ -155,6 +155,12 @@ static void calc_fs_rect(void)
"<vo_direct3d>Fullscreen Movie Rect: t: %ld, l: %ld, r: %ld, b:%ld\r\n", "<vo_direct3d>Fullscreen Movie Rect: t: %ld, l: %ld, r: %ld, b:%ld\r\n",
priv->fs_movie_rect.top, priv->fs_movie_rect.left, priv->fs_movie_rect.top, priv->fs_movie_rect.left,
priv->fs_movie_rect.right, priv->fs_movie_rect.bottom); priv->fs_movie_rect.right, priv->fs_movie_rect.bottom);
/* The backbuffer should be cleared before next StretchRect. This is
* necessary because our new draw area could be smaller than the
* previous one used by StretchRect and without it, leftovers from the
* previous frame will be left. */
priv->is_clear_needed = 1;
} }
/** @brief Destroy D3D Context related to the current window. /** @brief Destroy D3D Context related to the current window.
@ -164,6 +170,11 @@ static void destroy_d3d_context(void)
mp_msg(MSGT_VO,MSGL_V,"<vo_direct3d>destroy_d3d_context called\r\n"); mp_msg(MSGT_VO,MSGL_V,"<vo_direct3d>destroy_d3d_context called\r\n");
/* Let's destroy the old (if any) D3D Content */ /* Let's destroy the old (if any) D3D Content */
if (priv->locked_rect.pBits) {
IDirect3DSurface9_UnlockRect(priv->d3d_surface);
priv->locked_rect.pBits = NULL;
}
if (priv->d3d_surface != NULL) { if (priv->d3d_surface != NULL) {
IDirect3DSurface9_Release (priv->d3d_surface); IDirect3DSurface9_Release (priv->d3d_surface);
priv->d3d_surface = NULL; priv->d3d_surface = NULL;
@ -254,10 +265,6 @@ static int reconfigure_d3d(void)
return 0; return 0;
} }
/* Fill the Surface with black color. */
IDirect3DDevice9_ColorFill(priv->d3d_device, priv->d3d_surface, NULL,
D3DCOLOR_ARGB(0xFF, 0, 0, 0) );
calc_fs_rect(); calc_fs_rect();
return 1; return 1;
@ -269,9 +276,6 @@ static void uninit_d3d(void)
{ {
mp_msg(MSGT_VO,MSGL_V,"<vo_direct3d>uninit_d3d called\r\n"); mp_msg(MSGT_VO,MSGL_V,"<vo_direct3d>uninit_d3d called\r\n");
/* Block further calls to reconfigure_d3d(). */
priv->is_cfg_finished = 0;
/* Destroy D3D Context inside the window. */ /* Destroy D3D Context inside the window. */
destroy_d3d_context(); destroy_d3d_context();
@ -288,40 +292,48 @@ static void uninit_d3d(void)
*/ */
static uint32_t render_d3d_frame(mp_image_t *mpi) static uint32_t render_d3d_frame(mp_image_t *mpi)
{ {
D3DLOCKED_RECT locked_rect; /**< Offscreen surface we lock in order
to copy MPlayer's frame inside it.*/
/* Uncomment when direct rendering is implemented. /* Uncomment when direct rendering is implemented.
* if (mpi->flags & MP_IMGFLAG_DIRECT) ... * if (mpi->flags & MP_IMGFLAG_DIRECT) ...
*/ */
if (mpi->flags & MP_IMGFLAG_DRAW_CALLBACK) if (mpi->flags & MP_IMGFLAG_DRAW_CALLBACK)
return VO_TRUE; goto skip_upload;
if (mpi->flags & MP_IMGFLAG_PLANAR) { /* Copy a planar frame. */ if (mpi->flags & MP_IMGFLAG_PLANAR) { /* Copy a planar frame. */
draw_slice(mpi->planes,mpi->stride,mpi->w,mpi->h,0,0); draw_slice(mpi->planes,mpi->stride,mpi->w,mpi->h,0,0);
return VO_TRUE; goto skip_upload;
} }
/* If the previous if failed, we should draw a packed frame */ /* If we're here, then we should lock the rect and copy a packed frame */
if (FAILED(IDirect3DDevice9_BeginScene(priv->d3d_device))) { if (!priv->locked_rect.pBits) {
mp_msg(MSGT_VO,MSGL_ERR,"<vo_direct3d>BeginScene failed\n"); if (FAILED(IDirect3DSurface9_LockRect(priv->d3d_surface,
return VO_ERROR; &priv->locked_rect, NULL, 0))) {
mp_msg(MSGT_VO,MSGL_ERR,"<vo_direct3d>Surface lock failure\n");
return VO_ERROR;
}
} }
if (FAILED(IDirect3DSurface9_LockRect(priv->d3d_surface, memcpy_pic(priv->locked_rect.pBits, mpi->planes[0], mpi->stride[0],
&locked_rect, NULL, 0))) { mpi->height, priv->locked_rect.Pitch, mpi->stride[0]);
mp_msg(MSGT_VO,MSGL_ERR,"<vo_direct3d>Surface lock failure\n");
return VO_ERROR;
}
memcpy_pic(locked_rect.pBits, mpi->planes[0], mpi->stride[0],
mpi->height, locked_rect.Pitch, mpi->stride[0]);
skip_upload:
/* This unlock is used for both slice_draw path and render_d3d_frame path. */
if (FAILED(IDirect3DSurface9_UnlockRect(priv->d3d_surface))) { if (FAILED(IDirect3DSurface9_UnlockRect(priv->d3d_surface))) {
mp_msg(MSGT_VO,MSGL_V,"<vo_direct3d>Surface unlock failure\n"); mp_msg(MSGT_VO,MSGL_V,"<vo_direct3d>Surface unlock failure\n");
return VO_ERROR; return VO_ERROR;
} }
priv->locked_rect.pBits = NULL;
if (FAILED(IDirect3DDevice9_BeginScene(priv->d3d_device))) {
mp_msg(MSGT_VO,MSGL_ERR,"<vo_direct3d>BeginScene failed\n");
return VO_ERROR;
}
if (priv->is_clear_needed) {
IDirect3DDevice9_Clear (priv->d3d_device, 0, NULL,
D3DCLEAR_TARGET, 0, 0, 0);
priv->is_clear_needed = 0;
}
if (FAILED(IDirect3DDevice9_StretchRect(priv->d3d_device, if (FAILED(IDirect3DDevice9_StretchRect(priv->d3d_device,
priv->d3d_surface, priv->d3d_surface,
@ -441,9 +453,6 @@ static int preinit(const char *arg)
return -1; return -1;
} }
/* Allow the first call to reconfigure_d3d. */
priv->is_cfg_finished = 1;
return 0; return 0;
} }
@ -527,14 +536,9 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width,
return VO_ERROR; return VO_ERROR;
} }
if (priv->is_cfg_finished) { if (!reconfigure_d3d())
priv->is_cfg_finished = 0; return VO_ERROR;
if (!reconfigure_d3d()) {
priv->is_cfg_finished = 1;
return VO_ERROR;
}
priv->is_cfg_finished = 1;
}
return 0; /* Success */ return 0; /* Success */
} }
@ -560,7 +564,6 @@ static void flip_page(void)
mp_msg(MSGT_VO,MSGL_V,"<vo_direct3d>Video adapter reinitialized.\n"); mp_msg(MSGT_VO,MSGL_V,"<vo_direct3d>Video adapter reinitialized.\n");
} }
/*IDirect3DDevice9_Clear (priv->d3d_device, 0, NULL, D3DCLEAR_TARGET, 0, 0, 0);*/
} }
/** @brief libvo Callback: Draw OSD/Subtitles, /** @brief libvo Callback: Draw OSD/Subtitles,
@ -607,75 +610,50 @@ static void check_events(void)
*/ */
static int draw_slice(uint8_t *src[], int stride[], int w,int h,int x,int y ) static int draw_slice(uint8_t *src[], int stride[], int w,int h,int x,int y )
{ {
D3DLOCKED_RECT locked_rect; /**< Offscreen surface we lock in order char *my_src; /**< Pointer to the source image */
to copy MPlayer's frame inside it.*/ char *dst; /**< Pointer to the destination image */
char *Src; /**< Pointer to the source image */ int uv_stride; /**< Stride of the U/V planes */
char *Dst; /**< Pointer to the destination image */
int UVstride; /**< Stride of the U/V planes */
if (FAILED(IDirect3DDevice9_BeginScene(priv->d3d_device))) { /* Lock the offscreen surface if it's not already locked. */
mp_msg(MSGT_VO,MSGL_ERR,"<vo_direct3d>BeginScene failed\n"); if (!priv->locked_rect.pBits) {
return VO_ERROR; if (FAILED(IDirect3DSurface9_LockRect(priv->d3d_surface,
&priv->locked_rect, NULL, 0))) {
mp_msg(MSGT_VO,MSGL_V,"<vo_direct3d>Surface lock failure\n");
return VO_FALSE;
}
} }
if (FAILED(IDirect3DSurface9_LockRect(priv->d3d_surface, uv_stride = priv->locked_rect.Pitch / 2;
&locked_rect, NULL, 0))) {
mp_msg(MSGT_VO,MSGL_V,"<vo_direct3d>Surface lock failure\n");
return VO_FALSE;
}
UVstride = locked_rect.Pitch / 2;
/* Copy Y */ /* Copy Y */
Dst = locked_rect.pBits; dst = priv->locked_rect.pBits;
Dst = Dst + locked_rect.Pitch * y + x; dst = dst + priv->locked_rect.Pitch * y + x;
Src=src[0]; my_src=src[0];
memcpy_pic(Dst, Src, w, h, locked_rect.Pitch, stride[0]); memcpy_pic(dst, my_src, w, h, priv->locked_rect.Pitch, stride[0]);
w/=2;h/=2;x/=2;y/=2; w/=2;h/=2;x/=2;y/=2;
/* Copy U */ /* Copy U */
Dst = locked_rect.pBits; dst = priv->locked_rect.pBits;
Dst = Dst + locked_rect.Pitch * priv->src_height dst = dst + priv->locked_rect.Pitch * priv->src_height
+ UVstride * y + x; + uv_stride * y + x;
if (priv->movie_src_fmt == MAKEFOURCC('Y','V','1','2')) if (priv->movie_src_fmt == MAKEFOURCC('Y','V','1','2'))
Src=src[2]; my_src=src[2];
else else
Src=src[1]; my_src=src[1];
memcpy_pic(Dst, Src, w, h, UVstride, stride[1]); memcpy_pic(dst, my_src, w, h, uv_stride, stride[1]);
/* Copy V */ /* Copy V */
Dst = locked_rect.pBits; dst = priv->locked_rect.pBits;
Dst = Dst + locked_rect.Pitch * priv->src_height dst = dst + priv->locked_rect.Pitch * priv->src_height
+ UVstride * (priv->src_height / 2) + UVstride * y + x; + uv_stride * (priv->src_height / 2) + uv_stride * y + x;
if (priv->movie_src_fmt == MAKEFOURCC('Y','V','1','2')) if (priv->movie_src_fmt == MAKEFOURCC('Y','V','1','2'))
Src=src[1]; my_src=src[1];
else else
Src=src[2]; my_src=src[2];
memcpy_pic(Dst, Src, w, h, UVstride, stride[2]); memcpy_pic(dst, my_src, w, h, uv_stride, stride[2]);
if (FAILED(IDirect3DSurface9_UnlockRect(priv->d3d_surface))) {
mp_msg(MSGT_VO,MSGL_V,"<vo_direct3d>Surface unlock failure\n");
return VO_ERROR;
}
if (FAILED(IDirect3DDevice9_StretchRect(priv->d3d_device,
priv->d3d_surface,
&priv->fs_panscan_rect,
priv->d3d_backbuf,
&priv->fs_movie_rect,
D3DTEXF_LINEAR))) {
mp_msg(MSGT_VO,MSGL_V,
"<vo_direct3d>Unable to copy the frame to the back buffer\n");
return VO_ERROR;
}
if (FAILED(IDirect3DDevice9_EndScene(priv->d3d_device))) {
mp_msg(MSGT_VO,MSGL_ERR,"<vo_direct3d>EndScene failed\n");
return VO_ERROR;
}
return 0; /* Success */ return 0; /* Success */
} }

File diff suppressed because it is too large Load Diff

View File

@ -91,8 +91,11 @@ static GLint gl_texfmt;
static GLenum gl_format; static GLenum gl_format;
static GLenum gl_type; static GLenum gl_type;
static GLuint gl_buffer; static GLuint gl_buffer;
static GLuint gl_buffer_uv[2];
static int gl_buffersize; static int gl_buffersize;
static int gl_buffersize_uv;
static void *gl_bufferptr; static void *gl_bufferptr;
static void *gl_bufferptr_uv[2];
static GLuint fragprog; static GLuint fragprog;
static GLuint default_texs[22]; static GLuint default_texs[22];
static char *custom_prog; static char *custom_prog;
@ -381,6 +384,10 @@ static void uninitGl(void) {
DeleteBuffers(1, &gl_buffer); DeleteBuffers(1, &gl_buffer);
gl_buffer = 0; gl_buffersize = 0; gl_buffer = 0; gl_buffersize = 0;
gl_bufferptr = NULL; gl_bufferptr = NULL;
if (DeleteBuffers && gl_buffer_uv[0])
DeleteBuffers(2, gl_buffer_uv);
gl_buffer_uv[0] = gl_buffer_uv[1] = 0; gl_buffersize_uv = 0;
gl_bufferptr_uv[0] = gl_bufferptr_uv[1] = 0;
err_shown = 0; err_shown = 0;
} }
@ -537,7 +544,7 @@ static void create_osd_texture(int x0, int y0, int w, int h,
#ifndef FAST_OSD #ifndef FAST_OSD
glGenTextures(1, &osdatex[osdtexCnt]); glGenTextures(1, &osdatex[osdtexCnt]);
BindTexture(gl_target, osdatex[osdtexCnt]); BindTexture(gl_target, osdatex[osdtexCnt]);
glCreateClearTex(gl_target, GL_ALPHA, GL_ALPHA, GL_UNSIGNED_BYTE, scale_type, sx, sy, 255); glCreateClearTex(gl_target, GL_ALPHA, GL_ALPHA, GL_UNSIGNED_BYTE, scale_type, sx, sy, 0);
{ {
int i; int i;
char *tmp = malloc(stride * h); char *tmp = malloc(stride * h);
@ -713,6 +720,27 @@ static uint32_t get_image(mp_image_t *mpi) {
mpi->stride[1] = mpi->width >> 1; mpi->stride[1] = mpi->width >> 1;
mpi->planes[2] = mpi->planes[1] + mpi->stride[1] * (mpi->height >> 1); mpi->planes[2] = mpi->planes[1] + mpi->stride[1] * (mpi->height >> 1);
mpi->stride[2] = mpi->width >> 1; mpi->stride[2] = mpi->width >> 1;
if (ati_hack) {
mpi->flags &= ~MP_IMGFLAG_COMMON_PLANE;
if (!gl_buffer_uv[0]) GenBuffers(2, gl_buffer_uv);
if (mpi->stride[1] * mpi->height > gl_buffersize_uv) {
BindBuffer(GL_PIXEL_UNPACK_BUFFER, gl_buffer_uv[0]);
BufferData(GL_PIXEL_UNPACK_BUFFER, mpi->stride[1] * mpi->height,
NULL, GL_DYNAMIC_DRAW);
BindBuffer(GL_PIXEL_UNPACK_BUFFER, gl_buffer_uv[1]);
BufferData(GL_PIXEL_UNPACK_BUFFER, mpi->stride[1] * mpi->height,
NULL, GL_DYNAMIC_DRAW);
gl_buffersize_uv = mpi->stride[1] * mpi->height;
}
if (!gl_bufferptr_uv[0]) {
BindBuffer(GL_PIXEL_UNPACK_BUFFER, gl_buffer_uv[0]);
gl_bufferptr_uv[0] = MapBuffer(GL_PIXEL_UNPACK_BUFFER, GL_WRITE_ONLY);
BindBuffer(GL_PIXEL_UNPACK_BUFFER, gl_buffer_uv[1]);
gl_bufferptr_uv[1] = MapBuffer(GL_PIXEL_UNPACK_BUFFER, GL_WRITE_ONLY);
}
mpi->planes[1] = gl_bufferptr_uv[0];
mpi->planes[2] = gl_bufferptr_uv[1];
}
} }
mpi->flags |= MP_IMGFLAG_DIRECT; mpi->flags |= MP_IMGFLAG_DIRECT;
return VO_TRUE; return VO_TRUE;
@ -752,13 +780,25 @@ static uint32_t draw_image(mp_image_t *mpi) {
UnmapBuffer(GL_PIXEL_UNPACK_BUFFER); UnmapBuffer(GL_PIXEL_UNPACK_BUFFER);
gl_bufferptr = NULL; gl_bufferptr = NULL;
slice = 0; // always "upload" full texture slice = 0; // always "upload" full texture
if (!(mpi->flags & MP_IMGFLAG_COMMON_PLANE))
planes[0] = planes[1] = planes[2] = NULL;
} }
glUploadTex(gl_target, gl_format, gl_type, planes[0], stride[0], glUploadTex(gl_target, gl_format, gl_type, planes[0], stride[0],
mpi->x, mpi->y, w, h, slice); mpi->x, mpi->y, w, h, slice);
if (mpi->imgfmt == IMGFMT_YV12) { if (mpi->imgfmt == IMGFMT_YV12) {
if ((mpi->flags & MP_IMGFLAG_DIRECT) && !(mpi->flags & MP_IMGFLAG_COMMON_PLANE)) {
BindBuffer(GL_PIXEL_UNPACK_BUFFER, gl_buffer_uv[0]);
UnmapBuffer(GL_PIXEL_UNPACK_BUFFER);
gl_bufferptr_uv[0] = NULL;
}
ActiveTexture(GL_TEXTURE1); ActiveTexture(GL_TEXTURE1);
glUploadTex(gl_target, gl_format, gl_type, planes[1], stride[1], glUploadTex(gl_target, gl_format, gl_type, planes[1], stride[1],
mpi->x / 2, mpi->y / 2, w / 2, h / 2, slice); mpi->x / 2, mpi->y / 2, w / 2, h / 2, slice);
if ((mpi->flags & MP_IMGFLAG_DIRECT) && !(mpi->flags & MP_IMGFLAG_COMMON_PLANE)) {
BindBuffer(GL_PIXEL_UNPACK_BUFFER, gl_buffer_uv[1]);
UnmapBuffer(GL_PIXEL_UNPACK_BUFFER);
gl_bufferptr_uv[1] = NULL;
}
ActiveTexture(GL_TEXTURE2); ActiveTexture(GL_TEXTURE2);
glUploadTex(gl_target, gl_format, gl_type, planes[2], stride[2], glUploadTex(gl_target, gl_format, gl_type, planes[2], stride[2],
mpi->x / 2, mpi->y / 2, w / 2, h / 2, slice); mpi->x / 2, mpi->y / 2, w / 2, h / 2, slice);

View File

@ -10,6 +10,12 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/ipc.h> #include <sys/ipc.h>
#include <sys/shm.h> #include <sys/shm.h>
#include <CoreServices/CoreServices.h>
//special workaround for Apple bug #6267445
//(OSServices Power API disabled in OSServices.h for 64bit systems)
#ifndef __POWER__
#include <CoreServices/../Frameworks/OSServices.framework/Headers/Power.h>
#endif
//MPLAYER //MPLAYER
#include "config.h" #include "config.h"
@ -324,8 +330,6 @@ static int preinit(const char *arg)
{ {
#if !defined (CONFIG_MACOSX_FINDER) || !defined (CONFIG_SDL) #if !defined (CONFIG_MACOSX_FINDER) || !defined (CONFIG_SDL)
//this chunk of code is heavily based off SDL_macosx.m from SDL //this chunk of code is heavily based off SDL_macosx.m from SDL
//it uses an Apple private function to request foreground operation
void CPSEnableForegroundOperation(ProcessSerialNumber* psn);
ProcessSerialNumber myProc, frProc; ProcessSerialNumber myProc, frProc;
Boolean sameProc; Boolean sameProc;
@ -335,7 +339,7 @@ static int preinit(const char *arg)
{ {
if (SameProcess(&frProc, &myProc, &sameProc) == noErr && !sameProc) if (SameProcess(&frProc, &myProc, &sameProc) == noErr && !sameProc)
{ {
CPSEnableForegroundOperation(&myProc); TransformProcessType(&myProc, kProcessTransformToForegroundApplication);
} }
SetFrontProcess(&myProc); SetFrontProcess(&myProc);
} }
@ -751,7 +755,7 @@ static int control(uint32_t request, void *data)
glFlush(); glFlush();
//auto hide mouse cursor and futur on-screen control? //auto hide mouse cursor (and future on-screen control?)
if(isFullscreen && !mouseHide && !isRootwin) if(isFullscreen && !mouseHide && !isRootwin)
{ {
int curTime = TickCount()/60; int curTime = TickCount()/60;

File diff suppressed because it is too large Load Diff

View File

@ -54,10 +54,6 @@
#include "sub.h" #include "sub.h"
#include "mp_msg.h" #include "mp_msg.h"
#define WII_DEV_NAME "/dev/fb0"
#define TTY_DEV_NAME "/dev/tty"
#define FB_PIXEL_SIZE 2
static const vo_info_t info = { static const vo_info_t info = {
"Nintendo Wii/GameCube Framebuffer Device", "Nintendo Wii/GameCube Framebuffer Device",
"wii", "wii",
@ -69,31 +65,32 @@ LIBVO_EXTERN(wii)
static signed int pre_init_err = -2; static signed int pre_init_err = -2;
static char *fb_dev_name = NULL;
static FILE *vt_fp = NULL; static FILE *vt_fp = NULL;
static int vt_doit = 1; static int vt_doit = 1;
static int fb_dev_fd = -1;
static int fb_tty_fd = -1;
static int fb_dev_fd;
static int fb_tty_fd = -1;
static size_t fb_size;
static uint8_t *frame_buffer; static uint8_t *frame_buffer;
static uint8_t *center; static uint8_t *center;
static struct fb_var_screeninfo fb_orig_vinfo; static struct fb_var_screeninfo fb_orig_vinfo;
static struct fb_var_screeninfo fb_vinfo; static struct fb_var_screeninfo fb_vinfo;
static int fb_pixel_size; // 32: 4 24: 3 16: 2 15: 2
static int fb_line_len; static int fb_line_len;
static size_t fb_size; static int in_width;
static int in_height;
static int in_width, out_width; static int out_width;
static int in_height, out_height; static int out_height;
static int fs; static int fs;
static int static int fb_preinit(int reset)
fb_preinit (int reset)
{ {
static int fb_preinit_done = 0; static int fb_preinit_done = 0;
static int fb_works = 0; static int fb_works = 0;
if (reset) if (reset) {
{
fb_preinit_done = 0; fb_preinit_done = 0;
return 0; return 0;
} }
@ -101,26 +98,22 @@ fb_preinit (int reset)
if (fb_preinit_done) if (fb_preinit_done)
return fb_works; return fb_works;
if ((fb_dev_fd = open (WII_DEV_NAME, O_RDWR)) == -1) if (!fb_dev_name && !(fb_dev_name = getenv("FRAMEBUFFER")))
{ fb_dev_name = strdup("/dev/fb0");
mp_msg (MSGT_VO, MSGL_ERR, mp_msg(MSGT_VO, MSGL_V, "using %s\n", fb_dev_name);
"Can't open %s: %s\n", WII_DEV_NAME, strerror (errno));
if ((fb_dev_fd = open(fb_dev_name, O_RDWR)) == -1) {
mp_msg(MSGT_VO, MSGL_ERR, "Can't open %s: %s\n", fb_dev_name, strerror(errno));
goto err_out; goto err_out;
} }
if (ioctl(fb_dev_fd, FBIOGET_VSCREENINFO, &fb_vinfo)) {
if (ioctl (fb_dev_fd, FBIOGET_VSCREENINFO, &fb_vinfo)) mp_msg(MSGT_VO, MSGL_ERR, "Can't get VSCREENINFO: %s\n", strerror(errno));
{
mp_msg (MSGT_VO, MSGL_ERR,
"Can't get VSCREENINFO: %s\n", strerror (errno));
goto err_out_fd; goto err_out_fd;
} }
fb_orig_vinfo = fb_vinfo; fb_orig_vinfo = fb_vinfo;
if ((fb_tty_fd = open (TTY_DEV_NAME, O_RDWR)) < 0) if ((fb_tty_fd = open("/dev/tty", O_RDWR)) < 0) {
{ mp_msg(MSGT_VO, MSGL_ERR, "notice: Can't open /dev/tty: %s\n", strerror(errno));
mp_msg (MSGT_VO, MSGL_ERR,
"Notice: Can't open %s: %s\n", TTY_DEV_NAME, strerror (errno));
goto err_out_fd; goto err_out_fd;
} }
@ -129,17 +122,16 @@ fb_preinit (int reset)
return 1; return 1;
err_out_fd: err_out_fd:
close (fb_dev_fd); close(fb_dev_fd);
fb_dev_fd = -1; fb_dev_fd = -1;
err_out: err_out:
fb_preinit_done = 1; fb_preinit_done = 1;
fb_works = 0; fb_works = 0;
return 0; return 0;
} }
static void static void vt_set_textarea(int u, int l)
vt_set_textarea (int u, int l)
{ {
/* how can I determine the font height? /* how can I determine the font height?
* just use 16 for now * just use 16 for now
@ -147,178 +139,149 @@ vt_set_textarea (int u, int l)
int urow = ((u + 15) / 16) + 1; int urow = ((u + 15) / 16) + 1;
int lrow = l / 16; int lrow = l / 16;
mp_msg (MSGT_VO, MSGL_DBG2, mp_msg(MSGT_VO, MSGL_DBG2, "vt_set_textarea(%d, %d): %d,%d\n", u, l, urow, lrow);
"vt_set_textarea (%d, %d): %d,%d\n", u, l, urow, lrow);
if (vt_fp) if (vt_fp) {
{ fprintf(vt_fp, "\33[%d;%dr\33[%d;%dH", urow, lrow, lrow, 0);
fprintf (vt_fp, "\33[%d;%dr\33[%d;%dH", urow, lrow, lrow, 0); fflush(vt_fp);
fflush (vt_fp);
} }
} }
static int static int config(uint32_t width, uint32_t height, uint32_t d_width,
config (uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title,
uint32_t d_height, uint32_t flags, char *title, uint32_t format) uint32_t format)
{ {
struct fb_fix_screeninfo fb_finfo; struct fb_fix_screeninfo fb_finfo;
uint32_t black = 0x00800080; uint32_t black = 0x00800080;
long temp; long temp;
int vt_fd; int vt_fd;
fs = flags & VOFLAG_FULLSCREEN; fs = flags & VOFLAG_FULLSCREEN;
if (pre_init_err == -2) if (pre_init_err == -2) {
{ mp_msg(MSGT_VO, MSGL_ERR, "Internal fatal error: config() was called before preinit()\n");
mp_msg (MSGT_VO, MSGL_ERR,
"Internal fatal error: config() was called before preinit()\n");
return -1; return -1;
} }
if (pre_init_err) if (pre_init_err)
return 1; return 1;
in_width = width; in_width = width;
in_height = height; in_height = height;
out_width = (d_width && fs) ? d_width : width; out_width = (d_width && fs) ? d_width : width;
out_height = (d_width && fs) ? d_height : height; out_height = (d_width && fs) ? d_height : height;
fb_vinfo.xres_virtual = fb_vinfo.xres; fb_vinfo.xres_virtual = fb_vinfo.xres;
fb_vinfo.yres_virtual = fb_vinfo.yres; fb_vinfo.yres_virtual = fb_vinfo.yres;
if (fb_tty_fd >= 0 && ioctl (fb_tty_fd, KDSETMODE, KD_GRAPHICS) < 0) if (fb_tty_fd >= 0 && ioctl(fb_tty_fd, KDSETMODE, KD_GRAPHICS) < 0) {
{ mp_msg(MSGT_VO, MSGL_V, "Can't set graphics mode: %s\n", strerror(errno));
mp_msg (MSGT_VO, MSGL_V, close(fb_tty_fd);
"Can't set graphics mode: %s\n", strerror (errno));
close (fb_tty_fd);
fb_tty_fd = -1; fb_tty_fd = -1;
} }
if (ioctl (fb_dev_fd, FBIOPUT_VSCREENINFO, &fb_vinfo)) if (ioctl(fb_dev_fd, FBIOPUT_VSCREENINFO, &fb_vinfo)) {
{ mp_msg(MSGT_VO, MSGL_ERR, "Can't put VSCREENINFO: %s\n", strerror(errno));
mp_msg (MSGT_VO, MSGL_ERR, if (fb_tty_fd >= 0 && ioctl(fb_tty_fd, KDSETMODE, KD_TEXT) < 0) {
"Can't put VSCREENINFO: %s\n", strerror (errno)); mp_msg(MSGT_VO, MSGL_ERR, "Can't restore text mode: %s\n", strerror(errno));
if (fb_tty_fd >= 0 && ioctl (fb_tty_fd, KDSETMODE, KD_TEXT) < 0)
{
mp_msg (MSGT_VO, MSGL_ERR,
"Can't restore text mode: %s\n", strerror (errno));
} }
return 1; return 1;
} }
if (fs) fb_pixel_size = 2;
{
out_width = fb_vinfo.xres; if (fs) {
out_width = fb_vinfo.xres;
out_height = fb_vinfo.yres; out_height = fb_vinfo.yres;
} }
if (out_width < in_width || out_height < in_height) {
if (out_width < in_width || out_height < in_height) mp_msg(MSGT_VO, MSGL_ERR, "screensize is smaller than video size\n");
{
mp_msg (MSGT_VO, MSGL_ERR, "Screensize is smaller than video size\n");
return 1; return 1;
} }
if (ioctl (fb_dev_fd, FBIOGET_FSCREENINFO, &fb_finfo)) if (ioctl(fb_dev_fd, FBIOGET_FSCREENINFO, &fb_finfo)) {
{ mp_msg(MSGT_VO, MSGL_ERR, "Can't get FSCREENINFO: %s\n", strerror(errno));
mp_msg (MSGT_VO, MSGL_ERR,
"Can't get FSCREENINFO: %s\n", strerror (errno));
return 1; return 1;
} }
if (fb_finfo.type != FB_TYPE_PACKED_PIXELS) if (fb_finfo.type != FB_TYPE_PACKED_PIXELS) {
{ mp_msg(MSGT_VO, MSGL_ERR, "type %d not supported\n", fb_finfo.type);
mp_msg (MSGT_VO, MSGL_ERR, "Type %d not supported\n", fb_finfo.type);
return 1; return 1;
} }
fb_line_len = fb_finfo.line_length; fb_line_len = fb_finfo.line_length;
fb_size = fb_finfo.smem_len; fb_size = fb_finfo.smem_len;
frame_buffer = NULL;
frame_buffer = (uint8_t *) mmap (0, fb_size, PROT_READ | PROT_WRITE, frame_buffer = (uint8_t *) mmap(0, fb_size, PROT_READ | PROT_WRITE,
MAP_SHARED, fb_dev_fd, 0); MAP_SHARED, fb_dev_fd, 0);
if (frame_buffer == (uint8_t *) -1) if (frame_buffer == (uint8_t *) -1) {
{ mp_msg(MSGT_VO, MSGL_ERR, "Can't mmap %s: %s\n", fb_dev_name, strerror(errno));
mp_msg (MSGT_VO, MSGL_ERR,
"Can't mmap %s: %s\n", WII_DEV_NAME, strerror (errno));
return 1; return 1;
} }
center = frame_buffer + center = frame_buffer +
((out_width - in_width) / 2) * FB_PIXEL_SIZE + ((out_width - in_width) / 2) * fb_pixel_size +
((out_height - in_height) / 2) * fb_line_len; ((out_height - in_height) / 2) * fb_line_len;
mp_msg (MSGT_VO, MSGL_DBG2, "Frame_buffer @ %p\n", frame_buffer); mp_msg(MSGT_VO, MSGL_DBG2, "frame_buffer @ %p\n", frame_buffer);
mp_msg (MSGT_VO, MSGL_DBG2, "Center @ %p\n", center); mp_msg(MSGT_VO, MSGL_DBG2, "center @ %p\n", center);
mp_msg (MSGT_VO, MSGL_V, mp_msg(MSGT_VO, MSGL_V, "pixel per line: %d\n", fb_line_len / fb_pixel_size);
"Pixel per line: %d\n", fb_line_len / FB_PIXEL_SIZE);
/* blanking screen */ /* blanking screen */
for (temp = 0; temp < fb_size; temp += 4) for (temp = 0; temp < fb_size; temp += 4)
memcpy (frame_buffer + temp, (void *) &black, 4); memcpy(frame_buffer + temp, (void *) &black, 4);
vt_fd = open (TTY_DEV_NAME, O_WRONLY); if (vt_doit && (vt_fd = open("/dev/tty", O_WRONLY)) == -1) {
if (vt_doit && vt_fd == -1) mp_msg(MSGT_VO, MSGL_ERR, "can't open /dev/tty: %s\n", strerror(errno));
{
mp_msg (MSGT_VO, MSGL_ERR,
"Can't open %s: %s\n", TTY_DEV_NAME, strerror (errno));
vt_doit = 0; vt_doit = 0;
} }
if (vt_doit && !(vt_fp = fdopen(vt_fd, "w"))) {
vt_fp = fdopen (vt_fd, "w"); mp_msg(MSGT_VO, MSGL_ERR, "can't fdopen /dev/tty: %s\n", strerror(errno));
if (vt_doit && !vt_fp)
{
mp_msg (MSGT_VO, MSGL_ERR,
"Can't fdopen %s: %s\n", TTY_DEV_NAME, strerror (errno));
vt_doit = 0; vt_doit = 0;
} }
if (vt_doit) if (vt_doit)
vt_set_textarea ((out_height + in_height) / 2, fb_vinfo.yres); vt_set_textarea((out_height + in_height) / 2, fb_vinfo.yres);
return 0; return 0;
} }
static int static int query_format(uint32_t format)
query_format (uint32_t format)
{ {
if (!fb_preinit (0)) if (!fb_preinit(0))
return 0; return 0;
if (format != IMGFMT_YUY2) if (format != IMGFMT_YUY2)
return 0; return 0;
return VFCAP_ACCEPT_STRIDE | VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW; return VFCAP_ACCEPT_STRIDE | VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW;
} }
static void static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src,
draw_alpha (int x0, int y0, int w, int h, unsigned char *srca, int stride)
unsigned char *src, unsigned char *srca, int stride)
{ {
unsigned char *dst; unsigned char *dst;
dst = center + fb_line_len * y0 + FB_PIXEL_SIZE * x0; dst = center + fb_line_len * y0 + fb_pixel_size * x0;
vo_draw_alpha_yuy2 (w, h, src, srca, stride, dst, fb_line_len);
vo_draw_alpha_yuy2(w, h, src, srca, stride, dst, fb_line_len);
} }
static int static int draw_frame(uint8_t *src[])
draw_frame (uint8_t *src[])
{ {
return 1; return 1;
} }
static int static int draw_slice(uint8_t *src[], int stride[], int w, int h, int x, int y)
draw_slice (uint8_t *src[], int stride[], int w, int h, int x, int y)
{ {
uint8_t *d, *s; uint8_t *d, *s;
d = center + fb_line_len * y + FB_PIXEL_SIZE * x; d = center + fb_line_len * y + fb_pixel_size * x;
s = src[0];
while (h) s = src[0];
{ while (h) {
memcpy (d, s, w * FB_PIXEL_SIZE); memcpy(d, s, w * fb_pixel_size);
d += fb_line_len; d += fb_line_len;
s += stride[0]; s += stride[0];
h--; h--;
@ -327,77 +290,58 @@ draw_slice (uint8_t *src[], int stride[], int w, int h, int x, int y)
return 0; return 0;
} }
static void static void check_events(void)
check_events(void)
{ {
/* unused */
} }
static void static void flip_page(void)
flip_page (void)
{ {
/* unused */
} }
static void static void draw_osd(void)
draw_osd (void)
{ {
vo_draw_text (in_width, in_height, draw_alpha); vo_draw_text(in_width, in_height, draw_alpha);
} }
static void static void uninit(void)
uninit (void)
{ {
if (ioctl (fb_dev_fd, FBIOGET_VSCREENINFO, &fb_vinfo)) if (ioctl(fb_dev_fd, FBIOGET_VSCREENINFO, &fb_vinfo))
mp_msg (MSGT_VO, MSGL_WARN, mp_msg(MSGT_VO, MSGL_WARN, "ioctl FBIOGET_VSCREENINFO: %s\n", strerror(errno));
"ioctl FBIOGET_VSCREENINFO: %s\n", strerror (errno));
fb_orig_vinfo.xoffset = fb_vinfo.xoffset; fb_orig_vinfo.xoffset = fb_vinfo.xoffset;
fb_orig_vinfo.yoffset = fb_vinfo.yoffset; fb_orig_vinfo.yoffset = fb_vinfo.yoffset;
if (ioctl(fb_dev_fd, FBIOPUT_VSCREENINFO, &fb_orig_vinfo))
if (ioctl (fb_dev_fd, FBIOPUT_VSCREENINFO, &fb_orig_vinfo)) mp_msg(MSGT_VO, MSGL_WARN, "Can't reset original fb_var_screeninfo: %s\n", strerror(errno));
mp_msg (MSGT_VO, MSGL_WARN, if (fb_tty_fd >= 0) {
"Can't reset original fb_var_screeninfo: %s\n", strerror (errno)); if (ioctl(fb_tty_fd, KDSETMODE, KD_TEXT) < 0)
mp_msg(MSGT_VO, MSGL_WARN, "Can't restore text mode: %s\n", strerror(errno));
if (fb_tty_fd >= 0)
{
if (ioctl (fb_tty_fd, KDSETMODE, KD_TEXT) < 0)
mp_msg (MSGT_VO, MSGL_WARN,
"Can't restore text mode: %s\n", strerror (errno));
} }
if (vt_doit) if (vt_doit)
vt_set_textarea (0, fb_orig_vinfo.yres); vt_set_textarea(0, fb_orig_vinfo.yres);
close(fb_tty_fd);
close (fb_tty_fd); close(fb_dev_fd);
close (fb_dev_fd);
if (frame_buffer) if (frame_buffer)
munmap (frame_buffer, fb_size); munmap(frame_buffer, fb_size);
frame_buffer = NULL; frame_buffer = NULL;
fb_preinit (1); fb_preinit(1);
} }
static int static int preinit(const char *vo_subdevice)
preinit (const char *vo_subdevice)
{ {
pre_init_err = 0; pre_init_err = 0;
if (!pre_init_err) if (!pre_init_err)
return pre_init_err = (fb_preinit (0) ? 0 : -1); return pre_init_err = (fb_preinit(0) ? 0 : -1);
return -1; return -1;
} }
static uint32_t static uint32_t get_image(mp_image_t *mpi)
get_image(mp_image_t *mpi)
{ {
if (((mpi->type != MP_IMGTYPE_STATIC) && (mpi->type != MP_IMGTYPE_TEMP)) || if (((mpi->type != MP_IMGTYPE_STATIC) && (mpi->type != MP_IMGTYPE_TEMP)) ||
(mpi->flags & MP_IMGFLAG_PLANAR) || (mpi->flags & MP_IMGFLAG_PLANAR) ||
(mpi->flags & MP_IMGFLAG_YUV) || (mpi->flags & MP_IMGFLAG_YUV) ||
(mpi->width != in_width) || (mpi->width != in_width) ||
(mpi->height != in_height)) (mpi->height != in_height)
)
return VO_FALSE; return VO_FALSE;
mpi->planes[0] = center; mpi->planes[0] = center;
@ -407,13 +351,12 @@ get_image(mp_image_t *mpi)
return VO_TRUE; return VO_TRUE;
} }
static int static int control(uint32_t request, void *data)
control (uint32_t request, void *data)
{ {
if (request == VOCTRL_GET_IMAGE) if (request == VOCTRL_GET_IMAGE)
return get_image (data); return get_image(data);
else if (request == VOCTRL_QUERY_FORMAT) else if (request == VOCTRL_QUERY_FORMAT)
return query_format (*((uint32_t*) data)); return query_format(*((uint32_t*) data));
return VO_NOTIMPL; return VO_NOTIMPL;
} }

View File

@ -6,14 +6,12 @@
#include "config.h" #include "config.h"
#include "video_out.h" #include "video_out.h"
#include "video_out_internal.h" #include "video_out_internal.h"
#include "aspect.h"
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/Xutil.h> #include <X11/Xutil.h>
#ifdef CONFIG_XF86VM
#include <X11/extensions/xf86vmode.h>
#endif
#include <errno.h> #include <errno.h>
#include "x11_common.h" #include "x11_common.h"
@ -83,7 +81,6 @@ static uint32_t out_format = 0;
static int out_offset; static int out_offset;
static int srcW = -1; static int srcW = -1;
static int srcH = -1; static int srcH = -1;
static int aspect; // 1<<16 based fixed point aspect, so that the aspect stays correct during resizing
static int old_vo_dwidth = -1; static int old_vo_dwidth = -1;
static int old_vo_dheight = -1; static int old_vo_dheight = -1;
@ -92,16 +89,13 @@ static void check_events(void)
{ {
int ret = vo_x11_check_events(mDisplay); int ret = vo_x11_check_events(mDisplay);
/* clear left over borders and redraw frame if we are paused */ if (ret & VO_EVENT_RESIZE)
vo_x11_clearwindow(mDisplay, vo_window);
else if (ret & VO_EVENT_EXPOSE)
vo_x11_clearwindow_part(mDisplay, vo_window, myximage->width,
myximage->height, 0);
if (ret & VO_EVENT_EXPOSE && int_pause) if (ret & VO_EVENT_EXPOSE && int_pause)
{
vo_x11_clearwindow_part(mDisplay, vo_window, myximage->width,
myximage->height, 0);
flip_page(); flip_page();
} else if ((ret & VO_EVENT_RESIZE) || (ret & VO_EVENT_EXPOSE))
vo_x11_clearwindow_part(mDisplay, vo_window, myximage->width,
myximage->height, 0);
} }
static void draw_alpha_32(int x0, int y0, int w, int h, unsigned char *src, static void draw_alpha_32(int x0, int y0, int w, int h, unsigned char *src,
@ -306,7 +300,6 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width,
// int interval, prefer_blank, allow_exp, nothing; // int interval, prefer_blank, allow_exp, nothing;
unsigned int fg, bg; unsigned int fg, bg;
XGCValues xgcv;
Colormap theCmap; Colormap theCmap;
XSetWindowAttributes xswa; XSetWindowAttributes xswa;
unsigned long xswamask; unsigned long xswamask;
@ -315,7 +308,6 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width,
#ifdef CONFIG_XF86VM #ifdef CONFIG_XF86VM
int vm = flags & VOFLAG_MODESWITCHING; int vm = flags & VOFLAG_MODESWITCHING;
#endif #endif
int fullscreen = flags & (VOFLAG_FULLSCREEN|VOFLAG_MODESWITCHING);
Flip_Flag = flags & VOFLAG_FLIPPING; Flip_Flag = flags & VOFLAG_FLIPPING;
zoomFlag = flags & VOFLAG_SWSCALE; zoomFlag = flags & VOFLAG_SWSCALE;
@ -330,10 +322,6 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width,
srcW = width; srcW = width;
srcH = height; srcH = height;
// if(!fullscreen) zoomFlag=1; //it makes no sense to avoid zooming on windowd mode
//printf( "w: %d h: %d\n\n",vo_dwidth,vo_dheight );
XGetWindowAttributes(mDisplay, mRootWin, &attribs); XGetWindowAttributes(mDisplay, mRootWin, &attribs);
depth = attribs.depth; depth = attribs.depth;
@ -354,8 +342,6 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width,
image_width = (width + 7) & (~7); image_width = (width + 7) & (~7);
image_height = height; image_height = height;
aspect = ((1 << 16) * d_width + d_height / 2) / d_height;
#ifdef CONFIG_GUI #ifdef CONFIG_GUI
if (use_gui) if (use_gui)
guiGetEvent(guiSetShVideo, 0); // the GUI will set up / resize the window guiGetEvent(guiSetShVideo, 0); // the GUI will set up / resize the window
@ -479,6 +465,11 @@ static void Display_Image(XImage * myximage, uint8_t * ImageData)
{ {
int x = (vo_dwidth - dst_width) / 2; int x = (vo_dwidth - dst_width) / 2;
int y = (vo_dheight - myximage->height) / 2; int y = (vo_dheight - myximage->height) / 2;
// do not draw if the image needs rescaling
if ((old_vo_dwidth != vo_dwidth || old_vo_dheight != vo_dheight) && zoomFlag)
return;
if (WinID == 0) { if (WinID == 0) {
x = vo_dx; x = vo_dx;
y = vo_dy; y = vo_dy;
@ -524,17 +515,13 @@ static int draw_slice(uint8_t * src[], int stride[], int w, int h,
{ {
int newW = vo_dwidth; int newW = vo_dwidth;
int newH = vo_dheight; int newH = vo_dheight;
int newAspect = (newW * (1 << 16) + (newH >> 1)) / newH;
struct SwsContext *oldContext = swsContext; struct SwsContext *oldContext = swsContext;
if (newAspect > aspect)
newW = (newH * aspect + (1 << 15)) >> 16;
else
newH = ((newW << 16) + (aspect >> 1)) / aspect;
old_vo_dwidth = vo_dwidth; old_vo_dwidth = vo_dwidth;
old_vo_dheight = vo_dheight; old_vo_dheight = vo_dheight;
if (vo_fs)
aspect(&newW, &newH, A_ZOOM);
if (sws_flags == 0) if (sws_flags == 0)
newW &= (~31); // not needed but, if the user wants the FAST_BILINEAR SCALER, then its needed newW &= (~31); // not needed but, if the user wants the FAST_BILINEAR SCALER, then its needed

View File

@ -460,7 +460,7 @@ XWindowAttributes attribs;
unsigned long xswamask; unsigned long xswamask;
int depth; int depth;
#ifdef CONFIG_XF86VM #ifdef CONFIG_XF86VM
int vm=0; int vm = flags & VOFLAG_MODESWITCHING;
#endif #endif
//end of vo_xv //end of vo_xv
@ -632,10 +632,6 @@ found_subpic:
skip_surface_allocation: skip_surface_allocation:
#ifdef CONFIG_XF86VM
if( flags&VOFLAG_MODESWITCHING ) vm = 1;
#endif
#ifdef CONFIG_GUI #ifdef CONFIG_GUI
if(use_gui) if(use_gui)
guiGetEvent( guiSetShVideo,0 ); // let the GUI to setup/resize our window guiGetEvent( guiSetShVideo,0 ); // let the GUI to setup/resize our window
@ -1033,9 +1029,6 @@ int i,cfs;
} }
static void check_events(void){ static void check_events(void){
Window mRoot;
uint32_t drwBorderWidth,drwDepth;
int e=vo_x11_check_events(mDisplay); int e=vo_x11_check_events(mDisplay);
if(e&VO_EVENT_RESIZE) if(e&VO_EVENT_RESIZE)
{ {

View File

@ -3194,6 +3194,12 @@ if(stream_dump_type==5){
exit_player(mpctx, MSGTR_Exit_error); exit_player(mpctx, MSGTR_Exit_error);
} }
} }
if(dvd_last_chapter > 0) {
int chapter = -1;
if (stream_control(mpctx->stream, STREAM_CTRL_GET_CURRENT_CHAPTER,
&chapter) == STREAM_OK && chapter + 1 > dvd_last_chapter)
break;
}
} }
if(fclose(f)) { if(fclose(f)) {
mp_msg(MSGT_MENCODER,MSGL_FATAL,MSGTR_ErrorWritingFile,stream_dump_name); mp_msg(MSGT_MENCODER,MSGL_FATAL,MSGTR_ErrorWritingFile,stream_dump_name);
@ -3380,6 +3386,11 @@ if((stream_dump_type)&&(stream_dump_type<4)){
if( (mpctx->demuxer->file_format==DEMUXER_TYPE_AVI || mpctx->demuxer->file_format==DEMUXER_TYPE_ASF || mpctx->demuxer->file_format==DEMUXER_TYPE_MOV) 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); && stream_dump_type==2) fwrite(&in_size,1,4,f);
if(in_size>0) fwrite(start,in_size,1,f); if(in_size>0) fwrite(start,in_size,1,f);
if(dvd_last_chapter>0) {
int cur_chapter = demuxer_get_current_chapter(mpctx->demuxer);
if(cur_chapter!=-1 && cur_chapter+1>dvd_last_chapter)
break;
}
} }
fclose(f); fclose(f);
mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_CoreDumped); mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_CoreDumped);

View File

@ -56,7 +56,7 @@ install-headers::
install -d "$(INCINSTDIR)" install -d "$(INCINSTDIR)"
install -d "$(LIBDIR)/pkgconfig" install -d "$(LIBDIR)/pkgconfig"
install -m 644 $(addprefix "$(SRC_DIR)"/,$(HEADERS)) "$(INCINSTDIR)" install -m 644 $(addprefix "$(SRC_DIR)"/,$(HEADERS)) "$(INCINSTDIR)"
install -m 644 $(BUILD_ROOT)/lib$(NAME).pc "$(LIBDIR)/pkgconfig" install -m 644 $(BUILD_ROOT)/lib$(NAME)/lib$(NAME).pc "$(LIBDIR)/pkgconfig"
uninstall-libs:: uninstall-libs::
-rm -f "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR)" \ -rm -f "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR)" \