Merge svn changes up to r30104

Ignore the broken correct-pts change in r30100.
This commit is contained in:
Uoti Urpala 2009-12-30 00:14:20 +02:00
commit dc7f183022
12 changed files with 394 additions and 288 deletions

View File

@ -3814,6 +3814,9 @@ Values below 0 will leave it at the system default.
This limits the framerate to (horizontal refresh rate / n). This limits the framerate to (horizontal refresh rate / n).
Requires GLX_SGI_swap_control support to work. Requires GLX_SGI_swap_control support to work.
With some (most/all?) implementations this only works in fullscreen mode. With some (most/all?) implementations this only works in fullscreen mode.
.IPs ycbcr
Use the GL_MESA_ycbcr_texture extension to convert YUV to RGB.
In most cases this is probably slower than doing software conversion to RGB.
.IPs yuv=<n> .IPs yuv=<n>
Select the type of YUV to RGB conversion. Select the type of YUV to RGB conversion.
.RSss .RSss
@ -3857,9 +3860,6 @@ Provides brightness, contrast, saturation, hue and gamma control.
Gamma can also be set independently for red, green and blue. Gamma can also be set independently for red, green and blue.
Speed depends more on GPU memory bandwidth than other methods. Speed depends more on GPU memory bandwidth than other methods.
.RE .RE
.IPs ycbcr
Use the GL_MESA_ycbcr_texture extension to convert YUV to RGB.
In most cases this is probably slower than doing software conversion to RGB.
.IPs lscale=<n> .IPs lscale=<n>
Select the scaling function to use for luminance scaling. Select the scaling function to use for luminance scaling.
Only valid for yuv modes 2, 3, 4 and 6. Only valid for yuv modes 2, 3, 4 and 6.
@ -3897,6 +3897,13 @@ for customtex texture.
.IPs (no)customtrect .IPs (no)customtrect
If enabled, use texture_rectangle for customtex texture. If enabled, use texture_rectangle for customtex texture.
Default is disabled. Default is disabled.
.IPs (no)mipmapgen
If enabled, mipmaps for the video are automatically generated.
This should be useful together with the customprog and the TXB
instruction to implement blur filters with a large radius.
For most OpenGL implementations this is very slow for any non-RGB
formats.
Default is disabled.
.RE .RE
.sp 1 .sp 1
.RS .RS

View File

@ -1,4 +1,4 @@
.\" synced with r29244 .\" synced with r29731
.\" Encoding: iso-8859-1 .\" Encoding: iso-8859-1
.\" MPlayer (C) 2000-2009 MPlayer Team .\" MPlayer (C) 2000-2009 MPlayer Team
.\" The English man page was/is done by Gabucino, Diego Biurrun, Jonas Jermann .\" The English man page was/is done by Gabucino, Diego Biurrun, Jonas Jermann
@ -551,10 +551,17 @@ Vous pouvez
Si vous souhaitez avoir un fichier de config pour un fichier nommé 'film.avi', Si vous souhaitez avoir un fichier de config pour un fichier nommé 'film.avi',
créez un fichier nommé 'film.avi.conf' contenant les options spécifiques à ce créez un fichier nommé 'film.avi.conf' contenant les options spécifiques à ce
fichier et placez-le dans ~/.mplayer/. fichier et placez-le dans ~/.mplayer/.
Vous pouvez aussi mettre le fichier de configuration dans le même répertoire
que le fichier à jouer, pour autant que vous spécifiez l'option Si un tel fichier de configuration se trouve dans le même répertoire,
\-use\-filedir\-conf (soit depuis la ligne de commande, soit dans le fichier aucun fichier de configuration spécifique ne sera lu depuis
de configuration global). ~/.mplayer/.
De plus, l'option \-use\-filedir\-conf permet de définir des fichiers
de configuration spécifiques à un répertoire.
Pour ce faire, MPlayer essaye de charger un fichier mplayer.conf
depuis le même répertoire que celui du fichier joué, et essaye ensuite
de charger un fichier de configuration spécifique.
.PP .PP
.I EXEMPLE DE FICHIER DE CONFIGURATION MPLAYER\ : .I EXEMPLE DE FICHIER DE CONFIGURATION MPLAYER\ :
@ -2444,6 +2451,11 @@ Si vous n'arrivez pas
DVD, essayez avec \-vobsubid. DVD, essayez avec \-vobsubid.
. .
.TP .TP
.B \-nosub
Désactive la sélection automatique de sous-titres (c'est ce qui se
passe par défaut avec le démultiplexeur Matroska/mkv par exemple).
.
.TP
.B \-slang <code de pays[,code de langue,...]> (voir aussi l'option \-sid) .B \-slang <code de pays[,code de langue,...]> (voir aussi l'option \-sid)
Définit une liste de langues de sous-titres à afficher en priorité. Définit une liste de langues de sous-titres à afficher en priorité.
Chaque format de conteneur utilise des codes de pays différents. Chaque format de conteneur utilise des codes de pays différents.
@ -3466,6 +3478,9 @@ uniquement)
Dit à MPlayer de s'attacher à une fenêtre existante. Dit à MPlayer de s'attacher à une fenêtre existante.
Utile pour intégrer MPlayer dans un navigateur (avec l'extension plugger Utile pour intégrer MPlayer dans un navigateur (avec l'extension plugger
par exemple). par exemple).
Cette option rempli complètement la fenêtre donnée, si bien que le
ratio d'aspect, panscan, etc. ne sont plus assurés par MPlayer et
doivent ainsi être assurés par l'application qui a créé la fenêtre.
. .
.TP .TP
.B \-xineramascreen <\-2\-...> .B \-xineramascreen <\-2\-...>
@ -3800,7 +3815,8 @@ Force le mode WarpOverlay!.
.IPs dive .IPs dive
Force le mode DIVE. Force le mode DIVE.
.IPs (no)t23 .IPs (no)t23
Active le contournement pour les bugs de l'ordinateur portable T23. Active le contournement pour les bugs de l'ordinateur portable T23
(par défaut\ : désactivé).
Essayez d'activer cette option si votre carte vidéo ne gère que Essayez d'activer cette option si votre carte vidéo ne gère que
l'agrandissement d'image (upscaling). l'agrandissement d'image (upscaling).
.RE .RE
@ -7719,6 +7735,28 @@ Pourcentage de pixels qui doivent
Seuil en dessous duquel un pixel est considéré comme noir (par défaut: 32) Seuil en dessous duquel un pixel est considéré comme noir (par défaut: 32)
.RE .RE
. .
.TP
.B gradfun[=force[:rayon]]
Corrige les "effets de bande" (banding) qui se produisent parfois dans les
régions presque uniformes, dûes à la troncature de la profondeur des
couleur à 8bits.
Interpole le dégradé qui devraient se situer où les bandes sont, et
effectue un tramage.
.sp 1
Ce filtre est destiné à être uniquement utilisé pour la lecture.
Ne l'utilisez pas avant une compression à perte, car la compression tend
à supprimer le tramage et de rétablir les bandes.
.RSs
.IPs <force>
Le delta maximum permis pour la modification d'un pixel.
Est aussi le seuil pour détecter les régions presque uniformes (par
defaut\ : 1.2).
.IPs <rayon>
Le voisinage avec lequel le dégradé doit être injecté.
Un rayon plus grand produit des dégradés plus doux, mais empêche le filtre
de modifier les pixels près des régions détaillées (par defaut\ : 16).
.RE
.
. .
.SH "OPTIONS D'ENCODAGE GÉNÉRALES (MENCODER UNIQUEMENT)" .SH "OPTIONS D'ENCODAGE GÉNÉRALES (MENCODER UNIQUEMENT)"
. .
@ -8273,10 +8311,6 @@ formats adaptatifs PCM \- voir la documentation HTML pour plus de details.
Free Lossless Audio Codec (FLAC) Free Lossless Audio Codec (FLAC)
.IPs "g726\ " .IPs "g726\ "
G.726 ADPCM G.726 ADPCM
.IPs libamr_nb
3GPP Adaptive Multi-Rate (AMR) narrow-band (bande étroite)
.IPs libamr_wb
3GPP Adaptive Multi-Rate (AMR) wide-band (large bande)
.IPs libfaac .IPs libfaac
Advanced Audio Coding (AAC) \- utilisant FAAC Advanced Audio Coding (AAC) \- utilisant FAAC
.IPs libmp3lame .IPs libmp3lame

View File

@ -814,11 +814,11 @@ tremor/%: CFLAGS += $(CFLAGS_TREMOR_LOW)
vidix/%: CFLAGS += $(CFLAGS_DHAHELPER) $(CFLAGS_SVGALIB_HELPER) vidix/%: CFLAGS += $(CFLAGS_DHAHELPER) $(CFLAGS_SVGALIB_HELPER)
VIDIX_PCI_FILES = vidix/pci_dev_ids.c vidix/pci_ids.h vidix/pci_names.c \ VIDIX_PCI_FILES = vidix/pci_dev_ids.c vidix/pci_ids.h vidix/pci_vendor_ids.h \
vidix/pci_names.h vidix/pci_vendors.h vidix/pci_vendors.h
$(VIDIX_PCI_FILES): vidix/pci_db2c.awk vidix/pci.db $(VIDIX_PCI_FILES): vidix/pci_db2c.awk vidix/pci.db
awk -f $^ $(VIDIX_PCIDB) $^ $(VIDIX_PCIDB)
VIDIX_DEPS = $(filter vidix/%,$(SRCS_MPLAYER:.c=.d)) VIDIX_DEPS = $(filter vidix/%,$(SRCS_MPLAYER:.c=.d))
VIDIX_OBJS = $(filter vidix/%,$(SRCS_MPLAYER:.c=.o)) VIDIX_OBJS = $(filter vidix/%,$(SRCS_MPLAYER:.c=.o))

2
configure vendored
View File

@ -1342,7 +1342,7 @@ else # if test -z "$_target"
qnx) system_name=QNX ;; qnx) system_name=QNX ;;
morphos) system_name=MorphOS ;; morphos) system_name=MorphOS ;;
amigaos) system_name=AmigaOS ;; amigaos) system_name=AmigaOS ;;
mingw32msvc) system_name=MINGW32 ;; mingw32*) system_name=MINGW32 ;;
esac esac
# We need to convert underscores so that values like k6-2 and pentium-mmx can be passed # We need to convert underscores so that values like k6-2 and pentium-mmx can be passed
host_arch=$(echo $_target | cut -d '-' -f 1) host_arch=$(echo $_target | cut -d '-' -f 1)

View File

@ -9,6 +9,14 @@ release 20090308
; VIDEO CODECS ; VIDEO CODECS
;============================================================================= ;=============================================================================
videocodec ffcdgraphics
info "FFmpeg CD-Graphics"
status working
fourcc CDGR ; internal MPlayer FourCC
driver ffmpeg
dll cdgraphics
out BGR8
videocodec ffmvi1 videocodec ffmvi1
info "FFmpeg Motion Pixels" info "FFmpeg Motion Pixels"
status working status working
@ -520,6 +528,22 @@ videocodec ffcyuv
dll "cyuv" dll "cyuv"
out 411P out 411P
videocodec ffaura
info "Auravision Aura (libavcodec)"
status working
fourcc aura,AURA
driver ffmpeg
dll "aura"
out 411P
videocodec ffaura2
info "Auravision Aura 2 (libavcodec)"
status working
fourcc aur2,AUR2
driver ffmpeg
dll "aura2"
out 422P
videocodec ffmsrle videocodec ffmsrle
info "Microsoft RLE" info "Microsoft RLE"
status working status working
@ -2048,12 +2072,19 @@ videocodec vp6
info "On2 VP6 Personal Codec" info "On2 VP6 Personal Codec"
status working status working
fourcc VP60,VP61,VP62 fourcc VP60,VP61,VP62
fourcc VP6F VP60
driver vfwex driver vfwex
dll "vp6vfw.dll" dll "vp6vfw.dll"
out YUY2 out YUY2
out BGR32,BGR24 out BGR32,BGR24
videocodec vp6f
info "On2 VP6F Personal Codec"
status working
fourcc VP6F VP60
driver vfwex
dll "vp6vfw.dll"
out YUY2,BGR32,BGR24 flip
videocodec vp7 videocodec vp7
info "On2 VP7 Personal Codec" info "On2 VP7 Personal Codec"
status working status working

View File

@ -88,6 +88,7 @@ static const struct mp_AVCodecTag mp_bmp_tags[] = {
{ CODEC_ID_BETHSOFTVID, MKTAG('B', 'E', 'T', 'H')}, { CODEC_ID_BETHSOFTVID, MKTAG('B', 'E', 'T', 'H')},
{ CODEC_ID_BFI, MKTAG('B', 'F', 'I', 'V')}, { CODEC_ID_BFI, MKTAG('B', 'F', 'I', 'V')},
{ CODEC_ID_C93, MKTAG('C', '9', '3', 'V')}, { CODEC_ID_C93, MKTAG('C', '9', '3', 'V')},
{ CODEC_ID_CDGRAPHICS, MKTAG('C', 'D', 'G', 'R')},
{ CODEC_ID_DNXHD, MKTAG('A', 'V', 'd', 'n')}, { CODEC_ID_DNXHD, MKTAG('A', 'V', 'd', 'n')},
{ CODEC_ID_DSICINVIDEO, MKTAG('D', 'C', 'I', 'V')}, { CODEC_ID_DSICINVIDEO, MKTAG('D', 'C', 'I', 'V')},
{ CODEC_ID_DXA, MKTAG('D', 'X', 'A', '1')}, { CODEC_ID_DXA, MKTAG('D', 'X', 'A', '1')},

View File

@ -834,11 +834,11 @@ static const char *bilin_filt_template =
"LRP yuv.%c, parmx.b, a.bbbb, a.aaaa;" "LRP yuv.%c, parmx.b, a.bbbb, a.aaaa;"
static const char *bicub_filt_template_2D = static const char *bicub_filt_template_2D =
"MAD coord.xy, fragment.texcoord[%c], {%f, %f}, {0.5, 0.5};" "MAD coord.xy, fragment.texcoord[%c], {%e, %e}, {0.5, 0.5};"
"TEX parmx, coord.x, texture[%c], 1D;" "TEX parmx, coord.x, texture[%c], 1D;"
"MUL cdelta.xz, parmx.rrgg, {-%f, 0, %f, 0};" "MUL cdelta.xz, parmx.rrgg, {-%e, 0, %e, 0};"
"TEX parmy, coord.y, texture[%c], 1D;" "TEX parmy, coord.y, texture[%c], 1D;"
"MUL cdelta.yw, parmy.rrgg, {0, -%f, 0, %f};" "MUL cdelta.yw, parmy.rrgg, {0, -%e, 0, %e};"
BICUB_FILT_MAIN("2D"); BICUB_FILT_MAIN("2D");
static const char *bicub_filt_template_RECT = static const char *bicub_filt_template_RECT =
@ -860,12 +860,12 @@ static const char *bicub_filt_template_RECT =
"SUB "t".y, "t".yyyy, "s";" "SUB "t".y, "t".yyyy, "s";"
static const char *bicub_notex_filt_template_2D = static const char *bicub_notex_filt_template_2D =
"MAD coord.xy, fragment.texcoord[%c], {%f, %f}, {0.5, 0.5};" "MAD coord.xy, fragment.texcoord[%c], {%e, %e}, {0.5, 0.5};"
"FRC coord.xy, coord.xyxy;" "FRC coord.xy, coord.xyxy;"
CALCWEIGHTS("parmx", "coord.xxxx") CALCWEIGHTS("parmx", "coord.xxxx")
"MUL cdelta.xz, parmx.rrgg, {-%f, 0, %f, 0};" "MUL cdelta.xz, parmx.rrgg, {-%e, 0, %e, 0};"
CALCWEIGHTS("parmy", "coord.yyyy") CALCWEIGHTS("parmy", "coord.yyyy")
"MUL cdelta.yw, parmy.rrgg, {0, -%f, 0, %f};" "MUL cdelta.yw, parmy.rrgg, {0, -%e, 0, %e};"
BICUB_FILT_MAIN("2D"); BICUB_FILT_MAIN("2D");
static const char *bicub_notex_filt_template_RECT = static const char *bicub_notex_filt_template_RECT =
@ -886,9 +886,9 @@ static const char *bicub_notex_filt_template_RECT =
"LRP yuv.%c, parmx.b, a.rrrr, b.rrrr;" "LRP yuv.%c, parmx.b, a.rrrr, b.rrrr;"
static const char *bicub_x_filt_template_2D = static const char *bicub_x_filt_template_2D =
"MAD coord.x, fragment.texcoord[%c], {%f}, {0.5};" "MAD coord.x, fragment.texcoord[%c], {%e}, {0.5};"
"TEX parmx, coord, texture[%c], 1D;" "TEX parmx, coord, texture[%c], 1D;"
"MUL cdelta.xyz, parmx.rrgg, {-%f, 0, %f};" "MUL cdelta.xyz, parmx.rrgg, {-%e, 0, %e};"
BICUB_X_FILT_MAIN("2D"); BICUB_X_FILT_MAIN("2D");
static const char *bicub_x_filt_template_RECT = static const char *bicub_x_filt_template_RECT =
@ -898,7 +898,7 @@ static const char *bicub_x_filt_template_RECT =
BICUB_X_FILT_MAIN("RECT"); BICUB_X_FILT_MAIN("RECT");
static const char *unsharp_filt_template = static const char *unsharp_filt_template =
"PARAM dcoord%c = {%f, %f, %f, %f};" "PARAM dcoord%c = {%e, %e, %e, %e};"
"ADD coord, fragment.texcoord[%c].xyxy, dcoord%c;" "ADD coord, fragment.texcoord[%c].xyxy, dcoord%c;"
"SUB coord2, fragment.texcoord[%c].xyxy, dcoord%c;" "SUB coord2, fragment.texcoord[%c].xyxy, dcoord%c;"
"TEX a.r, fragment.texcoord[%c], texture[%c], %s;" "TEX a.r, fragment.texcoord[%c], texture[%c], %s;"
@ -909,11 +909,11 @@ static const char *unsharp_filt_template =
"TEX b.g, coord2.zwzw, texture[%c], %s;" "TEX b.g, coord2.zwzw, texture[%c], %s;"
"DP3 b, b, {0.25, 0.25, 0.25};" "DP3 b, b, {0.25, 0.25, 0.25};"
"SUB b.r, a.r, b.r;" "SUB b.r, a.r, b.r;"
"MAD yuv.%c, b.r, {%f}, a.r;"; "MAD yuv.%c, b.r, {%e}, a.r;";
static const char *unsharp_filt_template2 = static const char *unsharp_filt_template2 =
"PARAM dcoord%c = {%f, %f, %f, %f};" "PARAM dcoord%c = {%e, %e, %e, %e};"
"PARAM dcoord2%c = {%f, 0, 0, %f};" "PARAM dcoord2%c = {%e, 0, 0, %e};"
"ADD coord, fragment.texcoord[%c].xyxy, dcoord%c;" "ADD coord, fragment.texcoord[%c].xyxy, dcoord%c;"
"SUB coord2, fragment.texcoord[%c].xyxy, dcoord%c;" "SUB coord2, fragment.texcoord[%c].xyxy, dcoord%c;"
"TEX a.r, fragment.texcoord[%c], texture[%c], %s;" "TEX a.r, fragment.texcoord[%c], texture[%c], %s;"
@ -933,13 +933,13 @@ static const char *unsharp_filt_template2 =
"TEX b.g, coord2.zwzw, texture[%c], %s;" "TEX b.g, coord2.zwzw, texture[%c], %s;"
"DP4 b.r, b, {-0.1171875, -0.1171875, -0.1171875, -0.09765625};" "DP4 b.r, b, {-0.1171875, -0.1171875, -0.1171875, -0.09765625};"
"MAD b.r, a.r, {0.859375}, b.r;" "MAD b.r, a.r, {0.859375}, b.r;"
"MAD yuv.%c, b.r, {%f}, a.r;"; "MAD yuv.%c, b.r, {%e}, a.r;";
static const char *yuv_prog_template = static const char *yuv_prog_template =
"PARAM ycoef = {%.4f, %.4f, %.4f};" "PARAM ycoef = {%e, %e, %e};"
"PARAM ucoef = {%.4f, %.4f, %.4f};" "PARAM ucoef = {%e, %e, %e};"
"PARAM vcoef = {%.4f, %.4f, %.4f};" "PARAM vcoef = {%e, %e, %e};"
"PARAM offsets = {%.4f, %.4f, %.4f};" "PARAM offsets = {%e, %e, %e};"
"TEMP res;" "TEMP res;"
"MAD res.rgb, yuv.rrrr, ycoef, offsets;" "MAD res.rgb, yuv.rrrr, ycoef, offsets;"
"MAD res.rgb, yuv.gggg, ucoef, res;" "MAD res.rgb, yuv.gggg, ucoef, res;"
@ -947,11 +947,11 @@ static const char *yuv_prog_template =
"END"; "END";
static const char *yuv_pow_prog_template = static const char *yuv_pow_prog_template =
"PARAM ycoef = {%.4f, %.4f, %.4f};" "PARAM ycoef = {%e, %e, %e};"
"PARAM ucoef = {%.4f, %.4f, %.4f};" "PARAM ucoef = {%e, %e, %e};"
"PARAM vcoef = {%.4f, %.4f, %.4f};" "PARAM vcoef = {%e, %e, %e};"
"PARAM offsets = {%.4f, %.4f, %.4f};" "PARAM offsets = {%e, %e, %e};"
"PARAM gamma = {%.4f, %.4f, %.4f};" "PARAM gamma = {%e, %e, %e};"
"TEMP res;" "TEMP res;"
"MAD res.rgb, yuv.rrrr, ycoef, offsets;" "MAD res.rgb, yuv.rrrr, ycoef, offsets;"
"MAD res.rgb, yuv.gggg, ucoef, res;" "MAD res.rgb, yuv.gggg, ucoef, res;"
@ -962,10 +962,10 @@ static const char *yuv_pow_prog_template =
"END"; "END";
static const char *yuv_lookup_prog_template = static const char *yuv_lookup_prog_template =
"PARAM ycoef = {%.4f, %.4f, %.4f, 0};" "PARAM ycoef = {%e, %e, %e, 0};"
"PARAM ucoef = {%.4f, %.4f, %.4f, 0};" "PARAM ucoef = {%e, %e, %e, 0};"
"PARAM vcoef = {%.4f, %.4f, %.4f, 0};" "PARAM vcoef = {%e, %e, %e, 0};"
"PARAM offsets = {%.4f, %.4f, %.4f, 0.125};" "PARAM offsets = {%e, %e, %e, 0.125};"
"TEMP res;" "TEMP res;"
"MAD res, yuv.rrrr, ycoef, offsets;" "MAD res, yuv.rrrr, ycoef, offsets;"
"MAD res.rgb, yuv.gggg, ucoef, res;" "MAD res.rgb, yuv.gggg, ucoef, res;"
@ -1093,7 +1093,7 @@ static void create_conv_textures(gl_conversion_params_t *params, int *texu, char
switch (conv) { switch (conv) {
case YUV_CONVERSION_FRAGMENT: case YUV_CONVERSION_FRAGMENT:
case YUV_CONVERSION_FRAGMENT_POW: case YUV_CONVERSION_FRAGMENT_POW:
break; break;
case YUV_CONVERSION_FRAGMENT_LOOKUP: case YUV_CONVERSION_FRAGMENT_LOOKUP:
texs[0] = (*texu)++; texs[0] = (*texu)++;
ActiveTexture(GL_TEXTURE0 + texs[0]); ActiveTexture(GL_TEXTURE0 + texs[0]);
@ -1409,6 +1409,8 @@ void glSetupYUVConversion(gl_conversion_params_t *params) {
case YUV_CONVERSION_FRAGMENT_POW: case YUV_CONVERSION_FRAGMENT_POW:
glSetupYUVFragprog(params); glSetupYUVFragprog(params);
break; break;
case YUV_CONVERSION_NONE:
break;
default: default:
mp_msg(MSGT_VO, MSGL_ERR, "[gl] unknown conversion type %i\n", YUV_CONVERSION(params->type)); mp_msg(MSGT_VO, MSGL_ERR, "[gl] unknown conversion type %i\n", YUV_CONVERSION(params->type));
} }
@ -1421,7 +1423,6 @@ void glSetupYUVConversion(gl_conversion_params_t *params) {
* \ingroup glconversion * \ingroup glconversion
*/ */
void glEnableYUVConversion(GLenum target, int type) { void glEnableYUVConversion(GLenum target, int type) {
if (type <= 0) return;
switch (YUV_CONVERSION(type)) { switch (YUV_CONVERSION(type)) {
case YUV_CONVERSION_COMBINERS: case YUV_CONVERSION_COMBINERS:
ActiveTexture(GL_TEXTURE1); ActiveTexture(GL_TEXTURE1);
@ -1443,6 +1444,7 @@ void glEnableYUVConversion(GLenum target, int type) {
case YUV_CONVERSION_FRAGMENT_LOOKUP: case YUV_CONVERSION_FRAGMENT_LOOKUP:
case YUV_CONVERSION_FRAGMENT_POW: case YUV_CONVERSION_FRAGMENT_POW:
case YUV_CONVERSION_FRAGMENT: case YUV_CONVERSION_FRAGMENT:
case YUV_CONVERSION_NONE:
Enable(GL_FRAGMENT_PROGRAM); Enable(GL_FRAGMENT_PROGRAM);
break; break;
} }
@ -1455,7 +1457,6 @@ void glEnableYUVConversion(GLenum target, int type) {
* \ingroup glconversion * \ingroup glconversion
*/ */
void glDisableYUVConversion(GLenum target, int type) { void glDisableYUVConversion(GLenum target, int type) {
if (type <= 0) return;
switch (YUV_CONVERSION(type)) { switch (YUV_CONVERSION(type)) {
case YUV_CONVERSION_COMBINERS: case YUV_CONVERSION_COMBINERS:
ActiveTexture(GL_TEXTURE1); ActiveTexture(GL_TEXTURE1);
@ -1477,6 +1478,7 @@ void glDisableYUVConversion(GLenum target, int type) {
case YUV_CONVERSION_FRAGMENT_LOOKUP: case YUV_CONVERSION_FRAGMENT_LOOKUP:
case YUV_CONVERSION_FRAGMENT_POW: case YUV_CONVERSION_FRAGMENT_POW:
case YUV_CONVERSION_FRAGMENT: case YUV_CONVERSION_FRAGMENT:
case YUV_CONVERSION_NONE:
Disable(GL_FRAGMENT_PROGRAM); Disable(GL_FRAGMENT_PROGRAM);
break; break;
} }

View File

@ -69,6 +69,9 @@
#ifndef GL_CLAMP_TO_EDGE #ifndef GL_CLAMP_TO_EDGE
#define GL_CLAMP_TO_EDGE 0x812F #define GL_CLAMP_TO_EDGE 0x812F
#endif #endif
#ifndef GL_GENERATE_MIPMAP
#define GL_GENERATE_MIPMAP 0x8191
#endif
#ifndef GL_REGISTER_COMBINERS_NV #ifndef GL_REGISTER_COMBINERS_NV
#define GL_REGISTER_COMBINERS_NV 0x8522 #define GL_REGISTER_COMBINERS_NV 0x8522
#endif #endif

View File

@ -86,6 +86,9 @@ static int osd_color;
static int use_aspect; static int use_aspect;
static int use_ycbcr; static int use_ycbcr;
#define MASK_ALL_YUV (~(1 << YUV_CONVERSION_NONE))
#define MASK_NOT_COMBINERS (~((1 << YUV_CONVERSION_NONE) | (1 << YUV_CONVERSION_COMBINERS) | (1 << YUV_CONVERSION_COMBINERS_ATI)))
#define MASK_GAMMA_SUPPORT (MASK_NOT_COMBINERS & ~(1 << YUV_CONVERSION_FRAGMENT))
static int use_yuv; static int use_yuv;
static int lscale; static int lscale;
static int cscale; static int cscale;
@ -120,6 +123,7 @@ static char *custom_prog;
static char *custom_tex; static char *custom_tex;
static int custom_tlin; static int custom_tlin;
static int custom_trect; static int custom_trect;
static int mipmap_gen;
static int int_pause; static int int_pause;
static int eq_bri = 0; static int eq_bri = 0;
@ -458,6 +462,7 @@ static void autodetectGlExtensions(void) {
* set global gl-related variables to their default values * set global gl-related variables to their default values
*/ */
static int initGl(uint32_t d_width, uint32_t d_height) { static int initGl(uint32_t d_width, uint32_t d_height) {
int scale_type = mipmap_gen ? GL_LINEAR_MIPMAP_NEAREST : GL_LINEAR;
autodetectGlExtensions(); autodetectGlExtensions();
texSize(image_width, image_height, &texture_width, &texture_height); texSize(image_width, image_height, &texture_width, &texture_height);
@ -483,29 +488,34 @@ static int initGl(uint32_t d_width, uint32_t d_height) {
BindTexture(GL_TEXTURE_3D, default_texs[i + 14]); BindTexture(GL_TEXTURE_3D, default_texs[i + 14]);
} }
ActiveTexture(GL_TEXTURE1); ActiveTexture(GL_TEXTURE1);
glCreateClearTex(gl_target, gl_texfmt, gl_format, gl_type, GL_LINEAR, glCreateClearTex(gl_target, gl_texfmt, gl_format, gl_type, scale_type,
texture_width / 2, texture_height / 2, 128); texture_width / 2, texture_height / 2, 128);
if (mipmap_gen)
TexParameteri(gl_target, GL_GENERATE_MIPMAP, GL_TRUE);
ActiveTexture(GL_TEXTURE2); ActiveTexture(GL_TEXTURE2);
glCreateClearTex(gl_target, gl_texfmt, gl_format, gl_type, GL_LINEAR, glCreateClearTex(gl_target, gl_texfmt, gl_format, gl_type, scale_type,
texture_width / 2, texture_height / 2, 128); texture_width / 2, texture_height / 2, 128);
switch (use_yuv) { if (mipmap_gen)
case YUV_CONVERSION_FRAGMENT_LOOKUP: TexParameteri(gl_target, GL_GENERATE_MIPMAP, GL_TRUE);
case YUV_CONVERSION_FRAGMENT_POW:
case YUV_CONVERSION_FRAGMENT:
if (!GenPrograms || !BindProgram) {
mp_msg(MSGT_VO, MSGL_ERR, "[gl] fragment program functions missing!\n");
break;
}
GenPrograms(1, &fragprog);
BindProgram(GL_FRAGMENT_PROGRAM, fragprog);
break;
}
ActiveTexture(GL_TEXTURE0); ActiveTexture(GL_TEXTURE0);
BindTexture(gl_target, 0); BindTexture(gl_target, 0);
}
if (image_format == IMGFMT_YV12 || custom_prog)
{
if ((MASK_NOT_COMBINERS & (1 << use_yuv)) || custom_prog) {
if (!GenPrograms || !BindProgram) {
mp_msg(MSGT_VO, MSGL_ERR, "[gl] fragment program functions missing!\n");
} else {
GenPrograms(1, &fragprog);
BindProgram(GL_FRAGMENT_PROGRAM, fragprog);
}
}
update_yuvconv(); update_yuvconv();
} }
glCreateClearTex(gl_target, gl_texfmt, gl_format, gl_type, GL_LINEAR, glCreateClearTex(gl_target, gl_texfmt, gl_format, gl_type, scale_type,
texture_width, texture_height, 0); texture_width, texture_height, 0);
if (mipmap_gen)
TexParameteri(gl_target, GL_GENERATE_MIPMAP, GL_TRUE);
resize(d_width, d_height); resize(d_width, d_height);
@ -658,14 +668,14 @@ static void do_render(void) {
// BindTexture(GL_TEXTURE_2D, texture_id); // BindTexture(GL_TEXTURE_2D, texture_id);
Color3f(1,1,1); Color3f(1,1,1);
if (image_format == IMGFMT_YV12) if (image_format == IMGFMT_YV12 || custom_prog)
glEnableYUVConversion(gl_target, yuvconvtype); glEnableYUVConversion(gl_target, yuvconvtype);
glDrawTex(0, 0, image_width, image_height, glDrawTex(0, 0, image_width, image_height,
0, 0, image_width, image_height, 0, 0, image_width, image_height,
texture_width, texture_height, texture_width, texture_height,
use_rectangle == 1, image_format == IMGFMT_YV12, use_rectangle == 1, image_format == IMGFMT_YV12,
mpi_flipped ^ vo_flipped); mpi_flipped ^ vo_flipped);
if (image_format == IMGFMT_YV12) if (image_format == IMGFMT_YV12 || custom_prog)
glDisableYUVConversion(gl_target, yuvconvtype); glDisableYUVConversion(gl_target, yuvconvtype);
} }
@ -982,6 +992,7 @@ static const opt_t subopts[] = {
{"customtex", OPT_ARG_MSTRZ,&custom_tex, NULL}, {"customtex", OPT_ARG_MSTRZ,&custom_tex, NULL},
{"customtlin", OPT_ARG_BOOL, &custom_tlin, NULL}, {"customtlin", OPT_ARG_BOOL, &custom_tlin, NULL},
{"customtrect", OPT_ARG_BOOL, &custom_trect, NULL}, {"customtrect", OPT_ARG_BOOL, &custom_trect, NULL},
{"mipmapgen", OPT_ARG_BOOL, &mipmap_gen, NULL},
{"osdcolor", OPT_ARG_INT, &osd_color, NULL}, {"osdcolor", OPT_ARG_INT, &osd_color, NULL},
{NULL} {NULL}
}; };
@ -1013,6 +1024,7 @@ static int preinit(const char *arg)
custom_tex = NULL; custom_tex = NULL;
custom_tlin = 1; custom_tlin = 1;
custom_trect = 0; custom_trect = 0;
mipmap_gen = 0;
osd_color = 0xffffff; osd_color = 0xffffff;
if (subopt_parse(arg, subopts) != 0) { if (subopt_parse(arg, subopts) != 0) {
mp_msg(MSGT_VO, MSGL_FATAL, mp_msg(MSGT_VO, MSGL_FATAL,
@ -1043,6 +1055,8 @@ static int preinit(const char *arg)
" Interval in displayed frames between to buffer swaps.\n" " Interval in displayed frames between to buffer swaps.\n"
" 1 is equivalent to enable VSYNC, 0 to disable VSYNC.\n" " 1 is equivalent to enable VSYNC, 0 to disable VSYNC.\n"
" Requires GLX_SGI_swap_control support to work.\n" " Requires GLX_SGI_swap_control support to work.\n"
" ycbcr\n"
" also try to use the GL_MESA_ycbcr_texture extension\n"
" yuv=<n>\n" " yuv=<n>\n"
" 0: use software YUV to RGB conversion.\n" " 0: use software YUV to RGB conversion.\n"
" 1: use register combiners (nVidia only, for older cards).\n" " 1: use register combiners (nVidia only, for older cards).\n"
@ -1070,10 +1084,10 @@ static int preinit(const char *arg)
" use GL_NEAREST scaling for customtex texture\n" " use GL_NEAREST scaling for customtex texture\n"
" customtrect\n" " customtrect\n"
" use texture_rectangle for customtex texture\n" " use texture_rectangle for customtex texture\n"
" mipmapgen\n"
" generate mipmaps for the video image (use with TXB in customprog)\n"
" osdcolor=<0xAARRGGBB>\n" " osdcolor=<0xAARRGGBB>\n"
" use the given color for the OSD\n" " use the given color for the OSD\n"
" ycbcr\n"
" also try to use the GL_MESA_ycbcr_texture extension\n"
"\n" ); "\n" );
return -1; return -1;
} }
@ -1092,10 +1106,6 @@ static int preinit(const char *arg)
return 0; return 0;
} }
#define MASK_ALL_YUV (~(1 << YUV_CONVERSION_NONE))
#define MASK_NOT_COMBINERS (~((1 << YUV_CONVERSION_NONE) | (1 << YUV_CONVERSION_COMBINERS) | (1 << YUV_CONVERSION_COMBINERS_ATI)))
#define MASK_GAMMA_SUPPORT (MASK_NOT_COMBINERS & ~(1 << YUV_CONVERSION_FRAGMENT))
static const struct { static const struct {
const char *name; const char *name;
int *value; int *value;

View File

@ -25,266 +25,196 @@
BEGIN { BEGIN {
if(ARGC != 3) { if (ARGC != 3) {
# check for arguments: # check for arguments:
print "Usage ./pci_db2c.awk pci.db (and make sure pci.db file exists first)"; print "Usage ./pci_db2c.awk pci.db (and make sure pci.db file exists first)";
exit(1); exit(1);
} }
in_file = ARGV[1]; in_file = ARGV[1];
with_pci_db = ARGV[2]; with_pci_db = ARGV[2];
vendor_file = "vidix/pci_vendors.h"; dev_ids_c_file = "vidix/pci_dev_ids.c"
ids_file = "vidix/pci_ids.h" ids_h_file = "vidix/pci_ids.h"
name_file = "vidix/pci_names.c" vendor_ids_h_file = "vidix/pci_vendor_ids.h"
name_h_file = "vidix/pci_names.h" vendors_h_file = "vidix/pci_vendors.h";
dev_ids_file = "vidix/pci_dev_ids.c" # print out head lines
line=0; print_head(vendors_h_file);
# print out head lines print_head(ids_h_file);
print_head(vendor_file); print_head(vendor_ids_h_file);
print_head(ids_file); print_head(dev_ids_c_file);
print_head(name_file); print "#include <stdlib.h>" > dev_ids_c_file;
print_head(name_h_file); print "#include \"pci_names.h\"" > dev_ids_c_file;
print_head(dev_ids_file);
print_includes(dev_ids_file);
print "#ifndef MPLAYER_PCI_VENDORS_H" >vendor_file
print "#define MPLAYER_PCI_VENDORS_H">vendor_file
print "" >vendor_file
print "#ifndef MPLAYER_PCI_IDS_H" >ids_file
print "#define MPLAYER_PCI_IDS_H">ids_file
print "" >ids_file
print "#include \"pci_vendors.h\"">ids_file
print "" >ids_file
print "#ifndef MPLAYER_PCI_NAMES_H" >name_h_file print_guards_start(vendors_h_file);
print "#define MPLAYER_PCI_NAMES_H">name_h_file print_guards_start(ids_h_file);
print "" >name_h_file print "#include \"pci_vendors.h\"" > ids_h_file
print_name_struct(name_h_file); print "" > ids_h_file
print "#include <stddef.h>">name_file
print "#include \"pci_names.h\"">name_file print "#include <stddef.h>" > vendor_ids_h_file
print "#include \"pci_names.h\"" > vendor_ids_h_file
if (with_pci_db) { if (with_pci_db) {
print "#include \"pci_dev_ids.c\"">name_file print "#include \"pci_dev_ids.c\"" > vendor_ids_h_file
print "">name_file print "" > vendor_ids_h_file
print "static struct vendor_id_s vendor_ids[] = {">name_file print "static struct vendor_id_s vendor_ids[] = {" > vendor_ids_h_file
} }
first_pass=1; first_pass = 1;
init_name_db(); init_name_db();
while(getline <in_file) while (getline < in_file) {
{ n = split($0, field, "[\t]");
# count up lines name_field = kill_double_quoting(field[3])
line++; if (field[1] == "v" && length(field[3]) > 0 && field[4] == "0") {
n=split($0, field, "[\t]"); init_device_db()
name_field = kill_double_quoting(field[3]) svend_name = get_short_vendor_name(field[3])
if(field[1] == "v" && length(field[3])>0 && field[4] == "0") printf("#define VENDOR_%s\t", svend_name) > vendors_h_file;
{ if (length(svend_name) < 9) printf("\t") > vendors_h_file;
init_device_db() printf("0x%s /*%s*/\n", field[2], name_field) > vendors_h_file;
svend_name = get_short_vendor_name(field[3]) if (with_pci_db) printf("{ 0x%s, \"%s\", dev_lst_%s },\n", field[2], name_field, field[2]) > vendor_ids_h_file;
printf("#define VENDOR_%s\t", svend_name) >vendor_file; printf("/* Vendor: %s: %s */\n", field[2], name_field) > ids_h_file
if(length(svend_name) < 9) printf("\t") >vendor_file; if (first_pass == 1) first_pass = 0;
printf("0x%s /*%s*/\n",field[2], name_field) >vendor_file; else print "{ 0xFFFF, NULL }\n};" > dev_ids_c_file;
if (with_pci_db) printf("{ 0x%s, \"%s\", dev_lst_%s },\n",field[2], name_field, field[2]) >name_file; printf("static const struct device_id_s dev_lst_%s[] = {\n", field[2])> dev_ids_c_file
printf("/* Vendor: %s: %s */\n", field[2], name_field) > ids_file }
if(first_pass == 1) { first_pass=0; } if (field[1] == "d" && length(field[3]) > 0 && field[4] == "0") {
else { print "{ 0xFFFF, NULL }\n};" >dev_ids_file; } sdev_name = get_short_device_name(field[3])
printf("static const struct device_id_s dev_lst_%s[]={\n", field[2])>dev_ids_file full_name = sprintf("#define DEVICE_%s_%s", svend_name, sdev_name);
} printf("%s\t", full_name) > ids_h_file
if(field[1] == "d" && length(field[3])>0 && field[4] == "0") if (length(full_name) < 9) printf("\t") > ids_h_file;
{ if (length(full_name) < 17) printf("\t") > ids_h_file;
sdev_name = get_short_device_name(field[3]) if (length(full_name) < 25) printf("\t") > ids_h_file;
full_name = sprintf("#define DEVICE_%s_%s", svend_name, sdev_name); if (length(full_name) < 32) printf("\t") > ids_h_file;
printf("%s\t", full_name) >ids_file if (length(full_name) < 40) printf("\t") > ids_h_file;
if(length(full_name) < 9) printf("\t") >ids_file; if (length(full_name) < 48) printf("\t") > ids_h_file;
if(length(full_name) < 17) printf("\t") >ids_file; printf("0x%s /*%s*/\n", substr(field[2], 5), name_field) > ids_h_file
if(length(full_name) < 25) printf("\t") >ids_file; printf("{ 0x%s, \"%s\" },\n", substr(field[2], 5), name_field) > dev_ids_c_file
if(length(full_name) < 32) printf("\t") >ids_file; }
if(length(full_name) < 40) printf("\t") >ids_file; if (field[1] == "s" && length(field[3]) > 0 && field[4] == "0") {
if(length(full_name) < 48) printf("\t") >ids_file; subdev_name = get_short_subdevice_name(field[3])
printf("0x%s /*%s*/\n", substr(field[2], 5), name_field) >ids_file full_name = sprintf("#define SUBDEVICE_%s_%s", svend_name, subdev_name)
printf("{ 0x%s, \"%s\" },\n", substr(field[2], 5), name_field) >dev_ids_file printf("\t%s\t", full_name) > ids_h_file
} if (length(full_name) < 9) printf("\t") > ids_h_file;
if(field[1] == "s" && length(field[3])>0 && field[4] == "0") if (length(full_name) < 17) printf("\t") > ids_h_file;
{ if (length(full_name) < 25) printf("\t") > ids_h_file;
subdev_name = get_short_subdevice_name(field[3]) if (length(full_name) < 32) printf("\t") > ids_h_file;
full_name = sprintf("#define SUBDEVICE_%s_%s", svend_name, subdev_name) if (length(full_name) < 40) printf("\t") > ids_h_file;
printf("\t%s\t", full_name) >ids_file printf("0x%s /*%s*/\n", substr(field[2], 9), name_field) > ids_h_file
if(length(full_name) < 9) printf("\t") >ids_file; }
if(length(full_name) < 17) printf("\t") >ids_file;
if(length(full_name) < 25) printf("\t") >ids_file;
if(length(full_name) < 32) printf("\t") >ids_file;
if(length(full_name) < 40) printf("\t") >ids_file;
printf("0x%s /*%s*/\n", substr(field[2], 9), name_field) >ids_file
}
} }
#print "Total lines parsed:", line; print_guards_end(vendors_h_file);
print "">vendor_file print_guards_end(ids_h_file);
print "#endif /* MPLAYER_PCI_VENDORS_H */">vendor_file if (with_pci_db) print "};" > vendor_ids_h_file
print "">ids_file print "{ 0xFFFF, NULL }" > dev_ids_c_file;
print "#endif /* MPLAYER_PCI_IDS_H */">ids_file print "};" > dev_ids_c_file
print "">name_h_file
print "#endif /* MPLAYER_PCI_NAMES_H */">name_h_file
if (with_pci_db) print "};">name_file
print "{ 0xFFFF, NULL }" >dev_ids_file;
print "};">dev_ids_file
print_func_bodies(name_file);
} }
function print_includes(out_file) function construct_guard_name(out_file)
{ {
print "#include <stdlib.h>" >out_file; split(out_file, path_components, "/");
print "#include \"pci_names.h\"" >out_file; sub(".h","_h", path_components[2]);
return; return "MPLAYER_" toupper(path_components[2]);
} }
function print_head( out_file) function print_guards_start(out_file)
{ {
print "/*" >out_file; guard_name = construct_guard_name(out_file);
printf(" * File: %s\n", out_file) >out_file; printf("#ifndef %s\n", guard_name) > out_file
printf(" * This file was generated automatically. Don't modify it.\n") >out_file; printf("#define %s\n", guard_name) > out_file
print "*/" >out_file; print "" > out_file
return;
} }
function print_name_struct(out_file) function print_guards_end(out_file)
{ {
print "">out_file guard_name = construct_guard_name(out_file);
print "struct device_id_s" >out_file print "" > out_file
print "{" >out_file printf("#endif /* %s */\n", guard_name) > out_file
print "\tunsigned short\tid;" >out_file
print "\tconst char *\tname;" >out_file
print "};" >out_file
print "">out_file
print "struct vendor_id_s" >out_file
print "{" >out_file
print "\tunsigned short\tid;" >out_file
print "\tconst char *\tname;" >out_file
print "\tconst struct device_id_s *\tdev_list;" >out_file
print "};" >out_file
print "const char *pci_vendor_name(unsigned short id);">out_file
print "const char *pci_device_name(unsigned short vendor_id, unsigned short device_id);">out_file
print "">out_file
return
} }
function print_func_bodies(out_file) function print_head(out_file)
{ {
print "">out_file printf("/* File: %s\n", out_file) > out_file;
print "const char *pci_vendor_name(unsigned short id)" >out_file printf(" * This file was generated automatically. Don't modify it. */\n") > out_file;
print "{" >out_file print "" > out_file
if (with_pci_db) {
print " unsigned i;" >out_file
print " for(i=0;i<sizeof(vendor_ids)/sizeof(struct vendor_id_s);i++)">out_file
print " {" >out_file
print "\tif(vendor_ids[i].id == id) return vendor_ids[i].name;" >out_file
print " }" >out_file
}
print " return NULL;" >out_file
print "}">out_file
print "" >out_file
print "const char *pci_device_name(unsigned short vendor_id, unsigned short device_id)" >out_file
print "{" >out_file
if (with_pci_db) {
print " unsigned i, j;" >out_file
print " for(i=0;i<sizeof(vendor_ids)/sizeof(struct vendor_id_s);i++)">out_file
print " {" >out_file
print "\tif(vendor_ids[i].id == vendor_id)" >out_file
print "\t{" >out_file
print "\t j=0;" >out_file
print "\t while(vendor_ids[i].dev_list[j].id != 0xFFFF)" >out_file
print "\t {">out_file
print "\t\tif(vendor_ids[i].dev_list[j].id == device_id) return vendor_ids[i].dev_list[j].name;">out_file
print "\t\tj++;">out_file
print "\t };">out_file
print "\t break;" >out_file
print "\t}" >out_file
print " }" >out_file
}
print " return NULL;">out_file
print "}">out_file
return
} }
function kill_double_quoting(fld) function kill_double_quoting(fld)
{ {
n=split(fld,phrases, "[\"]"); n = split(fld, phrases, "[\"]");
new_fld = phrases[1] new_fld = phrases[1]
for(i=2;i<=n;i++) new_fld = sprintf("%s\\\"%s", new_fld, phrases[i]) for (i = 2; i <= n; i++) new_fld = sprintf("%s\\\"%s", new_fld, phrases[i])
return new_fld return new_fld
} }
function init_name_db() function init_name_db()
{ {
vendor_names[1]="" vendor_names[1] = ""
} }
function init_device_db() function init_device_db()
{ {
# delete device_names # delete device_names
for( i in device_names ) delete device_names[i]; for (i in device_names) delete device_names[i];
device_names[1]="" device_names[1] = ""
# delete subdevice_names # delete subdevice_names
for( i in subdevice_names ) delete subdevice_names[i]; for (i in subdevice_names) delete subdevice_names[i];
subdevice_names[1] = "" subdevice_names[1] = ""
} }
function get_short_vendor_name(from) function get_short_vendor_name(from)
{ {
n=split(from, name, "[ ]"); n = split(from, name, "[ ]");
new_name = toupper(name[1]); new_name = toupper(name[1]);
if(length(new_name)<3) new_name = sprintf("%s_%s", new_name, toupper(name[2])); if (length(new_name) < 3) new_name = sprintf("%s_%s", new_name, toupper(name[2]));
n=split(new_name, name, "[^0-9A-Za-z]"); n = split(new_name, name, "[^0-9A-Za-z]");
svendor = name[1]; svendor = name[1];
for(i=2;i<=n;i++) svendor=sprintf("%s%s%s", svendor, length(name[i])?"_":"", name[i]); for (i = 2; i <= n; i++) svendor = sprintf("%s%s%s", svendor, length(name[i]) ? "_" : "", name[i]);
new_name = svendor; new_name = svendor;
vend_suffix = 2; vend_suffix = 2;
# check for unique # check for unique
while(new_name in vendor_names) while (new_name in vendor_names) {
{ new_name = sprintf("%s%u", svendor, vend_suffix)
new_name = sprintf("%s%u", svendor, vend_suffix) vend_suffix = vend_suffix + 1;
vend_suffix = vend_suffix + 1; }
} # Add new name in array of vendor's names
# Add new name in array of vendor's names vendor_names[new_name] = new_name
vendor_names[new_name] = new_name return new_name;
return new_name;
} }
function get_short_device_name(from_name) function get_short_device_name(from_name)
{ {
n=split(from_name, name, "[ ]"); n = split(from_name, name, "[ ]");
new_name = toupper(name[1]); new_name = toupper(name[1]);
if(length(name[2])) new_name = sprintf("%s_%s", new_name, toupper(name[2])); if (length(name[2])) new_name = sprintf("%s_%s", new_name, toupper(name[2]));
if(length(name[3])) new_name = sprintf("%s_%s", new_name, toupper(name[3])); if (length(name[3])) new_name = sprintf("%s_%s", new_name, toupper(name[3]));
n=split(new_name, name, "[^0-9A-Za-z]"); n = split(new_name, name, "[^0-9A-Za-z]");
sdevice = name[1]; sdevice = name[1];
for(i=2;i<=n;i++) sdevice=sprintf("%s%s%s", sdevice, length(name[i])?"_":"", name[i]); for (i = 2; i <= n; i++) sdevice = sprintf("%s%s%s", sdevice, length(name[i]) ? "_" : "", name[i]);
new_name = sdevice; new_name = sdevice;
dev_suffix = 2; dev_suffix = 2;
# check for unique # check for unique
while(new_name in device_names) while (new_name in device_names) {
{ new_name = sprintf("%s%u", sdevice, dev_suffix)
new_name = sprintf("%s%u", sdevice, dev_suffix) dev_suffix = dev_suffix + 1;
dev_suffix = dev_suffix + 1; }
} # Add new name in array of device names
# Add new name in array of device names device_names[new_name] = new_name
device_names[new_name] = new_name return new_name;
return new_name;
} }
function get_short_subdevice_name(from_name) function get_short_subdevice_name(from_name)
{ {
n=split(from_name, name, "[ ]"); n = split(from_name, name, "[ ]");
new_name = toupper(name[1]); new_name = toupper(name[1]);
if(length(name[2])) new_name = sprintf("%s_%s", new_name, toupper(name[2])); if (length(name[2])) new_name = sprintf("%s_%s", new_name, toupper(name[2]));
if(length(name[3])) new_name = sprintf("%s_%s", new_name, toupper(name[3])); if (length(name[3])) new_name = sprintf("%s_%s", new_name, toupper(name[3]));
n=split(new_name, name, "[^0-9A-Za-z]"); n = split(new_name, name, "[^0-9A-Za-z]");
ssdevice = name[1]; ssdevice = name[1];
for(i=2;i<=n;i++) ssdevice=sprintf("%s%s%s", ssdevice, length(name[i])?"_":"", name[i]); for (i = 2; i <= n; i++) ssdevice = sprintf("%s%s%s", ssdevice, length(name[i]) ? "_" : "", name[i]);
new_name = ssdevice; new_name = ssdevice;
sdev_suffix = 2; sdev_suffix = 2;
# check for unique # check for unique
while(new_name in subdevice_names) while (new_name in subdevice_names) {
{ new_name = sprintf("%s%u", ssdevice, sdev_suffix)
new_name = sprintf("%s%u", ssdevice, sdev_suffix) sdev_suffix = sdev_suffix + 1;
sdev_suffix = sdev_suffix + 1; }
} # Add new name in array of subdevice names
# Add new name in array of subdevice names subdevice_names[new_name] = new_name
subdevice_names[new_name] = new_name return new_name;
return new_name;
} }

50
vidix/pci_names.c Normal file
View File

@ -0,0 +1,50 @@
/*
* VIDIX - VIDeo Interface for *niX.
*
* This file is part of MPlayer.
*
* MPlayer is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* MPlayer is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with MPlayer; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <stddef.h>
#include "pci_names.h"
#include "pci_vendor_ids.h"
const char *pci_vendor_name(unsigned short id)
{
unsigned i;
for (i = 0; i < sizeof(vendor_ids) / sizeof(struct vendor_id_s); i++) {
if (vendor_ids[i].id == id)
return vendor_ids[i].name;
}
return NULL;
}
const char *pci_device_name(unsigned short vendor_id, unsigned short device_id)
{
unsigned i, j;
for (i = 0; i < sizeof(vendor_ids) / sizeof(struct vendor_id_s); i++) {
if (vendor_ids[i].id == vendor_id) {
j = 0;
while (vendor_ids[i].dev_list[j].id != 0xFFFF) {
if (vendor_ids[i].dev_list[j].id == device_id)
return vendor_ids[i].dev_list[j].name;
j++;
};
break;
}
}
return NULL;
}

38
vidix/pci_names.h Normal file
View File

@ -0,0 +1,38 @@
/*
* VIDIX - VIDeo Interface for *niX.
*
* This file is part of MPlayer.
*
* MPlayer is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* MPlayer is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with MPlayer; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPLAYER_PCI_NAMES_H
#define MPLAYER_PCI_NAMES_H
struct device_id_s {
unsigned short id;
const char *name;
};
struct vendor_id_s {
unsigned short id;
const char *name;
const struct device_id_s *dev_list;
};
const char *pci_vendor_name(unsigned short id);
const char *pci_device_name(unsigned short vendor_id,
unsigned short device_id);
#endif /* MPLAYER_PCI_NAMES_H */