Merge branch 'mplayer1_changes'

This commit is contained in:
Uoti Urpala 2011-07-06 13:07:37 +03:00
commit 2670ceeb81
53 changed files with 1049 additions and 1135 deletions

View File

@ -3850,21 +3850,22 @@ Do not do any conversion.
Select the scaling function to use for luminance scaling.
Only valid for yuv modes 2, 3, 4 and 6.
.RSss
0: Use simple linear filtering (default).
.br
1: Use bicubic B-spline filtering (better quality).
.IPs 0
Use simple linear filtering (default).
.IPs 1
Use bicubic B-spline filtering (better quality).
Needs one additional texture unit.
Older cards will not be able to handle this for chroma at least in fullscreen mode.
.br
2: Use cubic filtering in horizontal, linear filtering in vertical direction.
.IPs 2
Use cubic filtering in horizontal, linear filtering in vertical direction.
Works on a few more cards than method 1.
.br
3: Same as 1 but does not use a lookup texture.
.IPs 3
Same as 1 but does not use a lookup texture.
Might be faster on some cards.
.br
4: Use experimental unsharp masking with 3x3 support and a default strength of 0.5 (see filter-strength).
.br
5: Use experimental unsharp masking with 5x5 support and a default strength of 0.5 (see filter-strength).
.IPs 4
Use experimental unsharp masking with 3x3 support and a default strength of 0.5 (see filter-strength).
.IPs 5
Use experimental unsharp masking with 5x5 support and a default strength of 0.5 (see filter-strength).
.RE
.IPs cscale=<n>
Select the scaling function to use for chrominance scaling.
@ -3873,16 +3874,17 @@ For details see lscale.
Set the effect strength for the lscale/cscale filters that support it.
.IPs stereo=<value>
Select a method for stereo display.
You may have to use -aspect to fix the aspect value.
You may have to use \-aspect to fix the aspect value.
Experimental, do not expect too much from it.
.RSss
0: Normal 2D display
.br
1: left-right split input to full-color red-cyan stereo.
.br
2: left-right split input to full-color red-cyan stereo.
.br
3: left-right split input to quadbuffered stereo.
.IPs 0
normal 2D display
.IPs 1
Convert side by side input to full-color red-cyan stereo.
.IPs 2
Convert side by side input to full-color green-magenta stereo.
.IPs 3
Convert side by side input to quadbuffered stereo.
Only supported by very few OpenGL cards.
.RE
.RE
@ -7236,6 +7238,10 @@ width and height of the cleared rectangle
Thickness of the fuzzy edge of the rectangle (added to w and h).
When set to \-1, a green rectangle is drawn on the screen to
simplify finding the right x,y,w,h parameters.
.IPs file=<file>
You can specify a text file to load the coordinates from.
Each line must have a timestamp (in seconds, and in ascending order) and the
"x:y:w:h:t" coordinates (t can be omitted).
.RE
.PD 1
.
@ -7380,6 +7386,14 @@ right eye)
anaglyph yellow/blue colored (yellow filter on left eye, blue filter on right
eye)
.RE
.B irl or interleave_rows_left_first
.RS
Interleaved rows (left eye has top row, right eye starts on next row)
.RE
.B irr or interleave_rows_right_first
.RS
Interleaved rows (right eye has top row, left eye starts on next row)
.RE
.B ml or mono_left
.RS
mono output (left eye only)
@ -7389,6 +7403,13 @@ mono output (left eye only)
mono output (right eye only)
.RE
.RE
.I NOTE:
To use either of the interleaved-rows output formats to display
full-screen on a row-interleaved 3D display, you will need to scale the
video to the correct height first using the "scale" filter, if it is not
already the right height. Typically, that is 1080 rows (so use e.g.
"-vf scale=1440:1080,stereo3d=sbsl:irl" for a 720p side-by-side encoded
movie).
.RE
.PD 1
.

View File

@ -619,7 +619,7 @@ const m_option_t common_opts[] = {
{"sws", &sws_flags, CONF_TYPE_INT, 0, 0, 2, NULL},
{"ssf", (void *) scaler_filter_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
OPT_MAKE_FLAGS("zoom", softzoom, 0),
OPT_FLOATRANGE("aspect", movie_aspect, 0, 0.2, 3.0),
OPT_FLOATRANGE("aspect", movie_aspect, 0, 0.1, 10.0),
OPT_FLAG_CONSTANTS("noaspect", movie_aspect, 0, 0, 0),
OPT_FLOATRANGE("xy", screen_size_xy, 0, 0.001, 4096),

View File

@ -54,6 +54,7 @@
#endif
#include <libavutil/avutil.h>
#include "libmpcodecs/img_format.h"
#include "codec-cfg.h"
@ -96,12 +97,12 @@ static int add_to_fourcc(char *s, char *alias, unsigned int *fourcc,
goto err_out_too_many;
do {
tmp = mmioFOURCC(s[0], s[1], s[2], s[3]);
tmp = MKTAG(s[0], s[1], s[2], s[3]);
for (j = 0; j < i; j++)
if (tmp == fourcc[j])
goto err_out_duplicated;
fourcc[i] = tmp;
map[i] = alias ? mmioFOURCC(alias[0], alias[1], alias[2], alias[3]) : tmp;
map[i] = alias ? MKTAG(alias[0], alias[1], alias[2], alias[3]) : tmp;
s += 4;
i++;
} while ((*(s++) == ',') && --freeslots);

39
configure vendored
View File

@ -1427,8 +1427,7 @@ else
echores "$cc_version"
break
fi
cc_name_tmp=$($_cc -v 2>&1 | head -n 1 | cut -d ' ' -f 1)
if test "$cc_name_tmp" = "clang"; then
if $_cc -v 2>&1 | grep -q "clang"; then
echocheck "$_cc version"
cc_vendor=clang
cc_version=$($_cc -dumpversion 2>&1)
@ -1449,6 +1448,10 @@ else
fi # icc
test "$cc_fail" = yes && die "unsupported compiler version"
echocheck "working compiler"
cflag_check "" || die "Compiler is not functioning correctly. Check your installation and custom CFLAGS $CFLAGS ."
echo "yes"
if test -z "$_target" && x86 ; then
cat > $TMPC << EOF
int main(void) {
@ -1462,10 +1465,6 @@ fi
echo "Detected operating system: $system_name"
echo "Detected host architecture: $host_arch"
echocheck "host cc"
test "$_host_cc" || _host_cc=$_cc
echores $_host_cc
echocheck "cross compilation"
if test $_cross_compile = auto ; then
_cross_compile=yes
@ -1477,8 +1476,13 @@ if test $_cross_compile = yes; then
tmp_run() {
return 0
}
test "$_host_cc" || _host_cc=cc
fi
echocheck "host cc"
test "$_host_cc" || _host_cc=$_cc
echores $_host_cc
# ---
# now that we know what compiler should be used for compilation, try to find
@ -1533,14 +1537,13 @@ if x86 ; then
pparam=$(echo $exts | sed -e s/k6_mtrr/mtrr/ -e s/cyrix_arr/mtrr/ -e s/centaur_mcr/mtrr/ \
-e s/xmm/sse/ -e s/kni/sse/)
# SSE implies MMX2, but not all SSE processors report the mmxext CPU flag.
pparam=$(echo $pparam | sed -e 's/sse/sse mmxext/')
for ext in $pparam ; do
eval test \"\$_$ext\" = auto 2>/dev/null && eval _$ext=kernel_check
done
# SSE implies MMX2, but not all SSE processors report the mmxext CPU flag.
test $_sse = kernel_check && _mmxext=kernel_check
echocheck "CPU vendor"
echores "$pvendor ($pfamily:$pmodel:$pstepping)"
@ -2555,11 +2558,6 @@ echores "$xform_asm"
fi
if arm ; then
echocheck "ARM pld instruction"
pld=no
inline_asm_check '"pld [r0]"' && pld=yes
echores "$pld"
echocheck "ARMv5TE (Enhanced DSP Extensions)"
if test $_armv5te = "auto" ; then
_armv5te=no
@ -2605,7 +2603,7 @@ if arm ; then
echores "$_iwmmxt"
fi
cpuexts_all='ALTIVEC MMX MMX2 AMD3DNOW AMD3DNOWEXT SSE SSE2 SSSE3 FAST_CMOV CMOV FAST_CLZ PLD ARMV5TE ARMV6 ARMV6T2 ARMVFP NEON IWMMXT MMI VIS MVI'
cpuexts_all='ALTIVEC MMX MMX2 AMD3DNOW AMD3DNOWEXT SSE SSE2 SSSE3 FAST_CMOV CMOV FAST_CLZ ARMV5TE ARMV6 ARMV6T2 ARMVFP NEON IWMMXT MMI VIS MVI'
test "$_altivec" = yes && cpuexts="ALTIVEC $cpuexts"
test "$_mmx" = yes && cpuexts="MMX $cpuexts"
test "$_mmxext" = yes && cpuexts="MMX2 $cpuexts"
@ -2617,7 +2615,6 @@ test "$_ssse3" = yes && cpuexts="SSSE3 $cpuexts"
test "$_cmov" = yes && cpuexts="CMOV $cpuexts"
test "$_fast_cmov" = yes && cpuexts="FAST_CMOV $cpuexts"
test "$_fast_clz" = yes && cpuexts="FAST_CLZ $cpuexts"
test "$pld" = yes && cpuexts="PLD $cpuexts"
test "$_armv5te" = yes && cpuexts="ARMV5TE $cpuexts"
test "$_armv6" = yes && cpuexts="ARMV6 $cpuexts"
test "$_armv6t2" = yes && cpuexts="ARMV6T2 $cpuexts"
@ -3500,12 +3497,15 @@ echores "$_gettimeofday"
echocheck "glob()"
_glob=no
statement_check glob.h 'glob("filename", 0, 0, 0)' && _glob=yes
need_glob=no
if test "$_glob" = yes ; then
def_glob='#define HAVE_GLOB 1'
need_glob=no
else
def_glob='#undef HAVE_GLOB'
need_glob=yes
# HACK! need_glob currently enables compilation of a
# win32-specific glob()-replacement.
# Other OS neither need it nor can they use it (mf:// is disabled for them).
win32 && need_glob=yes
fi
echores "$_glob"
@ -3546,7 +3546,7 @@ fi #if sunos
echocheck "sys/sysinfo.h"
_sys_sysinfo=no
statement_check sys/sysinfo.h 'struct sysinfo s_info; sysinfo(&s_info)' && _sys_sysinfo=yes
statement_check sys/sysinfo.h 'struct sysinfo s_info; s_info.mem_unit=0; sysinfo(&s_info)' && _sys_sysinfo=yes
if test "$_sys_sysinfo" = yes ; then
def_sys_sysinfo_h='#define HAVE_SYS_SYSINFO_H 1'
else
@ -5342,6 +5342,7 @@ if test "$_libcdio" = yes && test "$_cdparanoia" = no ; then
def_libcdio='#define CONFIG_LIBCDIO 1'
def_havelibcdio='yes'
else
_libcdio=no
if test "$_cdparanoia" = yes ; then
res_comment="using cdparanoia"
fi

View File

@ -52,6 +52,7 @@ CpuCaps gCpuCaps;
* team for SSE support detection and more cpu detect code.
*/
#if CONFIG_RUNTIME_CPUDETECT
/* I believe this code works. However, it has only been used on a PII and PIII */
#if defined(__linux__) && defined(_POSIX_SOURCE) && !ARCH_X86_64
@ -221,6 +222,7 @@ static void check_os_katmai_support( void )
gCpuCaps.hasSSE=0;
#endif /* __linux__ */
}
#endif
// return TRUE if cpuid supported
@ -352,6 +354,7 @@ void GetCpuCaps( CpuCaps *caps)
gCpuCaps.has3DNowExt);
#endif
#if CONFIG_RUNTIME_CPUDETECT
/* FIXME: Does SSE2 need more OS support, too? */
if (caps->hasSSE)
check_os_katmai_support();
@ -361,7 +364,7 @@ void GetCpuCaps( CpuCaps *caps)
// caps->hasMMX2 = 0;
// caps->hasMMX = 0;
#if !CONFIG_RUNTIME_CPUDETECT
#else
#if !HAVE_MMX
if(caps->hasMMX) mp_msg(MSGT_CPUDETECT,MSGL_WARN,"MMX supported but disabled\n");
caps->hasMMX=0;

View File

@ -2445,6 +2445,15 @@ videocodec bwmpeg
dll "bw10.dll" ;requires vtaccess.dll
out YV12,YUY2,I420
videocodec csmscreen
info "csmscreen AVI lossless video codec"
comment "requires Esdll.dll"
status working
fourcc CSM0
driver vfw
dll "csmx.dll" ; b6cfb690fe5997da0f07506c8982334f *CSMX.dll
out BGR32,BGR24,BGR16 flip
videocodec matchware
info "matchware screen capture codec"
status working
@ -3278,6 +3287,7 @@ videocodec raw444P
format 0x0 0x50343434
format 0x20776172 0x50343434
fourcc 444p,444P
fourcc YV24 444P
out 444P
videocodec raw422P
@ -3289,6 +3299,7 @@ videocodec raw422P
fourcc 422p,422P
fourcc P422 422P
fourcc Y42B 422P
fourcc YV16 422P
out 422P
videocodec rawyv12
@ -3403,6 +3414,7 @@ videocodec ffraw444P
format 0x0
format 0x20776172
fourcc 444p,444P
fourcc YV24
driver ffmpeg
dll rawvideo
@ -3414,6 +3426,7 @@ videocodec ffraw422P
fourcc 422p,422P
fourcc P422,p422
fourcc Y42B,y42b
fourcc YV16,yv16
driver ffmpeg
dll rawvideo

View File

@ -1,15 +1,24 @@
[Desktop Entry]
Type=Application
Name=MPlayer Media Player
Name[ca]=Reproductor multimèdia MPlayer
GenericName=Multimedia player
Name=MPlayer
GenericName=Media Player
GenericName[ca]=Reproductor multimèdia
GenericName[de]=Medienwiedergabe
GenericName[fr]=Lecteur multimédia
GenericName[it]=Lettore multimediale
GenericName[ja]=メディアプレーヤー
X-GNOME-FullName=MPlayer Media Player
X-GNOME-FullName[ca]=MPlayer Reproductor multimèdia
X-GNOME-FullName[de]=MPlayer Medienwiedergabe
X-GNOME-FullName[fr]=MPlayer Lecteur multimédia
X-GNOME-FullName[it]=MPlayer Lettore multimediale
X-GNOME-FullName[ja]=MPlayer メディアプレーヤー
Comment=Play movies and songs
Comment[ca]=Reproduïu vídeos i cançons
Comment[de]=Filme und Musik abspielen
Comment[es]=Reproduzca vídeos y canciones
Comment[fr]=Lecteur multimédia
Comment[it]=Lettore multimediale
Comment[zh]=多媒体播放器
Comment[de]=Filme und Musik wiedergeben
Comment[fr]=Lit les films et musiques
Comment[it]=Riproduce filmati e musica
Comment[ja]=動画や音声のファイルを再生します
Icon=mplayer
TryExec=gmplayer
Exec=gmplayer %F

View File

@ -164,26 +164,26 @@
/* Packed YUV Formats */
#define IMGFMT_IUYV 0x56595549
#define IMGFMT_IY41 0x31435949
#define IMGFMT_IUYV 0x56595549 // Interlaced UYVY
#define IMGFMT_IY41 0x31435949 // Interlaced Y41P
#define IMGFMT_IYU1 0x31555949
#define IMGFMT_IYU2 0x32555949
#define IMGFMT_UYVY 0x59565955
#define IMGFMT_UYNV 0x564E5955
#define IMGFMT_cyuv 0x76757963
#define IMGFMT_Y422 0x32323459
#define IMGFMT_UYNV 0x564E5955 // Exactly same as UYVY
#define IMGFMT_cyuv 0x76757963 // upside-down UYVY
#define IMGFMT_Y422 0x32323459 // Exactly same as UYVY
#define IMGFMT_YUY2 0x32595559
#define IMGFMT_YUNV 0x564E5559
#define IMGFMT_YUNV 0x564E5559 // Exactly same as YUY2
#define IMGFMT_YVYU 0x55595659
#define IMGFMT_Y41P 0x50313459
#define IMGFMT_Y211 0x31313259
#define IMGFMT_Y41T 0x54313459
#define IMGFMT_Y42T 0x54323459
#define IMGFMT_V422 0x32323456
#define IMGFMT_Y41T 0x54313459 // Y41P, Y lsb = transparency
#define IMGFMT_Y42T 0x54323459 // UYVY, Y lsb = transparency
#define IMGFMT_V422 0x32323456 // upside-down UYVY?
#define IMGFMT_V655 0x35353656
#define IMGFMT_CLJR 0x524A4C43
#define IMGFMT_YUVP 0x50565559
#define IMGFMT_UYVP 0x50565955
#define IMGFMT_YUVP 0x50565559 // 10-bit YUYV
#define IMGFMT_UYVP 0x50565955 // 10-bit UYVY
/* Compressed Formats */
#define IMGFMT_MPEGPES (('M'<<24)|('P'<<16)|('E'<<8)|('S'))

View File

@ -24,6 +24,8 @@
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#include <limits.h>
#include <errno.h>
#include <math.h>
#include "mp_msg.h"
@ -41,16 +43,65 @@
static struct vf_priv_s {
unsigned int outfmt;
int xoff, yoff, lw, lh, band, show;
const char *file;
struct timed_rectangle {
int ts, x, y, w, h, b;
} *timed_rect;
int n_timed_rect;
int cur_timed_rect;
} const vf_priv_dflt = {
0,
0, 0, 0, 0, 0, 0
0, 0, 0, 0, 0, 0,
NULL, NULL, 0, 0,
};
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
/**
* Adjust the coordinates to suit the band width
* Also print a notice in verbose mode
*/
static void fix_band(struct vf_priv_s *p)
{
p->show = 0;
if (p->band < 0) {
p->band = 4;
p->show = 1;
}
p->lw += p->band*2;
p->lh += p->band*2;
p->xoff -= p->band;
p->yoff -= p->band;
mp_msg(MSGT_VFILTER, MSGL_V, "delogo: %d x %d, %d x %d, band = %d\n",
p->xoff, p->yoff, p->lw, p->lh, p->band);
}
static void update_sub(struct vf_priv_s *p, double pts)
{
int ipts = pts * 1000;
int tr = p->cur_timed_rect;
while (tr < p->n_timed_rect - 1 && ipts >= p->timed_rect[tr + 1].ts)
tr++;
while (tr >= 0 && ipts < p->timed_rect[tr].ts)
tr--;
if (tr == p->cur_timed_rect)
return;
p->cur_timed_rect = tr;
if (tr >= 0) {
p->xoff = p->timed_rect[tr].x;
p->yoff = p->timed_rect[tr].y;
p->lw = p->timed_rect[tr].w;
p->lh = p->timed_rect[tr].h;
p->band = p->timed_rect[tr].b;
} else {
p->xoff = p->yoff = p->lw = p->lh = p->band = 0;
}
fix_band(p);
}
static void delogo(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int width, int height,
int logo_x, int logo_y, int logo_w, int logo_h, int band, int show, int direct) {
int logo_x, int logo_y, int logo_w, int logo_h, int band, int show, int direct) {
int y, x;
int interp, dist;
uint8_t *xdst, *xsrc;
@ -80,46 +131,46 @@ static void delogo(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int
for(y = logo_y1+1; y < logo_y2-1; y++)
{
for (x = logo_x1+1, xdst = dst+logo_x1+1, xsrc = src+logo_x1+1; x < logo_x2-1; x++, xdst++, xsrc++) {
interp = ((topleft[srcStride*(y-logo_y-yclipt)]
+ topleft[srcStride*(y-logo_y-1-yclipt)]
+ topleft[srcStride*(y-logo_y+1-yclipt)])*(logo_w-(x-logo_x))/logo_w
+ (topright[srcStride*(y-logo_y-yclipt)]
+ topright[srcStride*(y-logo_y-1-yclipt)]
+ topright[srcStride*(y-logo_y+1-yclipt)])*(x-logo_x)/logo_w
+ (topleft[x-logo_x-xclipl]
+ topleft[x-logo_x-1-xclipl]
+ topleft[x-logo_x+1-xclipl])*(logo_h-(y-logo_y))/logo_h
+ (botleft[x-logo_x-xclipl]
+ botleft[x-logo_x-1-xclipl]
+ botleft[x-logo_x+1-xclipl])*(y-logo_y)/logo_h
)/6;
/* interp = (topleft[srcStride*(y-logo_y)]*(logo_w-(x-logo_x))/logo_w
+ topright[srcStride*(y-logo_y)]*(x-logo_x)/logo_w
+ topleft[x-logo_x]*(logo_h-(y-logo_y))/logo_h
+ botleft[x-logo_x]*(y-logo_y)/logo_h
)/2;*/
if (y >= logo_y+band && y < logo_y+logo_h-band && x >= logo_x+band && x < logo_x+logo_w-band) {
*xdst = interp;
} else {
dist = 0;
if (x < logo_x+band) dist = MAX(dist, logo_x-x+band);
else if (x >= logo_x+logo_w-band) dist = MAX(dist, x-(logo_x+logo_w-1-band));
if (y < logo_y+band) dist = MAX(dist, logo_y-y+band);
else if (y >= logo_y+logo_h-band) dist = MAX(dist, y-(logo_y+logo_h-1-band));
*xdst = (*xsrc*dist + interp*(band-dist))/band;
if (show && (dist == band-1)) *xdst = 0;
}
}
for (x = logo_x1+1, xdst = dst+logo_x1+1, xsrc = src+logo_x1+1; x < logo_x2-1; x++, xdst++, xsrc++) {
interp = ((topleft[srcStride*(y-logo_y-yclipt)]
+ topleft[srcStride*(y-logo_y-1-yclipt)]
+ topleft[srcStride*(y-logo_y+1-yclipt)])*(logo_w-(x-logo_x))/logo_w
+ (topright[srcStride*(y-logo_y-yclipt)]
+ topright[srcStride*(y-logo_y-1-yclipt)]
+ topright[srcStride*(y-logo_y+1-yclipt)])*(x-logo_x)/logo_w
+ (topleft[x-logo_x-xclipl]
+ topleft[x-logo_x-1-xclipl]
+ topleft[x-logo_x+1-xclipl])*(logo_h-(y-logo_y))/logo_h
+ (botleft[x-logo_x-xclipl]
+ botleft[x-logo_x-1-xclipl]
+ botleft[x-logo_x+1-xclipl])*(y-logo_y)/logo_h
)/6;
/* interp = (topleft[srcStride*(y-logo_y)]*(logo_w-(x-logo_x))/logo_w
+ topright[srcStride*(y-logo_y)]*(x-logo_x)/logo_w
+ topleft[x-logo_x]*(logo_h-(y-logo_y))/logo_h
+ botleft[x-logo_x]*(y-logo_y)/logo_h
)/2;*/
if (y >= logo_y+band && y < logo_y+logo_h-band && x >= logo_x+band && x < logo_x+logo_w-band) {
*xdst = interp;
} else {
dist = 0;
if (x < logo_x+band) dist = MAX(dist, logo_x-x+band);
else if (x >= logo_x+logo_w-band) dist = MAX(dist, x-(logo_x+logo_w-1-band));
if (y < logo_y+band) dist = MAX(dist, logo_y-y+band);
else if (y >= logo_y+logo_h-band) dist = MAX(dist, y-(logo_y+logo_h-1-band));
*xdst = (*xsrc*dist + interp*(band-dist))/band;
if (show && (dist == band-1)) *xdst = 0;
}
}
dst+= dstStride;
src+= srcStride;
dst+= dstStride;
src+= srcStride;
}
}
static int config(struct vf_instance *vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
}
@ -130,15 +181,15 @@ static void get_image(struct vf_instance *vf, mp_image_t *mpi){
if(mpi->imgfmt!=vf->priv->outfmt) return; // colorspace differ
// ok, we can do pp in-place (or pp disabled):
vf->dmpi=vf_get_image(vf->next,mpi->imgfmt,
mpi->type, mpi->flags, mpi->w, mpi->h);
mpi->type, mpi->flags, mpi->w, mpi->h);
mpi->planes[0]=vf->dmpi->planes[0];
mpi->stride[0]=vf->dmpi->stride[0];
mpi->width=vf->dmpi->width;
if(mpi->flags&MP_IMGFLAG_PLANAR){
mpi->planes[1]=vf->dmpi->planes[1];
mpi->planes[2]=vf->dmpi->planes[2];
mpi->stride[1]=vf->dmpi->stride[1];
mpi->stride[2]=vf->dmpi->stride[2];
mpi->stride[1]=vf->dmpi->stride[1];
mpi->stride[2]=vf->dmpi->stride[2];
}
mpi->flags|=MP_IMGFLAG_DIRECT;
}
@ -147,22 +198,24 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){
mp_image_t *dmpi;
if(!(mpi->flags&MP_IMGFLAG_DIRECT)){
// no DR, so get a new image! hope we'll get DR buffer:
vf->dmpi=vf_get_image(vf->next,vf->priv->outfmt,
MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,
mpi->w,mpi->h);
// no DR, so get a new image! hope we'll get DR buffer:
vf->dmpi=vf_get_image(vf->next,vf->priv->outfmt,
MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,
mpi->w,mpi->h);
}
dmpi= vf->dmpi;
if (vf->priv->timed_rect)
update_sub(vf->priv, pts);
delogo(dmpi->planes[0], mpi->planes[0], dmpi->stride[0], mpi->stride[0], mpi->w, mpi->h,
vf->priv->xoff, vf->priv->yoff, vf->priv->lw, vf->priv->lh, vf->priv->band, vf->priv->show,
mpi->flags&MP_IMGFLAG_DIRECT);
vf->priv->xoff, vf->priv->yoff, vf->priv->lw, vf->priv->lh, vf->priv->band, vf->priv->show,
mpi->flags&MP_IMGFLAG_DIRECT);
delogo(dmpi->planes[1], mpi->planes[1], dmpi->stride[1], mpi->stride[1], mpi->w/2, mpi->h/2,
vf->priv->xoff/2, vf->priv->yoff/2, vf->priv->lw/2, vf->priv->lh/2, vf->priv->band/2, vf->priv->show,
mpi->flags&MP_IMGFLAG_DIRECT);
vf->priv->xoff/2, vf->priv->yoff/2, vf->priv->lw/2, vf->priv->lh/2, vf->priv->band/2, vf->priv->show,
mpi->flags&MP_IMGFLAG_DIRECT);
delogo(dmpi->planes[2], mpi->planes[2], dmpi->stride[2], mpi->stride[2], mpi->w/2, mpi->h/2,
vf->priv->xoff/2, vf->priv->yoff/2, vf->priv->lw/2, vf->priv->lh/2, vf->priv->band/2, vf->priv->show,
mpi->flags&MP_IMGFLAG_DIRECT);
vf->priv->xoff/2, vf->priv->yoff/2, vf->priv->lw/2, vf->priv->lh/2, vf->priv->band/2, vf->priv->show,
mpi->flags&MP_IMGFLAG_DIRECT);
vf_clone_mpi_attributes(dmpi, mpi);
@ -184,7 +237,7 @@ static int query_format(struct vf_instance *vf, unsigned int fmt){
case IMGFMT_YV12:
case IMGFMT_I420:
case IMGFMT_IYUV:
return vf_next_query_format(vf,vf->priv->outfmt);
return vf_next_query_format(vf,vf->priv->outfmt);
}
return 0;
}
@ -196,6 +249,74 @@ static const unsigned int fmt_list[]={
0
};
static int load_timed_rectangles(struct vf_priv_s *delogo)
{
FILE *f;
char line[2048];
int lineno = 0, p;
double ts, last_ts = 0;
struct timed_rectangle *rect = NULL, *nr;
int n_rect = 0, alloc_rect = 0;
f = fopen(delogo->file, "r");
if (!f) {
mp_msg(MSGT_VFILTER, MSGL_ERR, "delogo: unable to load %s: %s\n",
delogo->file, strerror(errno));
return -1;
}
while (fgets(line, sizeof(line), f)) {
lineno++;
if (*line == '#' || *line == '\n')
continue;
if (n_rect == alloc_rect) {
if (alloc_rect > INT_MAX / 2 / (int)sizeof(*rect)) {
mp_msg(MSGT_VFILTER, MSGL_WARN,
"delogo: too many rectangles\n");
goto load_error;
}
alloc_rect = alloc_rect ? 2 * alloc_rect : 256;
nr = realloc(rect, alloc_rect * sizeof(*rect));
if (!nr) {
mp_msg(MSGT_VFILTER, MSGL_WARN, "delogo: out of memory\n");
goto load_error;
}
rect = nr;
}
nr = rect + n_rect;
memset(nr, 0, sizeof(*nr));
p = sscanf(line, "%lf %d:%d:%d:%d:%d",
&ts, &nr->x, &nr->y, &nr->w, &nr->h, &nr->b);
if ((p == 2 && !nr->x) || p == 5 || p == 6) {
if (ts <= last_ts)
mp_msg(MSGT_VFILTER, MSGL_WARN, "delogo: %s:%d: wrong time\n",
delogo->file, lineno);
nr->ts = 1000 * ts + 0.5;
n_rect++;
} else {
mp_msg(MSGT_VFILTER, MSGL_WARN, "delogo: %s:%d: syntax error\n",
delogo->file, lineno);
}
}
fclose(f);
if (!n_rect) {
mp_msg(MSGT_VFILTER, MSGL_ERR, "delogo: %s: no rectangles found\n",
delogo->file);
free(rect);
return -1;
}
nr = realloc(rect, n_rect * sizeof(*rect));
if (nr)
rect = nr;
delogo->timed_rect = rect;
delogo->n_timed_rect = n_rect;
return 0;
load_error:
free(rect);
fclose(f);
return -1;
}
static int vf_open(vf_instance_t *vf, char *args){
vf->config=config;
vf->put_image=put_image;
@ -203,29 +324,20 @@ static int vf_open(vf_instance_t *vf, char *args){
vf->query_format=query_format;
vf->uninit=uninit;
mp_msg(MSGT_VFILTER, MSGL_V, "delogo: %d x %d, %d x %d, band = %d\n",
vf->priv->xoff, vf->priv->yoff,
vf->priv->lw, vf->priv->lh,
vf->priv->band);
vf->priv->show = 0;
if (vf->priv->band < 0) {
vf->priv->band = 4;
vf->priv->show = 1;
if (vf->priv->file) {
if (load_timed_rectangles(vf->priv))
return 0;
mp_msg(MSGT_VFILTER, MSGL_V, "delogo: %d from %s\n",
vf->priv->n_timed_rect, vf->priv->file);
vf->priv->cur_timed_rect = -1;
}
vf->priv->lw += vf->priv->band*2;
vf->priv->lh += vf->priv->band*2;
vf->priv->xoff -= vf->priv->band;
vf->priv->yoff -= vf->priv->band;
fix_band(vf->priv);
// check csp:
vf->priv->outfmt=vf_match_csp(&vf->next,fmt_list,IMGFMT_YV12);
if(!vf->priv->outfmt)
{
uninit(vf);
uninit(vf);
return 0; // no csp match :(
}
@ -240,6 +352,7 @@ static const m_option_t vf_opts_fields[] = {
{ "h", ST_OFF(lh), CONF_TYPE_INT, 0, 0, 0, NULL },
{ "t", ST_OFF(band), CONF_TYPE_INT, 0, 0, 0, NULL },
{ "band", ST_OFF(band), CONF_TYPE_INT, 0, 0, 0, NULL }, // alias
{ "file", ST_OFF(file), CONF_TYPE_STRING, 0, 0, 0, NULL },
{ NULL, NULL, 0, 0, 0, 0, NULL }
};

View File

@ -32,7 +32,7 @@ struct vf_priv_s {
float sense; // first parameter
float level; // second parameter
unsigned int imgfmt;
char diff;
int diff;
uint32_t max;
// int dfr;
// int rdfr;
@ -73,7 +73,7 @@ static int config (struct vf_instance *vf,
vf->priv->diff = 31;
mp_msg (MSGT_VFILTER, MSGL_INFO, "Drop-interlaced: %dx%d diff %d / level %u\n",
vf->priv->pmpi->width, vf->priv->pmpi->height,
(int)vf->priv->diff, (unsigned int)vf->priv->max);
vf->priv->diff, (unsigned int)vf->priv->max);
// vf->priv->rdfr = vf->priv->dfr = 0;
vf->priv->was_dint = 0;
return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
@ -81,10 +81,10 @@ static int config (struct vf_instance *vf,
static int put_image (struct vf_instance *vf, mp_image_t *mpi, double pts)
{
char rrow0[MAXROWSIZE];
char rrow1[MAXROWSIZE];
char rrow2[MAXROWSIZE];
char *row0 = rrow0, *row1 = rrow1, *row2 = rrow2/*, *row3 = rrow3*/;
int8_t rrow0[MAXROWSIZE];
int8_t rrow1[MAXROWSIZE];
int8_t rrow2[MAXROWSIZE];
int8_t *row0 = rrow0, *row1 = rrow1, *row2 = rrow2/*, *row3 = rrow3*/;
int rowsize = mpi->width;
uint32_t nok = 0, max = vf->priv->max;
int diff = vf->priv->diff;

View File

@ -42,7 +42,7 @@ struct vf_priv_s
ocount, sum[5];
double threshold;
FILE *file;
char *bdata;
int8_t *bdata;
unsigned int *csdata;
int *history;
struct vf_detc_pts_buf ptsbuf;
@ -386,8 +386,8 @@ static int analyze(struct vf_priv_s *p)
{
int *buf=0, *bp, bufsize=0, n, b, f, i, j, m, s;
unsigned int *cbuf=0, *cp;
char *pbuf;
char lbuf[256];
int8_t *pbuf;
int8_t lbuf[256];
int sum[5];
double d;

View File

@ -28,303 +28,306 @@
#include "img_format.h"
#include "mp_image.h"
#include "vf.h"
#include "libavutil/attributes.h"
typedef void (pack_func_t)(unsigned char *dst, unsigned char *y,
unsigned char *u, unsigned char *v, int w, int us, int vs);
unsigned char *u, unsigned char *v, int w, int us, int vs);
struct vf_priv_s {
int mode;
pack_func_t *pack[2];
int mode;
pack_func_t *pack[2];
};
static void pack_nn_C(unsigned char *dst, unsigned char *y,
unsigned char *u, unsigned char *v, int w)
unsigned char *u, unsigned char *v, int w,
int av_unused us, int av_unused vs)
{
int j;
for (j = w/2; j; j--) {
*dst++ = *y++;
*dst++ = *u++;
*dst++ = *y++;
*dst++ = *v++;
}
int j;
for (j = w/2; j; j--) {
*dst++ = *y++;
*dst++ = *u++;
*dst++ = *y++;
*dst++ = *v++;
}
}
static void pack_li_0_C(unsigned char *dst, unsigned char *y,
unsigned char *u, unsigned char *v, int w, int us, int vs)
unsigned char *u, unsigned char *v, int w, int us, int vs)
{
int j;
for (j = w/2; j; j--) {
*dst++ = *y++;
*dst++ = (u[us+us] + 7*u[0])>>3;
*dst++ = *y++;
*dst++ = (v[vs+vs] + 7*v[0])>>3;
u++; v++;
}
int j;
for (j = w/2; j; j--) {
*dst++ = *y++;
*dst++ = (u[us+us] + 7*u[0])>>3;
*dst++ = *y++;
*dst++ = (v[vs+vs] + 7*v[0])>>3;
u++; v++;
}
}
static void pack_li_1_C(unsigned char *dst, unsigned char *y,
unsigned char *u, unsigned char *v, int w, int us, int vs)
unsigned char *u, unsigned char *v, int w, int us, int vs)
{
int j;
for (j = w/2; j; j--) {
*dst++ = *y++;
*dst++ = (3*u[us+us] + 5*u[0])>>3;
*dst++ = *y++;
*dst++ = (3*v[vs+vs] + 5*v[0])>>3;
u++; v++;
}
int j;
for (j = w/2; j; j--) {
*dst++ = *y++;
*dst++ = (3*u[us+us] + 5*u[0])>>3;
*dst++ = *y++;
*dst++ = (3*v[vs+vs] + 5*v[0])>>3;
u++; v++;
}
}
#if HAVE_MMX
static void pack_nn_MMX(unsigned char *dst, unsigned char *y,
unsigned char *u, unsigned char *v, int w)
unsigned char *u, unsigned char *v, int w,
int av_unused us, int av_unused vs)
{
__asm__ volatile (""
ASMALIGN(4)
"1: \n\t"
"movq (%0), %%mm1 \n\t"
"movq (%0), %%mm2 \n\t"
"movq (%1), %%mm4 \n\t"
"movq (%2), %%mm6 \n\t"
"punpcklbw %%mm6, %%mm4 \n\t"
"punpcklbw %%mm4, %%mm1 \n\t"
"punpckhbw %%mm4, %%mm2 \n\t"
__asm__ volatile (""
ASMALIGN(4)
"1: \n\t"
"movq (%0), %%mm1 \n\t"
"movq (%0), %%mm2 \n\t"
"movq (%1), %%mm4 \n\t"
"movq (%2), %%mm6 \n\t"
"punpcklbw %%mm6, %%mm4 \n\t"
"punpcklbw %%mm4, %%mm1 \n\t"
"punpckhbw %%mm4, %%mm2 \n\t"
"add $8, %0 \n\t"
"add $4, %1 \n\t"
"add $4, %2 \n\t"
"movq %%mm1, (%3) \n\t"
"movq %%mm2, 8(%3) \n\t"
"add $16, %3 \n\t"
"decl %4 \n\t"
"jnz 1b \n\t"
"emms \n\t"
:
: "r" (y), "r" (u), "r" (v), "r" (dst), "r" (w/8)
: "memory"
);
pack_nn_C(dst, y, u, v, (w&7));
"add $8, %0 \n\t"
"add $4, %1 \n\t"
"add $4, %2 \n\t"
"movq %%mm1, (%3) \n\t"
"movq %%mm2, 8(%3) \n\t"
"add $16, %3 \n\t"
"decl %4 \n\t"
"jnz 1b \n\t"
"emms \n\t"
:
: "r" (y), "r" (u), "r" (v), "r" (dst), "r" (w/8)
: "memory"
);
pack_nn_C(dst, y, u, v, (w&7), 0, 0);
}
#if HAVE_EBX_AVAILABLE
static void pack_li_0_MMX(unsigned char *dst, unsigned char *y,
unsigned char *u, unsigned char *v, int w, int us, int vs)
unsigned char *u, unsigned char *v, int w, int us, int vs)
{
__asm__ volatile (""
"push %%"REG_BP" \n\t"
__asm__ volatile (""
"push %%"REG_BP" \n\t"
#if ARCH_X86_64
"mov %6, %%"REG_BP" \n\t"
"mov %6, %%"REG_BP" \n\t"
#else
"movl 4(%%"REG_d"), %%"REG_BP" \n\t"
"movl (%%"REG_d"), %%"REG_d" \n\t"
"movl 4(%%"REG_d"), %%"REG_BP" \n\t"
"movl (%%"REG_d"), %%"REG_d" \n\t"
#endif
"pxor %%mm0, %%mm0 \n\t"
"pxor %%mm0, %%mm0 \n\t"
ASMALIGN(4)
".Lli0: \n\t"
"movq (%%"REG_S"), %%mm1 \n\t"
"movq (%%"REG_S"), %%mm2 \n\t"
ASMALIGN(4)
".Lli0: \n\t"
"movq (%%"REG_S"), %%mm1 \n\t"
"movq (%%"REG_S"), %%mm2 \n\t"
"movq (%%"REG_a",%%"REG_d",2), %%mm4 \n\t"
"movq (%%"REG_b",%%"REG_BP",2), %%mm6 \n\t"
"punpcklbw %%mm0, %%mm4 \n\t"
"punpcklbw %%mm0, %%mm6 \n\t"
"movq (%%"REG_a"), %%mm3 \n\t"
"movq (%%"REG_b"), %%mm5 \n\t"
"punpcklbw %%mm0, %%mm3 \n\t"
"punpcklbw %%mm0, %%mm5 \n\t"
"paddw %%mm3, %%mm4 \n\t"
"paddw %%mm5, %%mm6 \n\t"
"paddw %%mm3, %%mm4 \n\t"
"paddw %%mm5, %%mm6 \n\t"
"paddw %%mm3, %%mm4 \n\t"
"paddw %%mm5, %%mm6 \n\t"
"paddw %%mm3, %%mm4 \n\t"
"paddw %%mm5, %%mm6 \n\t"
"paddw %%mm3, %%mm4 \n\t"
"paddw %%mm5, %%mm6 \n\t"
"paddw %%mm3, %%mm4 \n\t"
"paddw %%mm5, %%mm6 \n\t"
"paddw %%mm3, %%mm4 \n\t"
"paddw %%mm5, %%mm6 \n\t"
"psrlw $3, %%mm4 \n\t"
"psrlw $3, %%mm6 \n\t"
"packuswb %%mm4, %%mm4 \n\t"
"packuswb %%mm6, %%mm6 \n\t"
"punpcklbw %%mm6, %%mm4 \n\t"
"punpcklbw %%mm4, %%mm1 \n\t"
"punpckhbw %%mm4, %%mm2 \n\t"
"movq (%%"REG_a",%%"REG_d",2), %%mm4 \n\t"
"movq (%%"REG_b",%%"REG_BP",2), %%mm6 \n\t"
"punpcklbw %%mm0, %%mm4 \n\t"
"punpcklbw %%mm0, %%mm6 \n\t"
"movq (%%"REG_a"), %%mm3 \n\t"
"movq (%%"REG_b"), %%mm5 \n\t"
"punpcklbw %%mm0, %%mm3 \n\t"
"punpcklbw %%mm0, %%mm5 \n\t"
"paddw %%mm3, %%mm4 \n\t"
"paddw %%mm5, %%mm6 \n\t"
"paddw %%mm3, %%mm4 \n\t"
"paddw %%mm5, %%mm6 \n\t"
"paddw %%mm3, %%mm4 \n\t"
"paddw %%mm5, %%mm6 \n\t"
"paddw %%mm3, %%mm4 \n\t"
"paddw %%mm5, %%mm6 \n\t"
"paddw %%mm3, %%mm4 \n\t"
"paddw %%mm5, %%mm6 \n\t"
"paddw %%mm3, %%mm4 \n\t"
"paddw %%mm5, %%mm6 \n\t"
"paddw %%mm3, %%mm4 \n\t"
"paddw %%mm5, %%mm6 \n\t"
"psrlw $3, %%mm4 \n\t"
"psrlw $3, %%mm6 \n\t"
"packuswb %%mm4, %%mm4 \n\t"
"packuswb %%mm6, %%mm6 \n\t"
"punpcklbw %%mm6, %%mm4 \n\t"
"punpcklbw %%mm4, %%mm1 \n\t"
"punpckhbw %%mm4, %%mm2 \n\t"
"movq %%mm1, (%%"REG_D") \n\t"
"movq %%mm2, 8(%%"REG_D") \n\t"
"movq %%mm1, (%%"REG_D") \n\t"
"movq %%mm2, 8(%%"REG_D") \n\t"
"movq 8(%%"REG_S"), %%mm1 \n\t"
"movq 8(%%"REG_S"), %%mm2 \n\t"
"movq 8(%%"REG_S"), %%mm1 \n\t"
"movq 8(%%"REG_S"), %%mm2 \n\t"
"movq (%%"REG_a",%%"REG_d",2), %%mm4 \n\t"
"movq (%%"REG_b",%%"REG_BP",2), %%mm6 \n\t"
"punpckhbw %%mm0, %%mm4 \n\t"
"punpckhbw %%mm0, %%mm6 \n\t"
"movq (%%"REG_a"), %%mm3 \n\t"
"movq (%%"REG_b"), %%mm5 \n\t"
"punpckhbw %%mm0, %%mm3 \n\t"
"punpckhbw %%mm0, %%mm5 \n\t"
"paddw %%mm3, %%mm4 \n\t"
"paddw %%mm5, %%mm6 \n\t"
"paddw %%mm3, %%mm4 \n\t"
"paddw %%mm5, %%mm6 \n\t"
"paddw %%mm3, %%mm4 \n\t"
"paddw %%mm5, %%mm6 \n\t"
"paddw %%mm3, %%mm4 \n\t"
"paddw %%mm5, %%mm6 \n\t"
"paddw %%mm3, %%mm4 \n\t"
"paddw %%mm5, %%mm6 \n\t"
"paddw %%mm3, %%mm4 \n\t"
"paddw %%mm5, %%mm6 \n\t"
"paddw %%mm3, %%mm4 \n\t"
"paddw %%mm5, %%mm6 \n\t"
"psrlw $3, %%mm4 \n\t"
"psrlw $3, %%mm6 \n\t"
"packuswb %%mm4, %%mm4 \n\t"
"packuswb %%mm6, %%mm6 \n\t"
"punpcklbw %%mm6, %%mm4 \n\t"
"punpcklbw %%mm4, %%mm1 \n\t"
"punpckhbw %%mm4, %%mm2 \n\t"
"movq (%%"REG_a",%%"REG_d",2), %%mm4 \n\t"
"movq (%%"REG_b",%%"REG_BP",2), %%mm6 \n\t"
"punpckhbw %%mm0, %%mm4 \n\t"
"punpckhbw %%mm0, %%mm6 \n\t"
"movq (%%"REG_a"), %%mm3 \n\t"
"movq (%%"REG_b"), %%mm5 \n\t"
"punpckhbw %%mm0, %%mm3 \n\t"
"punpckhbw %%mm0, %%mm5 \n\t"
"paddw %%mm3, %%mm4 \n\t"
"paddw %%mm5, %%mm6 \n\t"
"paddw %%mm3, %%mm4 \n\t"
"paddw %%mm5, %%mm6 \n\t"
"paddw %%mm3, %%mm4 \n\t"
"paddw %%mm5, %%mm6 \n\t"
"paddw %%mm3, %%mm4 \n\t"
"paddw %%mm5, %%mm6 \n\t"
"paddw %%mm3, %%mm4 \n\t"
"paddw %%mm5, %%mm6 \n\t"
"paddw %%mm3, %%mm4 \n\t"
"paddw %%mm5, %%mm6 \n\t"
"paddw %%mm3, %%mm4 \n\t"
"paddw %%mm5, %%mm6 \n\t"
"psrlw $3, %%mm4 \n\t"
"psrlw $3, %%mm6 \n\t"
"packuswb %%mm4, %%mm4 \n\t"
"packuswb %%mm6, %%mm6 \n\t"
"punpcklbw %%mm6, %%mm4 \n\t"
"punpcklbw %%mm4, %%mm1 \n\t"
"punpckhbw %%mm4, %%mm2 \n\t"
"add $16, %%"REG_S" \n\t"
"add $8, %%"REG_a" \n\t"
"add $8, %%"REG_b" \n\t"
"add $16, %%"REG_S" \n\t"
"add $8, %%"REG_a" \n\t"
"add $8, %%"REG_b" \n\t"
"movq %%mm1, 16(%%"REG_D") \n\t"
"movq %%mm2, 24(%%"REG_D") \n\t"
"add $32, %%"REG_D" \n\t"
"movq %%mm1, 16(%%"REG_D") \n\t"
"movq %%mm2, 24(%%"REG_D") \n\t"
"add $32, %%"REG_D" \n\t"
"decl %%ecx \n\t"
"jnz .Lli0 \n\t"
"emms \n\t"
"pop %%"REG_BP" \n\t"
:
: "S" (y), "D" (dst), "a" (u), "b" (v), "c" (w/16),
"decl %%ecx \n\t"
"jnz .Lli0 \n\t"
"emms \n\t"
"pop %%"REG_BP" \n\t"
:
: "S" (y), "D" (dst), "a" (u), "b" (v), "c" (w/16),
#if ARCH_X86_64
"d" ((x86_reg)us), "r" ((x86_reg)vs)
"d" ((x86_reg)us), "r" ((x86_reg)vs)
#else
"d" (&us)
"d" (&us)
#endif
: "memory"
);
pack_li_0_C(dst, y, u, v, (w&15), us, vs);
: "memory"
);
pack_li_0_C(dst, y, u, v, (w&15), us, vs);
}
static void pack_li_1_MMX(unsigned char *dst, unsigned char *y,
unsigned char *u, unsigned char *v, int w, int us, int vs)
unsigned char *u, unsigned char *v, int w, int us, int vs)
{
__asm__ volatile (""
"push %%"REG_BP" \n\t"
__asm__ volatile (""
"push %%"REG_BP" \n\t"
#if ARCH_X86_64
"mov %6, %%"REG_BP" \n\t"
"mov %6, %%"REG_BP" \n\t"
#else
"movl 4(%%"REG_d"), %%"REG_BP" \n\t"
"movl (%%"REG_d"), %%"REG_d" \n\t"
"movl 4(%%"REG_d"), %%"REG_BP" \n\t"
"movl (%%"REG_d"), %%"REG_d" \n\t"
#endif
"pxor %%mm0, %%mm0 \n\t"
"pxor %%mm0, %%mm0 \n\t"
ASMALIGN(4)
".Lli1: \n\t"
"movq (%%"REG_S"), %%mm1 \n\t"
"movq (%%"REG_S"), %%mm2 \n\t"
ASMALIGN(4)
".Lli1: \n\t"
"movq (%%"REG_S"), %%mm1 \n\t"
"movq (%%"REG_S"), %%mm2 \n\t"
"movq (%%"REG_a",%%"REG_d",2), %%mm4 \n\t"
"movq (%%"REG_b",%%"REG_BP",2), %%mm6 \n\t"
"punpcklbw %%mm0, %%mm4 \n\t"
"punpcklbw %%mm0, %%mm6 \n\t"
"movq (%%"REG_a"), %%mm3 \n\t"
"movq (%%"REG_b"), %%mm5 \n\t"
"punpcklbw %%mm0, %%mm3 \n\t"
"punpcklbw %%mm0, %%mm5 \n\t"
"movq %%mm4, %%mm7 \n\t"
"paddw %%mm4, %%mm4 \n\t"
"paddw %%mm7, %%mm4 \n\t"
"movq %%mm6, %%mm7 \n\t"
"paddw %%mm6, %%mm6 \n\t"
"paddw %%mm7, %%mm6 \n\t"
"paddw %%mm3, %%mm4 \n\t"
"paddw %%mm5, %%mm6 \n\t"
"paddw %%mm3, %%mm4 \n\t"
"paddw %%mm5, %%mm6 \n\t"
"paddw %%mm3, %%mm4 \n\t"
"paddw %%mm5, %%mm6 \n\t"
"paddw %%mm3, %%mm4 \n\t"
"paddw %%mm5, %%mm6 \n\t"
"paddw %%mm3, %%mm4 \n\t"
"paddw %%mm5, %%mm6 \n\t"
"psrlw $3, %%mm4 \n\t"
"psrlw $3, %%mm6 \n\t"
"packuswb %%mm4, %%mm4 \n\t"
"packuswb %%mm6, %%mm6 \n\t"
"punpcklbw %%mm6, %%mm4 \n\t"
"punpcklbw %%mm4, %%mm1 \n\t"
"punpckhbw %%mm4, %%mm2 \n\t"
"movq (%%"REG_a",%%"REG_d",2), %%mm4 \n\t"
"movq (%%"REG_b",%%"REG_BP",2), %%mm6 \n\t"
"punpcklbw %%mm0, %%mm4 \n\t"
"punpcklbw %%mm0, %%mm6 \n\t"
"movq (%%"REG_a"), %%mm3 \n\t"
"movq (%%"REG_b"), %%mm5 \n\t"
"punpcklbw %%mm0, %%mm3 \n\t"
"punpcklbw %%mm0, %%mm5 \n\t"
"movq %%mm4, %%mm7 \n\t"
"paddw %%mm4, %%mm4 \n\t"
"paddw %%mm7, %%mm4 \n\t"
"movq %%mm6, %%mm7 \n\t"
"paddw %%mm6, %%mm6 \n\t"
"paddw %%mm7, %%mm6 \n\t"
"paddw %%mm3, %%mm4 \n\t"
"paddw %%mm5, %%mm6 \n\t"
"paddw %%mm3, %%mm4 \n\t"
"paddw %%mm5, %%mm6 \n\t"
"paddw %%mm3, %%mm4 \n\t"
"paddw %%mm5, %%mm6 \n\t"
"paddw %%mm3, %%mm4 \n\t"
"paddw %%mm5, %%mm6 \n\t"
"paddw %%mm3, %%mm4 \n\t"
"paddw %%mm5, %%mm6 \n\t"
"psrlw $3, %%mm4 \n\t"
"psrlw $3, %%mm6 \n\t"
"packuswb %%mm4, %%mm4 \n\t"
"packuswb %%mm6, %%mm6 \n\t"
"punpcklbw %%mm6, %%mm4 \n\t"
"punpcklbw %%mm4, %%mm1 \n\t"
"punpckhbw %%mm4, %%mm2 \n\t"
"movq %%mm1, (%%"REG_D") \n\t"
"movq %%mm2, 8(%%"REG_D") \n\t"
"movq %%mm1, (%%"REG_D") \n\t"
"movq %%mm2, 8(%%"REG_D") \n\t"
"movq 8(%%"REG_S"), %%mm1 \n\t"
"movq 8(%%"REG_S"), %%mm2 \n\t"
"movq 8(%%"REG_S"), %%mm1 \n\t"
"movq 8(%%"REG_S"), %%mm2 \n\t"
"movq (%%"REG_a",%%"REG_d",2), %%mm4 \n\t"
"movq (%%"REG_b",%%"REG_BP",2), %%mm6 \n\t"
"punpckhbw %%mm0, %%mm4 \n\t"
"punpckhbw %%mm0, %%mm6 \n\t"
"movq (%%"REG_a"), %%mm3 \n\t"
"movq (%%"REG_b"), %%mm5 \n\t"
"punpckhbw %%mm0, %%mm3 \n\t"
"punpckhbw %%mm0, %%mm5 \n\t"
"movq %%mm4, %%mm7 \n\t"
"paddw %%mm4, %%mm4 \n\t"
"paddw %%mm7, %%mm4 \n\t"
"movq %%mm6, %%mm7 \n\t"
"paddw %%mm6, %%mm6 \n\t"
"paddw %%mm7, %%mm6 \n\t"
"paddw %%mm3, %%mm4 \n\t"
"paddw %%mm5, %%mm6 \n\t"
"paddw %%mm3, %%mm4 \n\t"
"paddw %%mm5, %%mm6 \n\t"
"paddw %%mm3, %%mm4 \n\t"
"paddw %%mm5, %%mm6 \n\t"
"paddw %%mm3, %%mm4 \n\t"
"paddw %%mm5, %%mm6 \n\t"
"paddw %%mm3, %%mm4 \n\t"
"paddw %%mm5, %%mm6 \n\t"
"psrlw $3, %%mm4 \n\t"
"psrlw $3, %%mm6 \n\t"
"packuswb %%mm4, %%mm4 \n\t"
"packuswb %%mm6, %%mm6 \n\t"
"punpcklbw %%mm6, %%mm4 \n\t"
"punpcklbw %%mm4, %%mm1 \n\t"
"punpckhbw %%mm4, %%mm2 \n\t"
"movq (%%"REG_a",%%"REG_d",2), %%mm4 \n\t"
"movq (%%"REG_b",%%"REG_BP",2), %%mm6 \n\t"
"punpckhbw %%mm0, %%mm4 \n\t"
"punpckhbw %%mm0, %%mm6 \n\t"
"movq (%%"REG_a"), %%mm3 \n\t"
"movq (%%"REG_b"), %%mm5 \n\t"
"punpckhbw %%mm0, %%mm3 \n\t"
"punpckhbw %%mm0, %%mm5 \n\t"
"movq %%mm4, %%mm7 \n\t"
"paddw %%mm4, %%mm4 \n\t"
"paddw %%mm7, %%mm4 \n\t"
"movq %%mm6, %%mm7 \n\t"
"paddw %%mm6, %%mm6 \n\t"
"paddw %%mm7, %%mm6 \n\t"
"paddw %%mm3, %%mm4 \n\t"
"paddw %%mm5, %%mm6 \n\t"
"paddw %%mm3, %%mm4 \n\t"
"paddw %%mm5, %%mm6 \n\t"
"paddw %%mm3, %%mm4 \n\t"
"paddw %%mm5, %%mm6 \n\t"
"paddw %%mm3, %%mm4 \n\t"
"paddw %%mm5, %%mm6 \n\t"
"paddw %%mm3, %%mm4 \n\t"
"paddw %%mm5, %%mm6 \n\t"
"psrlw $3, %%mm4 \n\t"
"psrlw $3, %%mm6 \n\t"
"packuswb %%mm4, %%mm4 \n\t"
"packuswb %%mm6, %%mm6 \n\t"
"punpcklbw %%mm6, %%mm4 \n\t"
"punpcklbw %%mm4, %%mm1 \n\t"
"punpckhbw %%mm4, %%mm2 \n\t"
"add $16, %%"REG_S" \n\t"
"add $8, %%"REG_a" \n\t"
"add $8, %%"REG_b" \n\t"
"add $16, %%"REG_S" \n\t"
"add $8, %%"REG_a" \n\t"
"add $8, %%"REG_b" \n\t"
"movq %%mm1, 16(%%"REG_D") \n\t"
"movq %%mm2, 24(%%"REG_D") \n\t"
"add $32, %%"REG_D" \n\t"
"movq %%mm1, 16(%%"REG_D") \n\t"
"movq %%mm2, 24(%%"REG_D") \n\t"
"add $32, %%"REG_D" \n\t"
"decl %%ecx \n\t"
"jnz .Lli1 \n\t"
"emms \n\t"
"pop %%"REG_BP" \n\t"
:
: "S" (y), "D" (dst), "a" (u), "b" (v), "c" (w/16),
"decl %%ecx \n\t"
"jnz .Lli1 \n\t"
"emms \n\t"
"pop %%"REG_BP" \n\t"
:
: "S" (y), "D" (dst), "a" (u), "b" (v), "c" (w/16),
#if ARCH_X86_64
"d" ((x86_reg)us), "r" ((x86_reg)vs)
"d" ((x86_reg)us), "r" ((x86_reg)vs)
#else
"d" (&us)
"d" (&us)
#endif
: "memory"
);
pack_li_1_C(dst, y, u, v, (w&15), us, vs);
: "memory"
);
pack_li_1_C(dst, y, u, v, (w&15), us, vs);
}
#endif /* HAVE_EBX_AVAILABLE */
#endif
@ -334,120 +337,120 @@ static pack_func_t *pack_li_0;
static pack_func_t *pack_li_1;
static void ilpack(unsigned char *dst, unsigned char *src[3],
int dststride, int srcstride[3], int w, int h, pack_func_t *pack[2])
int dststride, int srcstride[3], int w, int h, pack_func_t *pack[2])
{
int i;
unsigned char *y, *u, *v;
int ys = srcstride[0], us = srcstride[1], vs = srcstride[2];
int a, b;
int i;
unsigned char *y, *u, *v;
int ys = srcstride[0], us = srcstride[1], vs = srcstride[2];
int a, b;
y = src[0];
u = src[1];
v = src[2];
y = src[0];
u = src[1];
v = src[2];
pack_nn(dst, y, u, v, w, 0, 0);
y += ys; dst += dststride;
pack_nn(dst, y, u+us, v+vs, w, 0, 0);
y += ys; dst += dststride;
for (i=2; i<h-2; i++) {
a = (i&2) ? 1 : -1;
b = (i&1) ^ ((i&2)>>1);
pack[b](dst, y, u, v, w, us*a, vs*a);
y += ys;
if ((i&3) == 1) {
u -= us;
v -= vs;
} else {
u += us;
v += vs;
}
dst += dststride;
}
pack_nn(dst, y, u, v, w, 0, 0);
y += ys; dst += dststride; u += us; v += vs;
pack_nn(dst, y, u, v, w, 0, 0);
pack_nn(dst, y, u, v, w, 0, 0);
y += ys; dst += dststride;
pack_nn(dst, y, u+us, v+vs, w, 0, 0);
y += ys; dst += dststride;
for (i=2; i<h-2; i++) {
a = (i&2) ? 1 : -1;
b = (i&1) ^ ((i&2)>>1);
pack[b](dst, y, u, v, w, us*a, vs*a);
y += ys;
if ((i&3) == 1) {
u -= us;
v -= vs;
} else {
u += us;
v += vs;
}
dst += dststride;
}
pack_nn(dst, y, u, v, w, 0, 0);
y += ys; dst += dststride; u += us; v += vs;
pack_nn(dst, y, u, v, w, 0, 0);
}
static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
{
mp_image_t *dmpi;
mp_image_t *dmpi;
// hope we'll get DR buffer:
dmpi=vf_get_image(vf->next, IMGFMT_YUY2,
MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,
mpi->w, mpi->h);
// hope we'll get DR buffer:
dmpi=vf_get_image(vf->next, IMGFMT_YUY2,
MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,
mpi->w, mpi->h);
ilpack(dmpi->planes[0], mpi->planes, dmpi->stride[0], mpi->stride, mpi->w, mpi->h, vf->priv->pack);
ilpack(dmpi->planes[0], mpi->planes, dmpi->stride[0], mpi->stride, mpi->w, mpi->h, vf->priv->pack);
return vf_next_put_image(vf,dmpi, pts);
return vf_next_put_image(vf,dmpi, pts);
}
static int config(struct vf_instance *vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt)
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt)
{
/* FIXME - also support UYVY output? */
return vf_next_config(vf, width, height, d_width, d_height, flags, IMGFMT_YUY2);
/* FIXME - also support UYVY output? */
return vf_next_config(vf, width, height, d_width, d_height, flags, IMGFMT_YUY2);
}
static int query_format(struct vf_instance *vf, unsigned int fmt)
{
/* FIXME - really any YUV 4:2:0 input format should work */
switch (fmt) {
case IMGFMT_YV12:
case IMGFMT_IYUV:
case IMGFMT_I420:
return vf_next_query_format(vf,IMGFMT_YUY2);
}
return 0;
/* FIXME - really any YUV 4:2:0 input format should work */
switch (fmt) {
case IMGFMT_YV12:
case IMGFMT_IYUV:
case IMGFMT_I420:
return vf_next_query_format(vf,IMGFMT_YUY2);
}
return 0;
}
static int vf_open(vf_instance_t *vf, char *args)
{
vf->config=config;
vf->query_format=query_format;
vf->put_image=put_image;
vf->priv = calloc(1, sizeof(struct vf_priv_s));
vf->priv->mode = 1;
if (args) sscanf(args, "%d", &vf->priv->mode);
vf->config=config;
vf->query_format=query_format;
vf->put_image=put_image;
vf->priv = calloc(1, sizeof(struct vf_priv_s));
vf->priv->mode = 1;
if (args) sscanf(args, "%d", &vf->priv->mode);
pack_nn = (pack_func_t *)pack_nn_C;
pack_li_0 = pack_li_0_C;
pack_li_1 = pack_li_1_C;
pack_nn = pack_nn_C;
pack_li_0 = pack_li_0_C;
pack_li_1 = pack_li_1_C;
#if HAVE_MMX
if(gCpuCaps.hasMMX) {
pack_nn = (pack_func_t *)pack_nn_MMX;
if(gCpuCaps.hasMMX) {
pack_nn = pack_nn_MMX;
#if HAVE_EBX_AVAILABLE
pack_li_0 = pack_li_0_MMX;
pack_li_1 = pack_li_1_MMX;
pack_li_0 = pack_li_0_MMX;
pack_li_1 = pack_li_1_MMX;
#endif
}
}
#endif
switch(vf->priv->mode) {
case 0:
vf->priv->pack[0] = vf->priv->pack[1] = pack_nn;
break;
default:
mp_msg(MSGT_VFILTER, MSGL_WARN,
"ilpack: unknown mode %d (fallback to linear)\n",
vf->priv->mode);
case 1:
vf->priv->pack[0] = pack_li_0;
vf->priv->pack[1] = pack_li_1;
break;
}
switch(vf->priv->mode) {
case 0:
vf->priv->pack[0] = vf->priv->pack[1] = pack_nn;
break;
default:
mp_msg(MSGT_VFILTER, MSGL_WARN,
"ilpack: unknown mode %d (fallback to linear)\n",
vf->priv->mode);
case 1:
vf->priv->pack[0] = pack_li_0;
vf->priv->pack[1] = pack_li_1;
break;
}
return 1;
return 1;
}
const vf_info_t vf_info_ilpack = {
"4:2:0 planar -> 4:2:2 packed reinterlacer",
"ilpack",
"Richard Felker",
"",
vf_open,
NULL
"4:2:0 planar -> 4:2:2 packed reinterlacer",
"ilpack",
"Richard Felker",
"",
vf_open,
NULL
};

View File

@ -56,6 +56,8 @@ typedef enum stereo_code {
ABOVE_BELOW_RL, //above-below (right eye above, left eye below)
ABOVE_BELOW_2_LR, //above-below with half height resolution
ABOVE_BELOW_2_RL, //above-below with half height resolution
INTERLEAVE_ROWS_LR, //row-interleave (left eye has top row)
INTERLEAVE_ROWS_RL, //row-interleave (right eye has top row)
STEREO_CODE_COUNT //no value set - TODO: needs autodetection
} stereo_code;
@ -109,6 +111,7 @@ struct vf_priv_s {
int ana_matrix[3][6];
unsigned int width;
unsigned int height;
unsigned int row_step;
} const vf_priv_default = {
{SIDE_BY_SIDE_LR},
{ANAGLYPH_RC_DUBOIS}
@ -137,6 +140,7 @@ static int config(struct vf_instance *vf, int width, int height, int d_width,
//default input values
vf->priv->width = width;
vf->priv->height = height;
vf->priv->row_step = 1;
vf->priv->in.width = width;
vf->priv->in.height = height;
vf->priv->in.off_left = 0;
@ -215,6 +219,18 @@ static int config(struct vf_instance *vf, int width, int height, int d_width,
vf->priv->out.height = vf->priv->height * 2;
vf->priv->out.row_left = vf->priv->height;
break;
case INTERLEAVE_ROWS_LR:
vf->priv->row_step = 2;
vf->priv->height = vf->priv->height / 2;
vf->priv->out.off_right = vf->priv->width * 3;
vf->priv->in.off_right += vf->priv->in.width * 3;
break;
case INTERLEAVE_ROWS_RL:
vf->priv->row_step = 2;
vf->priv->height = vf->priv->height / 2;
vf->priv->out.off_left = vf->priv->width * 3;
vf->priv->in.off_left += vf->priv->in.width * 3;
break;
case MONO_R:
//same as MONO_L only needs switching of input offsets
vf->priv->in.off_left = vf->priv->in.off_right;
@ -264,18 +280,22 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
case ABOVE_BELOW_RL:
case ABOVE_BELOW_2_LR:
case ABOVE_BELOW_2_RL:
memcpy_pic(dmpi->planes[0] + out_off_left,
case INTERLEAVE_ROWS_LR:
case INTERLEAVE_ROWS_RL:
memcpy_pic2(dmpi->planes[0] + out_off_left,
mpi->planes[0] + in_off_left,
3 * vf->priv->width,
vf->priv->height,
dmpi->stride[0],
mpi->stride[0]);
memcpy_pic(dmpi->planes[0] + out_off_right,
dmpi->stride[0] * vf->priv->row_step,
mpi->stride[0] * vf->priv->row_step,
vf->priv->row_step != 1);
memcpy_pic2(dmpi->planes[0] + out_off_right,
mpi->planes[0] + in_off_right,
3 * vf->priv->width,
vf->priv->height,
dmpi->stride[0],
mpi->stride[0]);
dmpi->stride[0] * vf->priv->row_step,
mpi->stride[0] * vf->priv->row_step,
vf->priv->row_step != 1);
break;
case MONO_L:
case MONO_R:
@ -397,6 +417,10 @@ static const struct format_preset {
{"above_below_half_height_left_first", ABOVE_BELOW_2_LR},
{"ab2r", ABOVE_BELOW_2_RL},
{"above_below_half_height_right_first",ABOVE_BELOW_2_RL},
{"irl", INTERLEAVE_ROWS_LR},
{"interleave_rows_left_first", INTERLEAVE_ROWS_LR},
{"irr", INTERLEAVE_ROWS_RL},
{"interleave_rows_right_first", INTERLEAVE_ROWS_RL},
{ NULL, 0}
};

View File

@ -52,7 +52,7 @@ typedef struct __attribute__((packed)) {
uint64_t num_packets; //Number of packets UINT64 8
uint64_t play_duration; //Timestamp of the end position UINT64 8
uint64_t send_duration; //Duration of the playback UINT64 8
uint64_t preroll; //Time to bufferize before playing UINT32 4
uint64_t preroll; //Time to bufferize before playing UINT64 8
uint32_t flags; //Unknown, maybe flags ( usually contains 2 ) UINT32 4
uint32_t min_packet_size; //Min size of the packet, in bytes UINT32 4
uint32_t max_packet_size; //Max size of the packet UINT32 4

View File

@ -542,7 +542,7 @@ int read_asf_header(demuxer_t *demuxer,struct asf_priv* asf){
asf->packetsize=fileh->max_packet_size;
asf->packet=malloc(asf->packetsize); // !!!
asf->packetrate=fileh->max_bitrate/8.0/(double)asf->packetsize;
asf->movielength=(fileh->play_duration-10000*fileh->preroll)/10000000.0;
asf->movielength=FFMAX(0.0, (fileh->play_duration / 10000.0 - fileh->preroll) / 1000.0);
}
// find content header

View File

@ -517,8 +517,8 @@ static void handle_stream(demuxer_t *demuxer, AVFormatContext *avfc, int i)
if (stream_type) {
AVCodec *avc = avcodec_find_decoder(codec->codec_id);
const char *codec_name = avc ? avc->name : "unknown";
if (!avc && *stream_type == 's' && demuxer->s_streams[stream_id])
codec_name = sh_sub_type2str(((sh_sub_t *)demuxer->s_streams[stream_id])->type);
if (!avc && *stream_type == 's' && demuxer->s_streams[i])
codec_name = sh_sub_type2str(((sh_sub_t *)demuxer->s_streams[i])->type);
mp_msg(MSGT_DEMUX, MSGL_INFO, "[lavf] stream %d: %s (%s), -%cid %d",
i, stream_type, codec_name, *stream_type, stream_id);
if (lang && lang->value && *stream_type != 'v')
@ -596,11 +596,13 @@ static demuxer_t *demux_open_lavf(demuxer_t *demuxer)
} else
av_strlcat(mp_filename, "foobar.dummy", sizeof(mp_filename));
priv->pb = av_alloc_put_byte(priv->buffer, BIO_BUFFER_SIZE, 0,
demuxer, mp_read, NULL, mp_seek);
priv->pb->read_seek = mp_read_seek;
priv->pb->is_streamed = !demuxer->stream->end_pos ||
(demuxer->stream->flags & MP_STREAM_SEEK) != MP_STREAM_SEEK;
if (!(priv->avif->flags & AVFMT_NOFILE)) {
priv->pb = av_alloc_put_byte(priv->buffer, BIO_BUFFER_SIZE, 0,
demuxer, mp_read, NULL, mp_seek);
priv->pb->read_seek = mp_read_seek;
priv->pb->is_streamed = !demuxer->stream->end_pos ||
(demuxer->stream->flags & MP_STREAM_SEEK) != MP_STREAM_SEEK;
}
if (av_open_input_stream(&avfc, priv->pb, mp_filename, priv->avif,
&ap) < 0) {

View File

@ -498,11 +498,32 @@ static demux_packet_t* getBuffer(demuxer_t* demuxer, demux_stream_t* ds,
RTPState* rtpState = (RTPState*)(demuxer->priv);
ReadBufferQueue* bufferQueue = NULL;
int headersize = 0;
TaskToken task;
int waitboth = 0;
TaskToken task, task2;
if (demuxer->stream->eof) return NULL;
if (ds == demuxer->video) {
bufferQueue = rtpState->audioBufferQueue;
// HACK: for the latest versions we must also receive audio
// when probing for video FPS, otherwise the stream just hangs
// and times out
if (mustGetNewData &&
bufferQueue &&
bufferQueue->readSource() &&
!bufferQueue->nextpacket) {
headersize = bufferQueue->readSource()->isAMRAudioSource() ? 1 : 0;
demux_packet_t *dp = new_demux_packet(MAX_RTP_FRAME_SIZE);
bufferQueue->dp = dp;
bufferQueue->blockingFlag = 0;
bufferQueue->readSource()->getNextFrame(
&dp->buffer[headersize], MAX_RTP_FRAME_SIZE - headersize,
afterReading, bufferQueue,
onSourceClosure, bufferQueue);
task2 = bufferQueue->readSource()->envir().taskScheduler().
scheduleDelayedTask(10000000, onSourceClosure, bufferQueue);
waitboth = 1;
}
bufferQueue = rtpState->videoBufferQueue;
if (((sh_video_t*)ds->sh)->format == mmioFOURCC('H','2','6','4'))
headersize = 3;
@ -560,6 +581,10 @@ static demux_packet_t* getBuffer(demuxer_t* demuxer, demux_stream_t* ds,
task = scheduler.scheduleDelayedTask(delay, onSourceClosure, bufferQueue);
scheduler.doEventLoop(&bufferQueue->blockingFlag);
scheduler.unscheduleDelayedTask(task);
if (waitboth) {
scheduler.doEventLoop(&rtpState->audioBufferQueue->blockingFlag);
scheduler.unscheduleDelayedTask(task2);
}
if (demuxer->stream->eof) {
free_demux_packet(dp);
return NULL;

View File

@ -157,7 +157,7 @@ static demuxer_t* demux_open_vqf(demuxer_t* demuxer) {
if(sid==mmioFOURCC('E','N','C','D')) demux_info_add(demuxer,"Encoder",sdata);
else
mp_msg(MSGT_DEMUX, MSGL_V, "Unhandled subchunk '%c%c%c%c'='%s'\n",((char *)&sid)[0],((char *)&sid)[1],((char *)&sid)[2],((char *)&sid)[3],sdata);
/* other stuff is unrecognized due untranslatable japan's idiomatics */
/* rest not recognized due to untranslatable Japanese expressions */
}
}
else
@ -229,7 +229,7 @@ const demuxer_desc_t demuxer_desc_vqf = {
"vqf",
"VQF",
"Nick Kurshev",
"ported frm MPlayerXP",
"ported from MPlayerXP",
DEMUXER_TYPE_VQF,
1, // safe autodetect
demux_probe_vqf,

View File

@ -377,7 +377,7 @@ struct demuxer *new_demuxers_demuxer(struct demuxer *vd, struct demuxer *ad,
struct demuxer *sd);
// AVI demuxer params:
extern int index_mode; // -1=untouched 0=don't use index 1=use (geneate) index
extern int index_mode; // -1=untouched 0=don't use index 1=use (generate) index
extern char *index_file_save, *index_file_load;
extern int force_ni;
extern int pts_from_bps;

View File

@ -62,6 +62,9 @@ void mp_gen_gamma_map(uint8_t *map, int size, float gamma) {
* not with e.g. MP_CSP_XYZ
*/
void mp_get_yuv2rgb_coeffs(struct mp_csp_params *params, float yuv2rgb[3][4]) {
float depth_multiplier = params->input_shift >= 0 ?
(1 << params->input_shift) :
(1.0 / (1 << -params->input_shift));
float uvcos = params->saturation * cos(params->hue);
float uvsin = params->saturation * sin(params->hue);
int format = params->format;
@ -128,6 +131,9 @@ void mp_get_yuv2rgb_coeffs(struct mp_csp_params *params, float yuv2rgb[3][4]) {
// this "centers" contrast control so that e.g. a contrast of 0
// leads to a grey image, not a black one
yuv2rgb[i][COL_C] += 0.5 - params->contrast / 2.0;
yuv2rgb[i][COL_Y] *= depth_multiplier;
yuv2rgb[i][COL_U] *= depth_multiplier;
yuv2rgb[i][COL_V] *= depth_multiplier;
}
}

View File

@ -53,6 +53,7 @@ struct mp_csp_params {
float rgamma;
float ggamma;
float bgamma;
int input_shift;
};
void mp_gen_gamma_map(unsigned char *map, int size, float gamma);

View File

@ -297,7 +297,9 @@ int glFindFormat(uint32_t fmt, int *bpp, GLint *gl_texfmt,
*gl_type = GL_UNSIGNED_BYTE;
break;
case IMGFMT_UYVY:
case IMGFMT_YUY2:
// IMGFMT_YUY2 would be more logical for the _REV format,
// but gives clearly swapped colors.
case IMGFMT_YVYU:
*gl_texfmt = GL_YCBCR_MESA;
*bpp = 16;
*gl_format = GL_YCBCR_MESA;

View File

@ -353,6 +353,20 @@ int loadGPUProgram(GLenum target, char *prog);
#define SET_YUV_CONVERSION(c) ((c) & YUV_CONVERSION_MASK)
#define SET_YUV_LUM_SCALER(s) (((s) & YUV_SCALER_MASK) << YUV_LUM_SCALER_SHIFT)
#define SET_YUV_CHROM_SCALER(s) (((s) & YUV_SCALER_MASK) << YUV_CHROM_SCALER_SHIFT)
//! returns whether the yuv conversion supports large brightness range etc.
static inline int glYUVLargeRange(int conv)
{
switch (conv)
{
case YUV_CONVERSION_NONE:
case YUV_CONVERSION_COMBINERS:
case YUV_CONVERSION_COMBINERS_ATI:
case YUV_CONVERSION_FRAGMENT_LOOKUP3D:
case YUV_CONVERSION_TEXT_FRAGMENT:
return 0;
}
return 1;
}
/** \} */
typedef struct {

View File

@ -438,7 +438,7 @@ static int mga_init(int width,int height,unsigned int format){
mp_msg(MSGT_VO,MSGL_V,"[MGA] Using %d buffers.\n",mga_vid_config.num_frames);
frames[0] = (char*)mmap(0,mga_vid_config.frame_size*mga_vid_config.num_frames,PROT_WRITE,MAP_SHARED,f,0);
frames[0] = mmap(0,mga_vid_config.frame_size*mga_vid_config.num_frames,PROT_WRITE,MAP_SHARED,f,0);
frames[1] = frames[0] + 1*mga_vid_config.frame_size;
frames[2] = frames[0] + 2*mga_vid_config.frame_size;
frames[3] = frames[0] + 3*mga_vid_config.frame_size;

View File

@ -979,8 +979,9 @@ static int draw_frame(uint8_t *src[])
* These values are then inverted again with
the texture filter D3DBLEND_INVSRCALPHA
*/
void vo_draw_alpha_l8a8(int w, int h, unsigned char* src, unsigned char *srca,
int srcstride, unsigned char* dstbase, int dststride)
static void vo_draw_alpha_l8a8(int w, int h, unsigned char* src,
unsigned char *srca, int srcstride,
unsigned char* dstbase, int dststride)
{
int y;
for (y = 0; y < h; y++) {

View File

@ -30,23 +30,10 @@
#include "video_out.h"
#include "video_out_internal.h"
#include "fastmemcpy.h"
#include "input/input.h"
#include "input/keycodes.h"
#include "mp_msg.h"
#include "aspect.h"
#include "geometry.h"
#include "mp_fifo.h"
#include "sub/sub.h"
#ifndef WM_XBUTTONDOWN
# define WM_XBUTTONDOWN 0x020B
# define WM_XBUTTONUP 0x020C
# define WM_XBUTTONDBLCLK 0x020D
#endif
#define WNDCLASSNAME_WINDOWED "MPlayer - The Movie Player"
#define WNDCLASSNAME_FULLSCREEN "MPlayer - Fullscreen"
#define WNDSTYLE WS_OVERLAPPEDWINDOW|WS_SIZEBOX
#include "w32_common.h"
static LPDIRECTDRAWCOLORCONTROL g_cc = NULL; //color control interface
static LPDIRECTDRAW7 g_lpdd = NULL; //DirectDraw Object
@ -58,14 +45,9 @@ static DDSURFACEDESC2 ddsdsf; //surface descripiton needed for
static HINSTANCE hddraw_dll; //handle to ddraw.dll
static RECT rd; //rect of our stretched image
static RECT rs; //rect of our source image
static HWND hWnd=NULL; //handle to the window
static HWND hWndFS=NULL; //fullscreen window
static HBRUSH colorbrush = NULL; // Handle to colorkey brush
static HBRUSH blackbrush = NULL; // Handle to black brush
static HICON mplayericon = NULL; // Handle to mplayer icon
static HCURSOR mplayercursor = NULL; // Handle to mplayer cursor
static uint32_t image_width, image_height; //image width and height
static uint32_t d_image_width, d_image_height; //image width and height zoomed
static uint8_t *image=NULL; //image data
static void* tmp_image = NULL;
static uint32_t image_format=0; //image format
@ -80,10 +62,6 @@ static COLORREF windowcolor = RGB(0,0,16); //windowcolor == colorkey
static int adapter_count=0;
static GUID selected_guid;
static GUID *selected_guid_ptr = NULL;
static RECT monitor_rect; //monitor coordinates
static float window_aspect;
static BOOL (WINAPI* myGetMonitorInfo)(HMONITOR, LPMONITORINFO) = NULL;
static RECT last_rect = {0xDEADC0DE, 0xDEADC0DE, 0xDEADC0DE, 0xDEADC0DE};
/*****************************************************************************
* DirectDraw GUIDs.
@ -348,19 +326,6 @@ static void uninit(void)
if (g_lpddsPrimary != NULL) g_lpddsPrimary->lpVtbl->Release(g_lpddsPrimary);
g_lpddsPrimary = NULL;
mp_msg(MSGT_VO, MSGL_DBG3,"<vo_directx><INFO>primary released\n");
if(hWndFS)DestroyWindow(hWndFS);
hWndFS = NULL;
if((WinID == -1) && hWnd) DestroyWindow(hWnd);
hWnd = NULL;
mp_msg(MSGT_VO, MSGL_DBG3,"<vo_directx><INFO>window destroyed\n");
UnregisterClass(WNDCLASSNAME_WINDOWED, GetModuleHandle(NULL));
UnregisterClass(WNDCLASSNAME_FULLSCREEN, GetModuleHandle(NULL));
if (mplayericon) DestroyIcon(mplayericon);
mplayericon = NULL;
if (mplayercursor) DestroyCursor(mplayercursor);
mplayercursor = NULL;
if (blackbrush) DeleteObject(blackbrush);
blackbrush = NULL;
if (colorbrush) DeleteObject(colorbrush);
colorbrush = NULL;
mp_msg(MSGT_VO, MSGL_DBG3,"<vo_directx><INFO>GDI resources deleted\n");
@ -373,23 +338,16 @@ static void uninit(void)
hddraw_dll= NULL;
mp_msg(MSGT_VO, MSGL_DBG3,"<vo_directx><INFO>ddraw.dll freed\n");
mp_msg(MSGT_VO, MSGL_DBG3,"<vo_directx><INFO>uninitialized\n");
vo_w32_uninit();
}
static BOOL WINAPI EnumCallbackEx(GUID FAR *lpGUID, LPSTR lpDriverDescription, LPSTR lpDriverName, LPVOID lpContext, HMONITOR hm)
{
mp_msg(MSGT_VO, MSGL_INFO ,"<vo_directx> adapter %d: ", adapter_count);
if (!lpGUID)
{
mp_msg(MSGT_VO, MSGL_INFO ,"%s", "Primary Display Adapter");
}
else
{
mp_msg(MSGT_VO, MSGL_INFO ,"%s", lpDriverDescription);
}
lpDriverDescription = "Primary Display Adapter";
mp_msg(MSGT_VO, MSGL_INFO ,"<vo_directx> adapter %d: %s", adapter_count, lpDriverDescription);
if(adapter_count == vo_adapter_num){
MONITORINFO mi;
if (!lpGUID)
selected_guid_ptr = NULL;
else
@ -397,11 +355,7 @@ static BOOL WINAPI EnumCallbackEx(GUID FAR *lpGUID, LPSTR lpDriverDescription, L
selected_guid = *lpGUID;
selected_guid_ptr = &selected_guid;
}
mi.cbSize = sizeof(mi);
if (myGetMonitorInfo(hm, &mi)) {
monitor_rect = mi.rcMonitor;
}
mp_msg(MSGT_VO, MSGL_INFO ,"\t\t<--");
}
mp_msg(MSGT_VO, MSGL_INFO ,"\n");
@ -416,16 +370,8 @@ static uint32_t Directx_InitDirectDraw(void)
HRESULT (WINAPI *OurDirectDrawCreateEx)(GUID *,LPVOID *, REFIID,IUnknown FAR *);
DDSURFACEDESC2 ddsd;
LPDIRECTDRAWENUMERATEEX OurDirectDrawEnumerateEx;
HINSTANCE user32dll=LoadLibrary("user32.dll");
adapter_count = 0;
if(user32dll){
myGetMonitorInfo=GetProcAddress(user32dll,"GetMonitorInfoA");
if(!myGetMonitorInfo && vo_adapter_num){
mp_msg(MSGT_VO, MSGL_ERR, "<vo_directx> -adapter is not supported on Win95\n");
vo_adapter_num = 0;
}
}
mp_msg(MSGT_VO, MSGL_DBG3,"<vo_directx><INFO>Initing DirectDraw\n" );
@ -437,8 +383,6 @@ static uint32_t Directx_InitDirectDraw(void)
return 1;
}
last_rect.left = 0xDEADC0DE; // reset window position cache
if(vo_adapter_num){ //display other than default
OurDirectDrawEnumerateEx = (LPDIRECTDRAWENUMERATEEX) GetProcAddress(hddraw_dll,"DirectDrawEnumerateExA");
if (!OurDirectDrawEnumerateEx){
@ -455,7 +399,6 @@ static uint32_t Directx_InitDirectDraw(void)
if(vo_adapter_num >= adapter_count)
mp_msg(MSGT_VO, MSGL_ERR,"Selected adapter (%d) doesn't exist: Default Display Adapter selected\n",vo_adapter_num);
}
FreeLibrary(user32dll);
OurDirectDrawCreateEx = (void *)GetProcAddress(hddraw_dll, "DirectDrawCreateEx");
if ( OurDirectDrawCreateEx == NULL )
@ -495,7 +438,7 @@ static uint32_t Directx_InitDirectDraw(void)
else vm_bpp=ddsd.ddpfPixelFormat.dwRGBBitCount;
if(vidmode){
if (g_lpdd->lpVtbl->SetCooperativeLevel(g_lpdd, hWnd, DDSCL_EXCLUSIVE|DDSCL_FULLSCREEN) != DD_OK)
if (g_lpdd->lpVtbl->SetCooperativeLevel(g_lpdd, vo_w32_window, DDSCL_EXCLUSIVE|DDSCL_FULLSCREEN) != DD_OK)
{
mp_msg(MSGT_VO, MSGL_FATAL,"<vo_directx><FATAL ERROR>can't set cooperativelevel for exclusive mode\n");
return 1;
@ -509,7 +452,7 @@ static uint32_t Directx_InitDirectDraw(void)
mp_msg(MSGT_VO, MSGL_V,"<vo_directx><INFO>Initialized adapter %i for %i x %i @ %i \n",vo_adapter_num,vm_width,vm_height,vm_bpp);
return 0;
}
if (g_lpdd->lpVtbl->SetCooperativeLevel(g_lpdd, hWnd, DDSCL_NORMAL) != DD_OK) // or DDSCL_SETFOCUSWINDOW
if (g_lpdd->lpVtbl->SetCooperativeLevel(g_lpdd, vo_w32_window, DDSCL_NORMAL) != DD_OK) // or DDSCL_SETFOCUSWINDOW
{
mp_msg(MSGT_VO, MSGL_FATAL,"<vo_directx><FATAL ERROR>could not set cooperativelevel for hardwarecheck\n");
return 1;
@ -518,16 +461,6 @@ static uint32_t Directx_InitDirectDraw(void)
return 0;
}
static void check_events(void)
{
MSG msg;
while (PeekMessage(&msg, NULL, 0, 0,PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
static uint32_t Directx_ManageDisplay(void)
{
HRESULT ddrval;
@ -536,66 +469,20 @@ static uint32_t Directx_ManageDisplay(void)
DWORD dwUpdateFlags=0;
int width,height;
if(!vidmode && !vo_fs && WinID!=-1) {
RECT current_rect = {0, 0, 0, 0};
GetWindowRect(hWnd, &current_rect);
if ((current_rect.left == last_rect.left)
&& (current_rect.top == last_rect.top)
&& (current_rect.right == last_rect.right)
&& (current_rect.bottom == last_rect.bottom))
return 0;
last_rect = current_rect;
}
rd.left = vo_dx - xinerama_x;
rd.top = vo_dy - xinerama_y;
width = vo_dwidth;
height = vo_dheight;
aspect(&width, &height, A_WINZOOM);
panscan_calc_windowed();
width += vo_panscan_x;
height += vo_panscan_y;
width = FFMIN(width, vo_screenwidth);
height = FFMIN(height, vo_screenheight);
rd.left += (vo_dwidth - width ) / 2;
rd.top += (vo_dheight - height) / 2;
if(vo_fs || vidmode){
aspect(&width,&height,A_ZOOM);
rd.left=(vo_screenwidth-width)/2;
rd.top=(vo_screenheight-height)/2;
if (WinID == -1)
if(ShowCursor(FALSE)>=0)while(ShowCursor(FALSE)>=0){}
}
else if (WinID != -1 && vo_geometry) {
POINT pt;
pt.x = vo_dx;
pt.y = vo_dy;
ClientToScreen(hWnd,&pt);
width=d_image_width;
height=d_image_height;
rd.left = pt.x;
rd.top = pt.y;
while(ShowCursor(TRUE)<=0){}
}
else {
POINT pt;
pt.x = 0; //overlayposition relative to the window
pt.y = 0;
ClientToScreen(hWnd,&pt);
GetClientRect(hWnd, &rd);
width=rd.right - rd.left;
height=rd.bottom - rd.top;
pt.x -= monitor_rect.left; /* move coordinates from global to local monitor space */
pt.y -= monitor_rect.top;
rd.right -= monitor_rect.left;
rd.bottom -= monitor_rect.top;
rd.left = pt.x;
rd.top = pt.y;
if(!nooverlay && (!width || !height)){
/*window is minimized*/
ddrval = g_lpddsOverlay->lpVtbl->UpdateOverlay(g_lpddsOverlay,NULL, g_lpddsPrimary, NULL, DDOVER_HIDE, NULL);
return 0;
}
if(vo_keepaspect){
int tmpheight=((float)width/window_aspect);
tmpheight+=tmpheight%2;
if(tmpheight > height){
width=((float)height*window_aspect);
width+=width%2;
}
else height=tmpheight;
}
if (WinID == -1)
while(ShowCursor(TRUE)<=0){}
}
rd.right=rd.left+width;
rd.bottom=rd.top+height;
@ -680,24 +567,9 @@ static uint32_t Directx_ManageDisplay(void)
}
else
{
g_lpddclipper->lpVtbl->SetHWnd(g_lpddclipper, 0,(vo_fs && !vidmode)?hWndFS: hWnd);
g_lpddclipper->lpVtbl->SetHWnd(g_lpddclipper, 0, vo_w32_window);
}
if(!vidmode && !vo_fs){
if(WinID == -1) {
RECT rdw=rd;
if (vo_border)
AdjustWindowRect(&rdw,WNDSTYLE,FALSE);
// printf("window: %i %i %ix%i\n",rdw.left,rdw.top,rdw.right - rdw.left,rdw.bottom - rdw.top);
rdw.left += monitor_rect.left; /* move to global coordinate space */
rdw.top += monitor_rect.top;
rdw.right += monitor_rect.left;
rdw.bottom += monitor_rect.top;
SetWindowPos(hWnd,(vo_ontop)?HWND_TOPMOST:(vo_rootwin?HWND_BOTTOM:HWND_NOTOPMOST),rdw.left,rdw.top,rdw.right-rdw.left,rdw.bottom-rdw.top,SWP_NOOWNERZORDER);
}
}
else SetWindowPos(vidmode?hWnd:hWndFS,vo_rootwin?HWND_BOTTOM:HWND_TOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_NOOWNERZORDER|SWP_NOCOPYBITS);
/*make sure the overlay is inside the screen*/
if(rd.left<0)rd.left=0;
if(rd.right>vo_screenwidth)rd.right=vo_screenwidth;
@ -757,6 +629,20 @@ static uint32_t Directx_ManageDisplay(void)
return 0;
}
static void check_events(void)
{
int evt = vo_w32_check_events();
if (evt & (VO_EVENT_RESIZE | VO_EVENT_MOVE))
Directx_ManageDisplay();
if (evt & (VO_EVENT_RESIZE | VO_EVENT_MOVE | VO_EVENT_EXPOSE)) {
HDC dc = vo_w32_get_dc(vo_w32_window);
RECT r;
GetClientRect(vo_w32_window, &r);
FillRect(dc, &r, vo_fs || vidmode ? blackbrush : colorbrush);
vo_w32_release_dc(vo_w32_window, dc);
}
}
//find out supported overlay pixelformats
static uint32_t Directx_CheckOverlayPixelformats(void)
{
@ -887,172 +773,8 @@ static uint32_t Directx_CheckPrimaryPixelformat(void)
return 0;
}
//function handles input
static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_MOUSEACTIVATE:
return MA_ACTIVATEANDEAT;
case WM_NCACTIVATE:
{
if(vidmode && adapter_count > 2) //only disable if more than one adapter.
return 0;
break;
}
case WM_DESTROY:
{
PostQuitMessage(0);
return 0;
}
case WM_CLOSE:
{
mplayer_put_key(KEY_CLOSE_WIN);
return 0;
}
case WM_WINDOWPOSCHANGED:
{
//printf("Windowposchange\n");
if(g_lpddsBack != NULL) //or it will crash with -vm
{
Directx_ManageDisplay();
}
break;
}
case WM_SYSCOMMAND:
{
switch (wParam)
{ //kill screensaver etc.
//note: works only when the window is active
//you can workaround this by disabling the allow screensaver option in
//the link to the app
case SC_SCREENSAVE:
case SC_MONITORPOWER:
mp_msg(MSGT_VO, MSGL_V ,"<vo_directx><INFO>killing screensaver\n" );
return 0;
case SC_MAXIMIZE:
if (!vo_fs) control(VOCTRL_FULLSCREEN, NULL);
return 0;
}
break;
}
case WM_KEYDOWN:
{
switch (wParam)
{
case VK_LEFT:
{mplayer_put_key(KEY_LEFT);break;}
case VK_UP:
{mplayer_put_key(KEY_UP);break;}
case VK_RIGHT:
{mplayer_put_key(KEY_RIGHT);break;}
case VK_DOWN:
{mplayer_put_key(KEY_DOWN);break;}
case VK_TAB:
{mplayer_put_key(KEY_TAB);break;}
case VK_BACK:
{mplayer_put_key(KEY_BS);break;}
case VK_DELETE:
{mplayer_put_key(KEY_DELETE);break;}
case VK_INSERT:
{mplayer_put_key(KEY_INSERT);break;}
case VK_HOME:
{mplayer_put_key(KEY_HOME);break;}
case VK_END:
{mplayer_put_key(KEY_END);break;}
case VK_PRIOR:
{mplayer_put_key(KEY_PAGE_UP);break;}
case VK_NEXT:
{mplayer_put_key(KEY_PAGE_DOWN);break;}
case VK_ESCAPE:
{mplayer_put_key(KEY_ESC);break;}
}
break;
}
case WM_CHAR:
{
mplayer_put_key(wParam);
break;
}
case WM_LBUTTONDOWN:
{
if (!vo_nomouse_input)
mplayer_put_key(MOUSE_BTN0);
break;
}
case WM_MBUTTONDOWN:
{
if (!vo_nomouse_input)
mplayer_put_key(MOUSE_BTN1);
break;
}
case WM_RBUTTONDOWN:
{
if (!vo_nomouse_input)
mplayer_put_key(MOUSE_BTN2);
break;
}
case WM_LBUTTONDBLCLK:
{
if(!vo_nomouse_input)
mplayer_put_key(MOUSE_BTN0_DBL);
break;
}
case WM_MBUTTONDBLCLK:
{
if(!vo_nomouse_input)
mplayer_put_key(MOUSE_BTN1_DBL);
break;
}
case WM_RBUTTONDBLCLK:
{
if(!vo_nomouse_input)
mplayer_put_key(MOUSE_BTN2_DBL);
break;
}
case WM_MOUSEWHEEL:
{
int x;
if (vo_nomouse_input)
break;
x = GET_WHEEL_DELTA_WPARAM(wParam);
if (x > 0)
mplayer_put_key(MOUSE_BTN3);
else
mplayer_put_key(MOUSE_BTN4);
break;
}
case WM_XBUTTONDOWN:
{
if (vo_nomouse_input)
break;
if (HIWORD(wParam) == 1)
mplayer_put_key(MOUSE_BTN5);
else
mplayer_put_key(MOUSE_BTN6);
break;
}
case WM_XBUTTONDBLCLK:
{
if (vo_nomouse_input)
break;
if (HIWORD(wParam) == 1)
mplayer_put_key(MOUSE_BTN5_DBL);
else
mplayer_put_key(MOUSE_BTN6_DBL);
break;
}
}
return DefWindowProc(hWnd, message, wParam, lParam);
}
static int preinit(const char *arg)
{
HINSTANCE hInstance = GetModuleHandle(NULL);
char exedir[MAX_PATH];
WNDCLASS wc;
if(arg)
{
if(strstr(arg,"noaccel"))
@ -1061,44 +783,17 @@ static int preinit(const char *arg)
nooverlay = 1;
}
}
/*load icon from the main app*/
if(GetModuleFileName(NULL,exedir,MAX_PATH))
{
mplayericon = ExtractIcon( hInstance, exedir, 0 );
}
if(!mplayericon)mplayericon=LoadIcon(NULL,IDI_APPLICATION);
mplayercursor = LoadCursor(NULL, IDC_ARROW);
monitor_rect.right=GetSystemMetrics(SM_CXSCREEN);
monitor_rect.bottom=GetSystemMetrics(SM_CYSCREEN);
windowcolor = vo_colorkey;
colorbrush = CreateSolidBrush(windowcolor);
blackbrush = (HBRUSH)GetStockObject(BLACK_BRUSH);
wc.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
wc.lpfnWndProc = WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hCursor = mplayercursor;
wc.hIcon = mplayericon;
wc.hbrBackground = vidmode ? blackbrush : colorbrush;
wc.lpszClassName = WNDCLASSNAME_WINDOWED;
wc.lpszMenuName = NULL;
RegisterClass(&wc);
if (WinID != -1) hWnd = WinID;
else
hWnd = CreateWindowEx(vidmode?WS_EX_TOPMOST:0,
WNDCLASSNAME_WINDOWED,"",(vidmode || !vo_border)?WS_POPUP:WNDSTYLE,
CW_USEDEFAULT, CW_USEDEFAULT, 100, 100,NULL,NULL,hInstance,NULL);
wc.hbrBackground = blackbrush;
wc.lpszClassName = WNDCLASSNAME_FULLSCREEN;
RegisterClass(&wc);
if (!vo_w32_init())
return 1;
if (!vo_w32_config(100, 100, VOFLAG_HIDDEN))
return 1;
if (Directx_InitDirectDraw()!= 0)return 1; //init DirectDraw
if(!vidmode)hWndFS = CreateWindow(WNDCLASSNAME_FULLSCREEN,"MPlayer Fullscreen",WS_POPUP,monitor_rect.left,monitor_rect.top,monitor_rect.right-monitor_rect.left,monitor_rect.bottom-monitor_rect.top,hWnd,NULL,hInstance,NULL);
mp_msg(MSGT_VO, MSGL_DBG3 ,"<vo_directx><INFO>initial mplayer windows created\n");
if (Directx_CheckPrimaryPixelformat()!=0)return 1;
if (!nooverlay && Directx_CheckOverlayPixelformats() == 0) //check for supported hardware
{
@ -1239,8 +934,6 @@ static uint32_t put_image(mp_image_t *mpi){
uint32_t w = mpi->w;
uint32_t h = mpi->h;
if (WinID != -1) Directx_ManageDisplay();
if((mpi->flags&MP_IMGFLAG_DIRECT)||(mpi->flags&MP_IMGFLAG_DRAW_CALLBACK))
{
mp_msg(MSGT_VO, MSGL_DBG3 ,"<vo_directx><INFO>put_image: nothing to do: drawslices\n");
@ -1278,15 +971,10 @@ static uint32_t put_image(mp_image_t *mpi){
static int
config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t options, char *title, uint32_t format)
{
RECT rd;
vo_fs = options & 0x01;
image_format = format;
image_width = width;
image_height = height;
d_image_width = d_width;
d_image_height = d_height;
if(format != primary_image_format)nooverlay = 0;
window_aspect= (float)d_image_width / (float)d_image_height;
/*release all directx objects*/
if (g_cc != NULL)g_cc->lpVtbl->Release(g_cc);
@ -1302,32 +990,11 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin
g_lpddsPrimary = NULL;
mp_msg(MSGT_VO, MSGL_DBG3,"<vo_directx><INFO>overlay surfaces released\n");
if(!vidmode){
if(!vo_geometry){
GetWindowRect(hWnd,&rd);
vo_dx=rd.left;
vo_dy=rd.top;
}
vo_dx += monitor_rect.left; /* move position to global window space */
vo_dy += monitor_rect.top;
rd.left = vo_dx;
rd.top = vo_dy;
rd.right = rd.left + d_image_width;
rd.bottom = rd.top + d_image_height;
if (WinID == -1) {
if (vo_border)
AdjustWindowRect(&rd,WNDSTYLE,FALSE);
SetWindowPos(hWnd,NULL, vo_dx, vo_dy,rd.right-rd.left,rd.bottom-rd.top,SWP_SHOWWINDOW|SWP_NOOWNERZORDER);
}
}
else ShowWindow(hWnd,SW_SHOW);
if (!vo_w32_config(d_width, d_height, options))
return 1;
if(vo_fs && !vidmode)ShowWindow(hWndFS,SW_SHOW);
if (WinID == -1)
SetWindowText(hWnd,title);
if(vidmode)vo_fs=0;
SetWindowText(vo_w32_window,title);
/*create the surfaces*/
@ -1336,13 +1003,13 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin
//create palette for 256 color mode
if(image_format==IMGFMT_BGR8){
LPDIRECTDRAWPALETTE ddpalette=NULL;
char* palette=malloc(4*256);
LPPALETTEENTRY palette=calloc(256, sizeof(*palette));
int i;
for(i=0; i<256; i++){
palette[4*i+0] = ((i >> 5) & 0x07) * 255 / 7;
palette[4*i+1] = ((i >> 2) & 0x07) * 255 / 7;
palette[4*i+2] = ((i >> 0) & 0x03) * 255 / 3;
palette[4*i+3] = PC_NOCOLLAPSE;
palette[i].peRed = ((i >> 5) & 0x07) * 255 / 7;
palette[i].peGreen = ((i >> 2) & 0x07) * 255 / 7;
palette[i].peBlue = ((i >> 0) & 0x03) * 255 / 3;
palette[i].peFlags = PC_NOCOLLAPSE;
}
g_lpdd->lpVtbl->CreatePalette(g_lpdd,DDPCAPS_8BIT|DDPCAPS_INITIALIZE,palette,&ddpalette,NULL);
g_lpddsPrimary->lpVtbl->SetPalette(g_lpddsPrimary,ddpalette);
@ -1369,7 +1036,7 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin
vo_doublebuffering = 0;
/*create clipper for nonoverlay mode*/
if(g_lpdd->lpVtbl->CreateClipper(g_lpdd, 0, &g_lpddclipper,NULL)!= DD_OK){mp_msg(MSGT_VO, MSGL_FATAL,"<vo_directx><FATAL ERROR>can't create clipper\n");return 1;}
if(g_lpddclipper->lpVtbl->SetHWnd (g_lpddclipper, 0, hWnd)!= DD_OK){mp_msg(MSGT_VO, MSGL_FATAL,"<vo_directx><FATAL ERROR>can't associate clipper with window\n");return 1;}
if(g_lpddclipper->lpVtbl->SetHWnd (g_lpddclipper, 0, vo_w32_window)!= DD_OK){mp_msg(MSGT_VO, MSGL_FATAL,"<vo_directx><FATAL ERROR>can't associate clipper with window\n");return 1;}
if(g_lpddsPrimary->lpVtbl->SetClipper (g_lpddsPrimary,g_lpddclipper)!=DD_OK){mp_msg(MSGT_VO, MSGL_FATAL,"<vo_directx><FATAL ERROR>can't associate primary surface with clipper\n");return 1;}
mp_msg(MSGT_VO, MSGL_DBG3,"<vo_directx><INFO>clipper succesfully created\n");
}else{
@ -1393,7 +1060,7 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin
// contrast [0, 20000]
// hue [-180, 180]
// saturation [0, 20000]
static uint32_t color_ctrl_set(char *what, int value)
static uint32_t color_ctrl_set(const char *what, int value)
{
uint32_t r = VO_NOTIMPL;
DDCOLORCONTROL dcc;
@ -1430,7 +1097,7 @@ static uint32_t color_ctrl_set(char *what, int value)
}
//analoguous to color_ctrl_set
static uint32_t color_ctrl_get(char *what, int *value)
static uint32_t color_ctrl_get(const char *what, int *value)
{
uint32_t r = VO_NOTIMPL;
DDCOLORCONTROL dcc;
@ -1470,48 +1137,15 @@ static int control(uint32_t request, void *data)
case VOCTRL_GET_IMAGE:
return get_image(data);
case VOCTRL_QUERY_FORMAT:
last_rect.left = 0xDEADC0DE; // reset window position cache
return query_format(*((uint32_t*)data));
case VOCTRL_DRAW_IMAGE:
return put_image(data);
case VOCTRL_BORDER:
if(WinID != -1) return VO_TRUE;
if(vidmode)
{
mp_msg(MSGT_VO, MSGL_ERR,"<vo_directx><ERROR>border has no meaning in exclusive mode\n");
}
else
{
if(vo_border) {
vo_border = 0;
SetWindowLong(hWnd, GWL_STYLE, WS_POPUP);
} else {
vo_border = 1;
SetWindowLong(hWnd, GWL_STYLE, WNDSTYLE);
}
// needed AFAICT to force the window to
// redisplay with the new style. --Joey
if (!vo_fs) {
ShowWindow(hWnd,SW_HIDE);
ShowWindow(hWnd,SW_SHOW);
}
last_rect.left = 0xDEADC0DE; // reset window position cache
Directx_ManageDisplay();
}
vo_w32_border();
Directx_ManageDisplay();
return VO_TRUE;
case VOCTRL_ONTOP:
if(WinID != -1) return VO_TRUE;
if(vidmode)
{
mp_msg(MSGT_VO, MSGL_ERR,"<vo_directx><ERROR>ontop has no meaning in exclusive mode\n");
}
else
{
if(vo_ontop) vo_ontop = 0;
else vo_ontop = 1;
last_rect.left = 0xDEADC0DE; // reset window position cache
Directx_ManageDisplay();
}
vo_w32_ontop();
return VO_TRUE;
case VOCTRL_ROOTWIN:
if(WinID != -1) return VO_TRUE;
@ -1523,35 +1157,13 @@ static int control(uint32_t request, void *data)
{
if(vo_rootwin) vo_rootwin = 0;
else vo_rootwin = 1;
last_rect.left = 0xDEADC0DE; // reset window position cache
Directx_ManageDisplay();
}
return VO_TRUE;
case VOCTRL_FULLSCREEN:
{
if(vidmode)
{
mp_msg(MSGT_VO, MSGL_ERR,"<vo_directx><ERROR>currently we do not allow to switch from exclusive to windowed mode\n");
}
else
{
if(!vo_fs)
{
vo_fs=1;
ShowWindow(hWndFS,SW_SHOW);
ShowWindow(hWnd,SW_HIDE);
SetForegroundWindow(hWndFS);
}
else
{
vo_fs=0;
ShowWindow(hWndFS,SW_HIDE);
ShowWindow(hWnd,SW_SHOW);
}
last_rect.left = 0xDEADC0DE; // reset window position cache
Directx_ManageDisplay();
break;
}
vo_w32_fullscreen();
Directx_ManageDisplay();
return VO_TRUE;
}
case VOCTRL_SET_EQUALIZER: {
@ -1563,18 +1175,8 @@ static int control(uint32_t request, void *data)
return color_ctrl_get(args->name, args->valueptr);
}
case VOCTRL_UPDATE_SCREENINFO:
if (vidmode) {
vo_screenwidth = vm_width;
vo_screenheight = vm_height;
} else {
vo_screenwidth = monitor_rect.right - monitor_rect.left;
vo_screenheight = monitor_rect.bottom - monitor_rect.top;
}
aspect_save_screenres(vo_screenwidth, vo_screenheight);
w32_update_xinerama_info();
return VO_TRUE;
case VOCTRL_RESET:
last_rect.left = 0xDEADC0DE; // reset window position cache
// fall-through intended
};
return VO_NOTIMPL;
}

View File

@ -247,7 +247,7 @@ static void texSize(int w, int h, int *texw, int *texh) {
//! maximum size of custom fragment program
#define MAX_CUSTOM_PROG_SIZE (1024 * 1024)
static void update_yuvconv(void) {
int xs, ys;
int xs, ys, depth;
float bri = eq_bri / 100.0;
float cont = (eq_cont + 100) / 100.0;
float hue = eq_hue / 100.0 * 3.1415927;
@ -256,11 +256,12 @@ static void update_yuvconv(void) {
float ggamma = exp(log(8.0) * eq_ggamma / 100.0);
float bgamma = exp(log(8.0) * eq_bgamma / 100.0);
gl_conversion_params_t params = {gl_target, yuvconvtype,
{colorspace, levelconv, bri, cont, hue, sat, rgamma, ggamma, bgamma},
{colorspace, levelconv, bri, cont, hue, sat, rgamma, ggamma, bgamma, 0},
texture_width, texture_height, 0, 0, filter_strength};
mp_get_chroma_shift(image_format, &xs, &ys, NULL);
mp_get_chroma_shift(image_format, &xs, &ys, &depth);
params.chrom_texw = params.texw >> xs;
params.chrom_texh = params.texh >> ys;
params.csp_params.input_shift = -depth & 7;
glSetupYUVConversion(&params);
if (custom_prog) {
FILE *f = fopen(custom_prog, "rb");
@ -566,9 +567,11 @@ static int initGl(uint32_t d_width, uint32_t d_height) {
if (is_yuv) {
int i;
int xs, ys;
int xs, ys, depth;
int chroma_clear_val = 128;
scale_type = get_scale_type(1);
mp_get_chroma_shift(image_format, &xs, &ys, NULL);
mp_get_chroma_shift(image_format, &xs, &ys, &depth);
chroma_clear_val >>= -depth & 7;
mpglGenTextures(21, default_texs);
default_texs[21] = 0;
for (i = 0; i < 7; i++) {
@ -579,12 +582,14 @@ static int initGl(uint32_t d_width, uint32_t d_height) {
}
mpglActiveTexture(GL_TEXTURE1);
glCreateClearTex(gl_target, gl_texfmt, gl_format, gl_type, scale_type,
texture_width >> xs, texture_height >> ys, 128);
texture_width >> xs, texture_height >> ys,
chroma_clear_val);
if (mipmap_gen)
mpglTexParameteri(gl_target, GL_GENERATE_MIPMAP, GL_TRUE);
mpglActiveTexture(GL_TEXTURE2);
glCreateClearTex(gl_target, gl_texfmt, gl_format, gl_type, scale_type,
texture_width >> xs, texture_height >> ys, 128);
texture_width >> xs, texture_height >> ys,
chroma_clear_val);
if (mipmap_gen)
mpglTexParameteri(gl_target, GL_GENERATE_MIPMAP, GL_TRUE);
mpglActiveTexture(GL_TEXTURE0);
@ -1097,14 +1102,14 @@ query_format(uint32_t format)
if (format == IMGFMT_RGB24 || format == IMGFMT_RGBA)
return caps;
if (use_yuv && mp_get_chroma_shift(format, NULL, NULL, &depth) &&
(depth == 8 || depth == 16) &&
(depth == 8 || depth == 16 || glYUVLargeRange(use_yuv)) &&
(IMGFMT_IS_YUVP16_NE(format) || !IMGFMT_IS_YUVP16(format)))
return caps;
// HACK, otherwise we get only b&w with some filters (e.g. -vf eq)
// ideally MPlayer should be fixed instead not to use Y800 when it has the choice
if (!use_yuv && (format == IMGFMT_Y8 || format == IMGFMT_Y800))
return 0;
if (!use_ycbcr && (format == IMGFMT_UYVY || format == IMGFMT_YUY2))
if (!use_ycbcr && (format == IMGFMT_UYVY || format == IMGFMT_YVYU))
return 0;
if (many_fmts &&
glFindFormat(format, NULL, NULL, NULL, NULL))

View File

@ -273,14 +273,18 @@ static int initTextures(void)
glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
if (is_yuv) {
int xs, ys;
mp_get_chroma_shift(image_format, &xs, &ys, NULL);
int xs, ys, depth;
int chroma_clear_val = 128;
mp_get_chroma_shift(image_format, &xs, &ys, &depth);
chroma_clear_val >>= -depth & 7;
mpglActiveTexture(GL_TEXTURE1);
glCreateClearTex(GL_TEXTURE_2D, gl_internal_format, gl_bitmap_format, gl_bitmap_type, GL_LINEAR,
texture_width >> xs, texture_height >> ys, 128);
texture_width >> xs, texture_height >> ys,
chroma_clear_val);
mpglActiveTexture(GL_TEXTURE2);
glCreateClearTex(GL_TEXTURE_2D, gl_internal_format, gl_bitmap_format, gl_bitmap_type, GL_LINEAR,
texture_width >> xs, texture_height >> ys, 128);
texture_width >> xs, texture_height >> ys,
chroma_clear_val);
mpglActiveTexture(GL_TEXTURE0);
}
@ -559,7 +563,7 @@ static int initGl(uint32_t d_width, uint32_t d_height)
glDisable(GL_CULL_FACE);
glEnable (GL_TEXTURE_2D);
if (is_yuv) {
int xs, ys;
int xs, ys, depth;
gl_conversion_params_t params = {GL_TEXTURE_2D, use_yuv,
{-1, -1, 0.0, 1.0, 0.0, 1.0, 1.0, 1.0, 1.0},
texture_width, texture_height, 0, 0, 0};
@ -580,9 +584,10 @@ static int initGl(uint32_t d_width, uint32_t d_height)
mpglBindProgram(GL_FRAGMENT_PROGRAM, fragprog);
break;
}
mp_get_chroma_shift(image_format, &xs, &ys, NULL);
mp_get_chroma_shift(image_format, &xs, &ys, &depth);
params.chrom_texw = params.texw >> xs;
params.chrom_texh = params.texh >> ys;
params.csp_params.input_shift = -depth & 7;
glSetupYUVConversion(&params);
}
@ -804,7 +809,7 @@ query_format(uint32_t format)
{
int depth;
if (use_yuv && mp_get_chroma_shift(format, NULL, NULL, &depth) &&
(depth == 8 || depth == 16) &&
(depth == 8 || depth == 16 || glYUVLargeRange(use_yuv)) &&
(IMGFMT_IS_YUVP16_NE(format) || !IMGFMT_IS_YUVP16(format)))
return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_OSD |
VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN | VFCAP_ACCEPT_STRIDE;

View File

@ -104,7 +104,7 @@ static int framenum = 0;
* returns, everything went well.
*/
static void jpeg_mkdir(char *buf, int verbose) {
static void jpeg_mkdir(const char *buf, int verbose) {
struct stat stat_p;
#ifndef __MINGW32__
@ -176,7 +176,7 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width,
/* ------------------------------------------------------------------------- */
static uint32_t jpeg_write(uint8_t * name, uint8_t * buffer)
static uint32_t jpeg_write(const char * name, uint8_t * buffer)
{
FILE *outfile;
struct jpeg_compress_struct cinfo;

View File

@ -232,7 +232,7 @@ static void
uninit(void)
{
if(ao_mpegpes_fd >= 0 && ao_mpegpes_fd != vo_mpegpes_fd) close(ao_mpegpes_fd);
ao_mpegpes_fd =- 1;
ao_mpegpes_fd = -1;
if(vo_mpegpes_fd>=0){ close(vo_mpegpes_fd);vo_mpegpes_fd=-1;}
}

View File

@ -252,11 +252,12 @@ static int config(struct vo *vo, uint32_t width, uint32_t height,
depth = 24;
XMatchVisualInfo(x11->display, x11->screen, depth, TrueColor, &vinfo);
xswa.background_pixel = 0;
if (x11->xv_ck_info.method == CK_METHOD_BACKGROUND)
xswa.background_pixel = x11->xv_colorkey;
xswa.border_pixel = 0;
xswamask = CWBackPixel | CWBorderPixel;
xswamask = CWBorderPixel;
if (x11->xv_ck_info.method == CK_METHOD_BACKGROUND) {
xswa.background_pixel = x11->xv_colorkey;
xswamask |= CWBackPixel;
}
vo_x11_create_vo_window(vo, &vinfo, vo->dx, vo->dy, vo->dwidth,
vo->dheight, flags, CopyFromParent, "xv",

View File

@ -101,6 +101,7 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM l
event_flags |= VO_EVENT_EXPOSE;
break;
case WM_MOVE:
event_flags |= VO_EVENT_MOVE;
p.x = 0;
p.y = 0;
ClientToScreen(vo_window, &p);
@ -219,11 +220,18 @@ int vo_w32_check_events(void) {
if (WinID >= 0) {
BOOL res;
RECT r;
POINT p;
res = GetClientRect(vo_window, &r);
if (res && (r.right != vo_dwidth || r.bottom != vo_dheight)) {
vo_dwidth = r.right; vo_dheight = r.bottom;
event_flags |= VO_EVENT_RESIZE;
}
p.x = 0; p.y = 0;
ClientToScreen(vo_window, &p);
if (p.x != vo_dx || p.y != vo_dy) {
vo_dx = p.x; vo_dy = p.y;
event_flags |= VO_EVENT_MOVE;
}
res = GetClientRect(WinID, &r);
if (res && (r.right != vo_dwidth || r.bottom != vo_dheight))
MoveWindow(vo_window, 0, 0, r.right, r.bottom, FALSE);

View File

@ -19,6 +19,7 @@
#ifndef MPLAYER_WSKEYS_H
#define MPLAYER_WSKEYS_H
#define wsPause 0x13 + 256
#define wsUp 0x52 + 256
#define wsDown 0x54 + 256
#define wsLeft 0x51 + 256

View File

@ -550,7 +550,8 @@ static void vo_x11_putkey_ext(struct vo *vo, int keysym, int modifiers)
static const struct mp_keymap keymap[] = {
// special keys
{wsEscape, KEY_ESC}, {wsBackSpace, KEY_BS}, {wsTab, KEY_TAB}, {wsEnter, KEY_ENTER},
{wsPause, KEY_PAUSE}, {wsEscape, KEY_ESC}, {wsBackSpace, KEY_BS},
{wsTab, KEY_TAB}, {wsEnter, KEY_ENTER},
// cursor keys
{wsLeft, KEY_LEFT}, {wsRight, KEY_RIGHT}, {wsUp, KEY_UP}, {wsDown, KEY_DOWN},
@ -732,7 +733,6 @@ void vo_x11_uninit(struct vo *vo)
{
if (x11->vo_gc != None)
{
XSetBackground(vo->x11->display, x11->vo_gc, 0);
XFreeGC(vo->x11->display, x11->vo_gc);
x11->vo_gc = None;
}
@ -1050,7 +1050,6 @@ void vo_x11_create_vo_window(struct vo *vo, XVisualInfo *vis, int x, int y,
struct MPOpts *opts = vo->opts;
struct vo_x11_state *x11 = vo->x11;
Display *mDisplay = vo->x11->display;
XGCValues xgcv;
if (WinID >= 0) {
vo_fs = flags & VOFLAG_FULLSCREEN;
x11->window = WinID ? (Window)WinID : x11->rootwin;
@ -1121,7 +1120,8 @@ void vo_x11_create_vo_window(struct vo *vo, XVisualInfo *vis, int x, int y,
final:
if (x11->vo_gc != None)
XFreeGC(mDisplay, x11->vo_gc);
x11->vo_gc = XCreateGC(mDisplay, x11->window, GCForeground, &xgcv);
x11->vo_gc = XCreateGC(mDisplay, x11->window, 0, NULL);
XSync(mDisplay, False);
x11->vo_mouse_autohide = 1;
vo->event_fd = ConnectionNumber(x11->display);

View File

@ -8,17 +8,17 @@
*
*/
// define for quicktime calls debugging and/or MacOS-level emulation:
#ifndef __APPLE__
#define EMU_QTX_API
#endif /* __APPLE__ */
// define for quicktime debugging (verbose logging):
//#define DEBUG_QTX_API
#include "config.h"
#include "debug.h"
// define for quicktime calls debugging and/or MacOS-level emulation:
#if !defined(__APPLE__) && defined(CONFIG_QTX_CODECS)
#define EMU_QTX_API
#endif /* __APPLE__ */
#include <assert.h>
#include <errno.h>
#include <fcntl.h>

View File

@ -1164,6 +1164,7 @@ static struct {
{"411p", IMGFMT_411P},
{"440p", IMGFMT_440P},
{"yuy2", IMGFMT_YUY2},
{"yvyu", IMGFMT_YVYU},
{"uyvy", IMGFMT_UYVY},
{"yvu9", IMGFMT_YVU9},
{"if09", IMGFMT_IF09},

View File

@ -1130,6 +1130,7 @@ void add_subtitles(struct MPContext *mpctx, char *filename, float fps, int noerr
void init_vo_spudec(struct MPContext *mpctx)
{
unsigned width, height;
spudec_free(vo_spudec);
mpctx->initialized_flags &= ~INITIALIZED_SPUDEC;
vo_spudec = NULL;
@ -1139,17 +1140,20 @@ void init_vo_spudec(struct MPContext *mpctx)
return;
if (spudec_ifo) {
unsigned int palette[16], width, height;
unsigned int palette[16];
current_module="spudec_init_vobsub";
if (vobsub_parse_ifo(NULL,spudec_ifo, palette, &width, &height, 1, -1, NULL) >= 0)
vo_spudec=spudec_new_scaled(palette, width, height, NULL, 0);
}
width = mpctx->sh_video->disp_w;
height = mpctx->sh_video->disp_h;
#ifdef CONFIG_DVDREAD
if (vo_spudec==NULL && mpctx->stream->type==STREAMTYPE_DVD) {
current_module="spudec_init_dvdread";
vo_spudec=spudec_new_scaled(((dvd_priv_t *)(mpctx->stream->priv))->cur_pgc->palette,
mpctx->sh_video->disp_w, mpctx->sh_video->disp_h,
width, height,
NULL, 0);
}
#endif
@ -1158,14 +1162,14 @@ void init_vo_spudec(struct MPContext *mpctx)
if (vo_spudec==NULL && mpctx->stream->type==STREAMTYPE_DVDNAV) {
unsigned int *palette = mp_dvdnav_get_spu_clut(mpctx->stream);
current_module="spudec_init_dvdnav";
vo_spudec=spudec_new_scaled(palette, mpctx->sh_video->disp_w, mpctx->sh_video->disp_h, NULL, 0);
vo_spudec=spudec_new_scaled(palette, width, height, NULL, 0);
}
#endif
if (vo_spudec==NULL) {
sh_sub_t *sh = mpctx->d_sub->sh;
current_module="spudec_init_normal";
vo_spudec=spudec_new_scaled(NULL, mpctx->sh_video->disp_w, mpctx->sh_video->disp_h, sh->extradata, sh->extradata_len);
vo_spudec=spudec_new_scaled(NULL, width, height, sh->extradata, sh->extradata_len);
spudec_set_font_factor(vo_spudec,font_factor);
}
@ -1338,6 +1342,50 @@ static void print_status(struct MPContext *mpctx, double a_pos, bool at_frame)
free(line);
}
struct stream_dump_progress {
uint64_t count;
unsigned start_time;
unsigned last_print_time;
};
static void stream_dump_progress_start(struct stream_dump_progress *p)
{
p->start_time = p->last_print_time = GetTimerMS();
p->count = 0;
}
static void stream_dump_progress(struct stream_dump_progress *p,
uint64_t len, stream_t *stream)
{
p->count += len;
unsigned t = GetTimerMS();
if (t - p->last_print_time < 1000)
return;
uint64_t start = stream->start_pos;
uint64_t end = stream->end_pos;
uint64_t pos = stream->pos;
p->last_print_time = t;
/* TODO: pretty print sizes; ETA */
if (end > start && pos >= start && pos <= end) {
mp_tmsg(MSGT_STATUSLINE, MSGL_STATUS,
"dump: %"PRIu64" bytes written (~%.1f%%)",
p->count, 100.0 * (pos - start) / (end - start));
mp_msg(MSGT_STATUSLINE, MSGL_STATUS, "\r");
} else {
mp_tmsg(MSGT_STATUSLINE, MSGL_STATUS,
"dump: %"PRIu64" bytes written", p->count);
mp_msg(MSGT_STATUSLINE, MSGL_STATUS, "\r");
}
}
static void stream_dump_progress_end(struct stream_dump_progress *p, char *name)
{
mp_msg(MSGT_CPLAYER, MSGL_INFO, "dump: %"PRIu64" bytes written to '%s'.\n",
p->count, name);
}
/**
* \brief build a chain of audio filters that converts the input format
* to the ao's format, taking into account the current playback_speed.
@ -2228,7 +2276,7 @@ static mp_image_t *mp_dvdnav_restore_smpi(struct MPContext *mpctx,
if (mpctx->stream->type != STREAMTYPE_DVDNAV)
return decoded_frame;
/// a change occured in dvdnav stream
/// a change occurred in dvdnav stream
if (mp_dvdnav_cell_has_changed(mpctx->stream,0)) {
mp_dvdnav_read_wait(mpctx->stream, 1, 1);
mp_dvdnav_context_free(mpctx);
@ -2273,12 +2321,16 @@ static void mp_dvdnav_save_smpi(struct MPContext *mpctx, int in_size,
return;
free(mpctx->nav_buffer);
mpctx->nav_buffer = NULL;
mpctx->nav_start = NULL;
mpctx->nav_in_size = -1;
mpctx->nav_buffer = malloc(in_size);
mpctx->nav_start = start;
mpctx->nav_in_size = mpctx->nav_buffer ? in_size : -1;
if (mpctx->nav_buffer)
if (in_size > 0)
mpctx->nav_buffer = malloc(in_size);
if (mpctx->nav_buffer) {
mpctx->nav_start = start;
memcpy(mpctx->nav_buffer,start,in_size);
}
if (decoded_frame && mpctx->nav_smpi != decoded_frame)
mpctx->nav_smpi = mp_dvdnav_copy_mpi(mpctx->nav_smpi,decoded_frame);
@ -4284,6 +4336,8 @@ if(stream_dump_type==5){
int chapter = opts->chapterrange[0] - 1;
stream_control(mpctx->stream, STREAM_CTRL_SEEK_TO_CHAPTER, &chapter);
}
struct stream_dump_progress info;
stream_dump_progress_start(&info);
while(!mpctx->stream->eof && !async_quit_request){
len=stream_read(mpctx->stream,buf,4096);
if(len>0) {
@ -4292,6 +4346,7 @@ if(stream_dump_type==5){
exit_player(mpctx, EXIT_ERROR);
}
}
stream_dump_progress(&info, len, mpctx->stream);
if (opts->chapterrange[1] > 0) {
int chapter = -1;
if (stream_control(mpctx->stream, STREAM_CTRL_GET_CURRENT_CHAPTER,
@ -4304,6 +4359,7 @@ if(stream_dump_type==5){
mp_tmsg(MSGT_GLOBAL,MSGL_FATAL,"%s: Error writing file.\n",opts->stream_dump_name);
exit_player(mpctx, EXIT_ERROR);
}
stream_dump_progress_end(&info, opts->stream_dump_name);
mp_tmsg(MSGT_CPLAYER, MSGL_INFO, "Stream dump complete.\n");
exit_player_with_rc(mpctx, EXIT_EOF, 0);
}
@ -4509,12 +4565,17 @@ if((stream_dump_type)&&(stream_dump_type<4)){
mp_tmsg(MSGT_CPLAYER,MSGL_FATAL,"Cannot open dump file.\n");
exit_player(mpctx, EXIT_ERROR);
}
struct stream_dump_progress info;
stream_dump_progress_start(&info);
while(!ds->eof){
unsigned char* start;
int in_size=ds_get_packet(ds,&start);
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);
if(in_size>0) fwrite(start,in_size,1,f);
if(in_size>0) {
fwrite(start,in_size,1,f);
stream_dump_progress(&info, in_size, mpctx->stream);
}
if (opts->chapterrange[1] > 0) {
int cur_chapter = demuxer_get_current_chapter(mpctx->demuxer, 0);
if(cur_chapter!=-1 && cur_chapter+1 > opts->chapterrange[1])
@ -4522,6 +4583,7 @@ if((stream_dump_type)&&(stream_dump_type<4)){
}
}
fclose(f);
stream_dump_progress_end(&info, opts->stream_dump_name);
mp_tmsg(MSGT_CPLAYER ,MSGL_INFO, "Stream dump complete.\n");
exit_player_with_rc(mpctx, EXIT_EOF, 0);
}

View File

@ -279,7 +279,7 @@ play_tree_set_parent(play_tree_t* pt, play_tree_t* parent) {
void
play_tree_add_file(play_tree_t* pt,char* file) {
play_tree_add_file(play_tree_t* pt,const char* file) {
int n = 0;
#ifdef MP_DEBUG
@ -310,7 +310,7 @@ play_tree_add_file(play_tree_t* pt,char* file) {
}
int
play_tree_remove_file(play_tree_t* pt,char* file) {
play_tree_remove_file(play_tree_t* pt,const char* file) {
int n,f = -1;
#ifdef MP_DEBUG
@ -349,7 +349,7 @@ play_tree_remove_file(play_tree_t* pt,char* file) {
}
void
play_tree_set_param(play_tree_t* pt, char* name, char* val) {
play_tree_set_param(play_tree_t* pt, const char* name, const char* val) {
int n = 0;
#ifdef MP_DEBUG
@ -373,7 +373,7 @@ play_tree_set_param(play_tree_t* pt, char* name, char* val) {
}
int
play_tree_unset_param(play_tree_t* pt, char* name) {
play_tree_unset_param(play_tree_t* pt, const char* name) {
int n,ni = -1;
#ifdef MP_DEBUG
@ -473,7 +473,6 @@ play_tree_iter_push_params(play_tree_iter_t* iter) {
if(!pt->child)
iter->entry_pushed = 1;
return;
}
play_tree_iter_t*
@ -934,7 +933,7 @@ void pt_iter_replace_entry(play_tree_iter_t* iter, play_tree_t* entry)
}
//Add a new file as a new entry
void pt_add_file(play_tree_t** ppt, char* filename)
void pt_add_file(play_tree_t** ppt, const char* filename)
{
play_tree_t *pt = *ppt, *entry = play_tree_new();
#ifdef MP_DEBUG

View File

@ -179,20 +179,20 @@ play_tree_remove(play_tree_t* pt, int free_it,int with_children);
/// Add a file to an item.
void
play_tree_add_file(play_tree_t* pt,char* file);
play_tree_add_file(play_tree_t* pt,const char* file);
/// Remove a file from an item.
int
play_tree_remove_file(play_tree_t* pt,char* file);
play_tree_remove_file(play_tree_t* pt,const char* file);
/// Add a config paramter to an item.
void
play_tree_set_param(play_tree_t* pt, char* name, char* val);
play_tree_set_param(play_tree_t* pt, const char* name, const char* val);
/// Remove a config parameter from an item.
int
play_tree_unset_param(play_tree_t* pt, char* name);
play_tree_unset_param(play_tree_t* pt, const char* name);
/// Copy the config parameters from one item to another.
void
@ -285,7 +285,7 @@ void pt_iter_insert_entry(play_tree_iter_t* iter, play_tree_t* entry);
void pt_iter_replace_entry(play_tree_iter_t* iter, play_tree_t* entry);
/// Adds a new file to the playtree, if it is not valid it is created.
void pt_add_file(play_tree_t** ppt, char* filename);
void pt_add_file(play_tree_t** ppt, const char* filename);
// A macro to use only the iter and not the other things.
#define pt_iter_add_file(iter, filename) pt_add_file(&iter->tree, filename)

View File

@ -334,8 +334,14 @@ parse_pls(play_tree_parser_t* p) {
num = pls_read_entry(line+6,&entries,&max_entry,&v);
if(num < 0)
mp_msg(MSGT_PLAYTREE,MSGL_ERR,"No value in entry %s\n",line);
else
entries[num-1].length = strdup(v);
else {
char *end;
long val = strtol(v, &end, 10);
if (*end || (val <= 0 && val != -1))
mp_msg(MSGT_PLAYTREE,MSGL_ERR,"Invalid length value in entry %s\n",line);
else if (val > 0)
entries[num-1].length = strdup(v);
}
} else
mp_msg(MSGT_PLAYTREE,MSGL_WARN,"Unknown entry type %s\n",line);
line = play_tree_parser_get_line(p);
@ -348,6 +354,8 @@ parse_pls(play_tree_parser_t* p) {
mp_msg(MSGT_PLAYTREE,MSGL_DBG2,"Adding entry %s\n",entries[num].file);
entry = play_tree_new();
play_tree_add_file(entry,entries[num].file);
if (entries[num].length)
play_tree_set_param(entry, "endpos", entries[num].length);
free(entries[num].file);
if(list)
play_tree_append_entry(last_entry,entry);

View File

@ -64,6 +64,7 @@ static void *ThreadProc(void *s);
#include "stream.h"
#include "cache2.h"
#include "mpcommon.h"
typedef struct {
// constats:
@ -91,6 +92,7 @@ typedef struct {
volatile int control_res;
volatile off_t control_new_pos;
volatile double stream_time_length;
volatile double stream_time_pos;
} cache_vars_t;
static int min_fill=0;
@ -260,17 +262,22 @@ static int cache_execute_control(cache_vars_t *s) {
int quit = s->control == -2;
if (quit || !s->stream->control) {
s->stream_time_length = 0;
s->stream_time_pos = MP_NOPTS_VALUE;
s->control_new_pos = 0;
s->control_res = STREAM_UNSUPPORTED;
s->control = -1;
return !quit;
}
if (GetTimerMS() - last > 99) {
double len;
double len, pos;
if (s->stream->control(s->stream, STREAM_CTRL_GET_TIME_LENGTH, &len) == STREAM_OK)
s->stream_time_length = len;
else
s->stream_time_length = 0;
if (s->stream->control(s->stream, STREAM_CTRL_GET_CURRENT_TIME, &pos) == STREAM_OK)
s->stream_time_pos = pos;
else
s->stream_time_pos = MP_NOPTS_VALUE;
last = GetTimerMS();
}
if (s->control == -1) return 1;
@ -581,11 +588,13 @@ int cache_do_control(stream_t *stream, int cmd, void *arg) {
s->control_uint_arg = *(unsigned *)arg;
s->control = cmd;
break;
// the core might call these every frame, they are too slow for this...
// the core might call these every frame, so cache them...
case STREAM_CTRL_GET_TIME_LENGTH:
// case STREAM_CTRL_GET_CURRENT_TIME:
*(double *)arg = s->stream_time_length;
return s->stream_time_length ? STREAM_OK : STREAM_UNSUPPORTED;
case STREAM_CTRL_GET_CURRENT_TIME:
*(double *)arg = s->stream_time_pos;
return s->stream_time_pos != MP_NOPTS_VALUE ? STREAM_OK : STREAM_UNSUPPORTED;
case STREAM_CTRL_GET_NUM_CHAPTERS:
case STREAM_CTRL_GET_CURRENT_CHAPTER:
case STREAM_CTRL_GET_ASPECT_RATIO:
@ -606,6 +615,8 @@ int cache_do_control(stream_t *stream, int cmd, void *arg) {
return STREAM_UNSUPPORTED;
}
}
if (s->control_res != STREAM_OK)
return s->control_res;
switch (cmd) {
case STREAM_CTRL_GET_TIME_LENGTH:
case STREAM_CTRL_GET_CURRENT_TIME:
@ -621,8 +632,7 @@ int cache_do_control(stream_t *stream, int cmd, void *arg) {
case STREAM_CTRL_SEEK_TO_CHAPTER:
case STREAM_CTRL_SEEK_TO_TIME:
case STREAM_CTRL_SET_ANGLE:
if (s->control_res != STREAM_UNSUPPORTED)
stream->pos = s->read_filepos = s->control_new_pos;
stream->pos = s->read_filepos = s->control_new_pos;
break;
}
return s->control_res;

View File

@ -467,7 +467,9 @@ nop_streaming_read( int fd, char *buffer, int size, streaming_ctrl_t *stream_ctr
ret = recv( fd, buffer+len, size-len, 0 );
if( ret<0 ) {
mp_msg(MSGT_NETWORK,MSGL_ERR,"nop_streaming_read error : %s\n",strerror(errno));
}
ret = 0;
} else if (ret == 0)
stream_ctrl->status = streaming_stopped_e;
len += ret;
//printf("read %d bytes from network\n", len );
}

View File

@ -287,6 +287,8 @@ int stream_read_internal(stream_t *s, void *buf, int len)
#ifdef CONFIG_NETWORKING
if( s->streaming_ctrl!=NULL && s->streaming_ctrl->streaming_read ) {
len=s->streaming_ctrl->streaming_read(s->fd, buf, len, s->streaming_ctrl);
if (s->streaming_ctrl->status == streaming_stopped_e)
s->eof = 1;
} else
#endif
if (s->fill_buffer)
@ -303,22 +305,29 @@ int stream_read_internal(stream_t *s, void *buf, int len)
len= s->fill_buffer ? s->fill_buffer(s, buf, len) : 0;
}
if(len<=0){
off_t pos = s->pos;
// do not retry if this looks like proper eof
if (s->eof || (s->end_pos && pos == s->end_pos))
goto eof_out;
// dvdnav has some horrible hacks to "suspend" reads,
// we need to skip this code or seeks will hang.
if (!s->eof && s->type != STREAMTYPE_DVDNAV) {
// just in case this is an error e.g. due to network
// timeout reset and retry
// Seeking is used as a hack to make network streams
// reopen the connection, ideally they would implement
// e.g. a STREAM_CTRL_RECONNECT to do this
off_t pos = s->pos;
s->eof=1;
stream_reset(s);
stream_seek_internal(s, pos);
// make sure EOF is set to ensure no endless loops
s->eof=1;
return stream_read_internal(s, buf, orig_len);
}
if (s->type == STREAMTYPE_DVDNAV)
goto eof_out;
// just in case this is an error e.g. due to network
// timeout reset and retry
// Seeking is used as a hack to make network streams
// reopen the connection, ideally they would implement
// e.g. a STREAM_CTRL_RECONNECT to do this
s->eof=1;
stream_reset(s);
if (stream_seek_internal(s, pos) >= 0 || s->pos != pos) // seek failed
goto eof_out;
// make sure EOF is set to ensure no endless loops
s->eof=1;
return stream_read_internal(s, buf, orig_len);
eof_out:
s->eof=1;
return 0;
}

View File

@ -299,7 +299,8 @@ inline static int stream_seek(stream_t *s,off_t pos){
mp_dbg(MSGT_DEMUX, MSGL_DBG3, "seek to 0x%qX\n",(long long)pos);
if (pos < 0) {
mp_msg(MSGT_DEMUX, MSGL_ERR, "Invalid seek to negative position!\n");
mp_msg(MSGT_DEMUX, MSGL_ERR, "Invalid seek to negative position %llx!\n",
(long long)pos);
pos = 0;
}
if(pos<s->pos){

View File

@ -420,6 +420,9 @@ static int open_cdda(stream_t *st,int m, void* opts, int* file_format) {
if(p->no_skip)
mode |= PARANOIA_MODE_NEVERSKIP;
#ifndef CONFIG_LIBCDIO
// HACK against libcdparanoia's stupid caching model that
// queues up a huge number of requests leading to stuttering
paranoia_cachemodel_size(priv->cdp, 24);
paranoia_modeset(cdd, mode);
if(p->search_overlap >= 0)

View File

@ -105,7 +105,7 @@ static struct cue_track_pos {
/* number of tracks on the cd */
static int nTracks = 0;
static int digits2int(char s[2], int errval) {
static int digits2int(const char s[2], int errval) {
uint8_t a = s[0] - '0';
uint8_t b = s[1] - '0';
if (a > 9 || b > 9)
@ -169,47 +169,50 @@ static int cue_getTrackinfo(FILE *fd_cue, char *Line, tTrack *track)
* on the arrays to have the same size, thus we need to make
* sure the sizes are in sync.
*/
static int cue_find_bin (char *firstline) {
static int cue_find_bin (const char *firstline) {
struct stat filestat;
const char *cur_name;
int i,j;
char bin_filename[256];
char s[256];
char t[256];
int fd_bin;
int i = 0;
/* get the filename out of that */
/* 12345 6 */
mp_msg (MSGT_OPEN,MSGL_INFO, "[bincue] cue_find_bin(%s)\n", firstline);
if (strncmp(firstline, "FILE \"",6)==0)
{
i = 0;
j = 0;
while ( firstline[6 + i] != '"')
firstline += 6;
while ( *firstline && *firstline != '"')
{
bin_filename[j] = firstline[6 + i];
bin_filename[i] = *firstline++;
/* if I found a path info, than delete all bevor it */
switch (bin_filename[j])
/* if I found a path info, then delete all before it */
switch (bin_filename[i])
{
case '\\':
j = 0;
i = 0;
break;
case '/':
j = 0;
i = 0;
break;
default:
j++;
i++;
}
i++;
}
bin_filename[j+1] = '\0';
}
bin_filename[i] = '\0';
fd_bin = -1;
for (i = 0; fd_bin == -1 && i < 6; i++) {
if (i <=1 && bin_filename[0] == '\0')
continue;
if (i > 1 && strlen(cue_filename) < 3)
break;
switch (i) {
case 0:
/* now try to open that file, without path */
@ -222,22 +225,19 @@ static int cue_find_bin (char *firstline) {
break;
case 2:
/* now I would say the whole filename is shit, build our own */
strncpy(s, cue_filename, strlen(cue_filename) - 3 );
s[strlen(cue_filename) - 3] = '\0';
strcat(s, "bin");
av_strlcpy(s, cue_filename, strlen(cue_filename) - 3 );
strcat(s, ".bin");
cur_name = s;
break;
case 3:
/* ok try it with path */
snprintf(t, sizeof( t ), "%s/%s", bincue_path, s);
fd_bin = open (t, O_RDONLY);
cur_name = t;
break;
case 4:
/* now I would say the whole filename is shit, build our own */
strncpy(s, cue_filename, strlen(cue_filename) - 3 );
s[strlen(cue_filename) - 3] = '\0';
strcat(s, "img");
av_strlcpy(s, cue_filename, strlen(cue_filename) - 3 );
strcat(s, ".img");
cur_name = s;
break;
case 5:
@ -247,6 +247,10 @@ static int cue_find_bin (char *firstline) {
break;
}
fd_bin = open(cur_name, O_RDONLY);
if (fstat(fd_bin, &filestat) == -1 || !S_ISREG(filestat.st_mode)) {
close(fd_bin);
fd_bin = -1;
}
if (fd_bin == -1) {
mp_tmsg(MSGT_OPEN,MSGL_STATUS, "[bincue] bin filename tested: %s\n",
cur_name);
@ -303,7 +307,7 @@ static inline int cue_mode_2_sector_size(int mode)
}
static int cue_read_cue (char *in_cue_filename)
static int cue_read_cue (const char *in_cue_filename)
{
struct stat filestat;
char sLine[256];
@ -319,7 +323,7 @@ static int cue_read_cue (char *in_cue_filename)
/* split the filename into a path and filename part */
s = strdup(in_cue_filename);
t = strrchr(s, '/');
if (t == (char *)NULL)
if (!t)
t = ".";
else {
*t = '\0';

View File

@ -534,8 +534,8 @@ static double dvd_get_current_time(stream_t *stream, int cell)
dvd_priv_t *d = stream->priv;
tm=0;
if(!cell) cell=d->cur_cell;
for(i=0; i<d->cur_cell; i++) {
if(cell < 0) cell=d->cur_cell;
for(i=0; i<cell; i++) {
if(d->cur_pgc->cell_playback[i].block_type == BLOCK_TYPE_ANGLE_BLOCK &&
d->cur_pgc->cell_playback[i].block_mode != BLOCK_MODE_FIRST_CELL
)
@ -585,7 +585,7 @@ static int dvd_seek_to_time(stream_t *stream, ifo_handle_t *vts_file, double sec
stream_skip(stream, 2048);
t = mp_dvdtimetomsec(&d->dsi_pack.dsi_gi.c_eltm);
} while(!t);
tm = dvd_get_current_time(stream, 0);
tm = dvd_get_current_time(stream, -1);
pos = ((off_t)tmap_sector)<<11;
stream_seek(stream, pos);
@ -594,7 +594,7 @@ static int dvd_seek_to_time(stream_t *stream, ifo_handle_t *vts_file, double sec
while(tm <= sec) {
if(!stream_skip(stream, 2048))
break;
tm = dvd_get_current_time(stream, 0);
tm = dvd_get_current_time(stream, -1);
};
tmap_sector = stream->pos >> 11;
@ -645,7 +645,7 @@ static int control(stream_t *stream,int cmd,void* arg)
case STREAM_CTRL_GET_CURRENT_TIME:
{
double tm;
tm = dvd_get_current_time(stream, 0);
tm = dvd_get_current_time(stream, -1);
if(tm != -1) {
*((double *)arg) = tm;
return 1;

View File

@ -410,7 +410,7 @@ static int control(stream_t *stream, int cmd, void* arg) {
{
case STREAM_CTRL_SEEK_TO_CHAPTER:
{
int chap = *((unsigned int *)arg)+1;
int chap = *(unsigned int *)arg+1;
if(chap < 1 || dvdnav_current_title_info(priv->dvdnav, &tit, &part) != DVDNAV_STATUS_OK)
break;
@ -426,21 +426,21 @@ static int control(stream_t *stream, int cmd, void* arg) {
break;
if(!part)
break;
*((unsigned int *)arg) = part;
*(unsigned int *)arg = part;
return 1;
}
case STREAM_CTRL_GET_CURRENT_CHAPTER:
{
if(dvdnav_current_title_info(priv->dvdnav, &tit, &part) != DVDNAV_STATUS_OK)
break;
*((unsigned int *)arg) = part - 1;
*(unsigned int *)arg = part - 1;
return 1;
}
case STREAM_CTRL_GET_TIME_LENGTH:
{
if(priv->duration || priv->still_length)
{
*((double *)arg) = (double)priv->duration / 1000.0;
*(double *)arg = (double)priv->duration / 1000.0;
return 1;
}
break;
@ -448,7 +448,7 @@ static int control(stream_t *stream, int cmd, void* arg) {
case STREAM_CTRL_GET_ASPECT_RATIO:
{
uint8_t ar = dvdnav_get_video_aspect(priv->dvdnav);
*((double *)arg) = !ar ? 4.0/3.0 : 16.0/9.0;
*(double *)arg = !ar ? 4.0/3.0 : 16.0/9.0;
return 1;
}
case STREAM_CTRL_GET_CURRENT_TIME:
@ -457,7 +457,7 @@ static int control(stream_t *stream, int cmd, void* arg) {
tm = dvdnav_get_current_time(priv->dvdnav)/90000.0f;
if(tm != -1)
{
*((double *)arg) = tm;
*(double *)arg = tm;
return 1;
}
break;
@ -474,7 +474,7 @@ static int control(stream_t *stream, int cmd, void* arg) {
uint32_t curr, angles;
if(dvdnav_get_angle_info(priv->dvdnav, &curr, &angles) != DVDNAV_STATUS_OK)
break;
*((int *)arg) = angles;
*(int *)arg = angles;
return 1;
}
case STREAM_CTRL_GET_ANGLE:
@ -482,13 +482,13 @@ static int control(stream_t *stream, int cmd, void* arg) {
uint32_t curr, angles;
if(dvdnav_get_angle_info(priv->dvdnav, &curr, &angles) != DVDNAV_STATUS_OK)
break;
*((int *)arg) = curr;
*(int *)arg = curr;
return 1;
}
case STREAM_CTRL_SET_ANGLE:
{
uint32_t curr, angles;
int new_angle = *((int *)arg);
int new_angle = *(int *)arg;
if(dvdnav_get_angle_info(priv->dvdnav, &curr, &angles) != DVDNAV_STATUS_OK)
break;
if(new_angle>angles || new_angle<1)

View File

@ -34,7 +34,7 @@
#include <sys/time.h>
#include <errno.h>
#include <sys/ioctl.h>
#include <sys/fcntl.h>
#include <fcntl.h>
#include <inttypes.h>
#include <poll.h>
#include <linux/types.h>

View File

@ -505,7 +505,9 @@ static DEFINE_GUID(MEDIATYPE_VBI, 0xf72a76e1, 0xeb0a, 0x11d0, 0xac, 0xe4, 0x00
* Methods, called only from this file
*---------------------------------------------------------------------------------------*/
void set_buffer_preference(int nDiv,WAVEFORMATEX* pWF,IPin* pOutPin,IPin* pInPin){
static void set_buffer_preference(int nDiv, WAVEFORMATEX *pWF,
IPin *pOutPin, IPin *pInPin)
{
ALLOCATOR_PROPERTIES prop;
IAMBufferNegotiation* pBN;
HRESULT hr;
@ -594,9 +596,10 @@ static long STDCALL CSampleGrabberCB_Release(ISampleGrabberCB * This)
}
HRESULT STDCALL CSampleGrabberCB_BufferCB(ISampleGrabberCB * This,
double SampleTime,
BYTE * pBuffer, long lBufferLen)
static HRESULT STDCALL CSampleGrabberCB_BufferCB(ISampleGrabberCB *This,
double SampleTime,
BYTE *pBuffer,
long lBufferLen)
{
CSampleGrabberCB *this = (CSampleGrabberCB *) This;
grabber_ringbuffer_t *rb = this->pbuf;
@ -628,9 +631,9 @@ HRESULT STDCALL CSampleGrabberCB_BufferCB(ISampleGrabberCB * This,
}
/// wrapper. directshow does the same when BufferCB callback is requested
HRESULT STDCALL CSampleGrabberCB_SampleCB(ISampleGrabberCB * This,
double SampleTime,
LPMEDIASAMPLE pSample)
static HRESULT STDCALL CSampleGrabberCB_SampleCB(ISampleGrabberCB *This,
double SampleTime,
LPMEDIASAMPLE pSample)
{
char* buf;
long len;
@ -2800,7 +2803,9 @@ static int init(priv_t * priv)
hr = init_chain_common(priv->pBuilder, priv->chains[1]);
if(FAILED(hr))
{
mp_msg(MSGT_TV, MSGL_V, "tvi_dshow: Unable to initialize audio chain (Error:0x%x). Audio disabled\n", (unsigned long)hr);
mp_msg(MSGT_TV, MSGL_V,
"tvi_dshow: Unable to initialize audio chain (Error:0x%lx). Audio disabled\n",
(unsigned long)hr);
priv->chains[1]->arpmt=calloc(1, sizeof(AM_MEDIA_TYPE*));
priv->chains[1]->arStreamCaps=calloc(1, sizeof(void*));
}
@ -2814,7 +2819,9 @@ static int init(priv_t * priv)
hr = init_chain_common(priv->pBuilder, priv->chains[2]);
if(FAILED(hr))
{
mp_msg(MSGT_TV, MSGL_V, "tvi_dshow: Unable to initialize VBI chain (Error:0x%x). Teletext disabled\n", (unsigned long)hr);
mp_msg(MSGT_TV, MSGL_V,
"tvi_dshow: Unable to initialize VBI chain (Error:0x%lx). Teletext disabled\n",
(unsigned long)hr);
priv->chains[2]->arpmt=calloc(1, sizeof(AM_MEDIA_TYPE*));
priv->chains[2]->arStreamCaps=calloc(1, sizeof(void*));
}

View File

@ -760,7 +760,8 @@ static int uninit(priv_t *priv)
static int get_capture_buffer_size(priv_t *priv)
{
int bufsize, cnt;
uint64_t bufsize;
int cnt;
if (priv->tv_param->buffer_size >= 0) {
bufsize = priv->tv_param->buffer_size*1024*1024;
@ -769,14 +770,10 @@ static int get_capture_buffer_size(priv_t *priv)
struct sysinfo si;
sysinfo(&si);
if (si.totalram<2*1024*1024) {
bufsize = 1024*1024;
} else {
bufsize = si.totalram/2;
}
#else
bufsize = 16*1024*1024;
bufsize = (si.freeram/2)*si.mem_unit;
if (bufsize < 16*1024*1024)
#endif
bufsize = 16*1024*1024;
}
cnt = bufsize/(priv->height*priv->bytesperline);

View File

@ -1376,7 +1376,8 @@ static int init(priv_t *priv)
static int get_capture_buffer_size(priv_t *priv)
{
int bufsize, cnt;
uint64_t bufsize;
int cnt;
if (priv->tv_param->buffer_size >= 0) {
bufsize = priv->tv_param->buffer_size*1024*1024;
@ -1385,14 +1386,10 @@ static int get_capture_buffer_size(priv_t *priv)
struct sysinfo si;
sysinfo(&si);
if (si.totalram<2*1024*1024) {
bufsize = 1024*1024;
} else {
bufsize = si.totalram/2;
}
#else
bufsize = 16*1024*1024;
bufsize = (si.freeram/2)*si.mem_unit;
if ( bufsize < 16*1024*1024)
#endif
bufsize = 16*1024*1024;
}
cnt = bufsize/priv->format.fmt.pix.sizeimage;

View File

@ -694,72 +694,25 @@ static int vobsub_parse_id(vobsub_t *vob, const char *line)
static int vobsub_parse_timestamp(vobsub_t *vob, const char *line)
{
// timestamp: HH:MM:SS.mmm, filepos: 0nnnnnnnnn
const char *p;
int h, m, s, ms;
off_t filepos;
while (isspace(*line))
++line;
p = line;
while (isdigit(*p))
++p;
if (p - line != 2)
if (sscanf(line, " %02d:%02d:%02d:%03d, filepos: %09lx",
&h, &m, &s, &ms, &filepos) != 5)
return -1;
h = atoi(line);
if (*p != ':')
return -1;
line = ++p;
while (isdigit(*p))
++p;
if (p - line != 2)
return -1;
m = atoi(line);
if (*p != ':')
return -1;
line = ++p;
while (isdigit(*p))
++p;
if (p - line != 2)
return -1;
s = atoi(line);
if (*p != ':')
return -1;
line = ++p;
while (isdigit(*p))
++p;
if (p - line != 3)
return -1;
ms = atoi(line);
if (*p != ',')
return -1;
line = p + 1;
while (isspace(*line))
++line;
if (strncmp("filepos:", line, 8))
return -1;
line += 8;
while (isspace(*line))
++line;
if (! isxdigit(*line))
return -1;
filepos = strtol(line, NULL, 16);
return vobsub_add_timestamp(vob, filepos, vob->delay + ms + 1000 * (s + 60 * (m + 60 * h)));
}
static int vobsub_parse_origin(vobsub_t *vob, const char *line)
{
// org: X,Y
char *p;
while (isspace(*line))
++line;
if (!isdigit(*line))
return -1;
vob->origin_x = strtoul(line, &p, 10);
if (*p != ',')
return -1;
++p;
vob->origin_y = strtoul(p, NULL, 10);
return 0;
unsigned x, y;
if (sscanf(line, " %u,%u", &x, &y) == 2) {
vob->origin_x = x;
vob->origin_y = y;
return 0;
}
return -1;
}
unsigned int vobsub_palette_to_yuv(unsigned int pal)
@ -1341,7 +1294,7 @@ void vobsub_out_output(void *me, const unsigned char *packet,
m = s / 60;
s -= m * 60;
ms = (s - (unsigned int) s) * 1000;
if (ms >= 1000) /* prevent overfolws or bad float stuff */
if (ms >= 1000) /* prevent overflows or bad float stuff */
ms = 0;
if (h != last_h || m != last_m || (unsigned int) s != last_s || ms != last_ms) {
fprintf(vob->fidx, "timestamp: %02u:%02u:%02u:%03u, filepos: %09lx\n",
@ -1382,13 +1335,13 @@ void vobsub_out_output(void *me, const unsigned char *packet,
datalen += 1; /* AID */
pad_len = 2048 - (p - buffer) - 4 /* MPEG ID */ - 2 /* payload len */ - datalen;
/* XXX - Go figure what should go here! In any case the
packet has to be completly filled. If I can fill it
packet has to be completely filled. If I can fill it
with padding (0x000001be) latter I'll do that. But if
there is only room for 6 bytes then I can not write a
padding packet. So I add some padding in the PTS
field. This looks like a dirty kludge. Oh well... */
if (pad_len < 0) {
/* Packet is too big. Let's try ommiting the PTS field */
/* Packet is too big. Let's try omitting the PTS field */
datalen -= pts_len;
pts_len = 0;
pad_len = 0;
@ -1439,7 +1392,7 @@ void vobsub_out_output(void *me, const unsigned char *packet,
perror("ERROR: vobsub blank padding write failed");
} else if (remain < 0)
fprintf(stderr,
"\nERROR: wrong thing happenned...\n"
"\nERROR: wrong thing happened...\n"
" I wrote a %i data bytes spu packet and that's too long\n", len);
}
}