Compare commits
14 Commits
00fc91a451
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ffbc4a13d4 | ||
|
|
b372e0428d | ||
|
|
4a3408633d | ||
|
|
4ed0ab33b9 | ||
|
|
c9154c923b | ||
|
|
9defba34c6 | ||
|
|
298c6e1d1e | ||
|
|
86f3f2e3e7 | ||
|
|
09453280b5 | ||
|
|
e7a76a8687 | ||
|
|
46fd99a74a | ||
|
|
a12010fcd8 | ||
|
|
b3ee8a0ccd | ||
|
|
7ac8a917a4 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -43,6 +43,8 @@
|
|||||||
*.idb
|
*.idb
|
||||||
*.pdb
|
*.pdb
|
||||||
|
|
||||||
|
core
|
||||||
|
|
||||||
# Kernel Module Compile Results
|
# Kernel Module Compile Results
|
||||||
*.mod*
|
*.mod*
|
||||||
*.cmd
|
*.cmd
|
||||||
|
|||||||
3
Ecoute/.gitignore
vendored
3
Ecoute/.gitignore
vendored
@@ -6,3 +6,6 @@ ecoute
|
|||||||
*.flac
|
*.flac
|
||||||
*.mp3
|
*.mp3
|
||||||
*.au
|
*.au
|
||||||
|
*.opus
|
||||||
|
|
||||||
|
toto
|
||||||
|
|||||||
@@ -20,14 +20,20 @@ qui manquent.
|
|||||||
## Compilation
|
## Compilation
|
||||||
|
|
||||||
Il faut installer les paquets
|
Il faut installer les paquets
|
||||||
`libao-dev` et `libsndfile-dev` avoir de pouvoir
|
`libao-dev`, `libogg-dev`, et `libsndfile-dev` avoir de
|
||||||
générer le moindre exécutable.
|
pouvoir générer le moindre exécutable.
|
||||||
Les machins *ncurses* sont censé être là.
|
Les machins *ncurses* sont censé être là, sinon
|
||||||
|
c'est `ncurses-dev` qui manque.
|
||||||
|
|
||||||
Ensuite, un tout simple
|
Ensuite, un tout simple
|
||||||
run de `make` fera le travail.
|
run de `make` fera le travail.
|
||||||
Dans le [Makefile](Makefile), vous avez quelques options à
|
Dans le [Makefile](Makefile), vous avez quelques options à
|
||||||
régler, genre le `DEBUG_LEVEL` si vous ne voulez pas
|
régler, genre le `DEBUG_LEVEL` si vous ne voulez pas
|
||||||
submerger votre stderr.
|
submerger votre stderr.
|
||||||
|
Mais si vous avez activé cette friture, vous
|
||||||
|
lancer le logiciel par `./ecoute 2> tracelog` dans un xterm,
|
||||||
|
puis vous lancez `tail -f tracelog` dans un autre xterm
|
||||||
|
pour le voir raconter sa vie. *Astuce !*
|
||||||
|
|
||||||
## Utilisation
|
## Utilisation
|
||||||
|
|
||||||
@@ -42,8 +48,11 @@ Il y a des fonctions de tri (nom, taille, ...) par
|
|||||||
les touches dédiées (voir l'aide).
|
les touches dédiées (voir l'aide).
|
||||||
En pressant **`I`** des informations diverses et
|
En pressant **`I`** des informations diverses et
|
||||||
souvent inutiles sur le fichier pointé.
|
souvent inutiles sur le fichier pointé.
|
||||||
Et le **`D`** propose un dump hexadécimal et ascii.
|
Le **`D`** propose un dump hexadécimal et ascii qui
|
||||||
Il y a de quoi faire.
|
va être grandement amélioré dans les jours qui viennent.
|
||||||
|
Et enfin avec **`$`**, vous aurez quelques informations techniques
|
||||||
|
sur les trucs techniques.
|
||||||
|
|
||||||
|
|
||||||
## Pour la suite ?
|
## Pour la suite ?
|
||||||
|
|
||||||
@@ -53,7 +62,11 @@ faut d'abord factoriser la fonction de scrutation du clavier
|
|||||||
pendant la lecture du son, et ensuite la brancher dans les
|
pendant la lecture du son, et ensuite la brancher dans les
|
||||||
différents modules.
|
différents modules.
|
||||||
|
|
||||||
Deuxième étape : Implémenter une fonction bien *molly-guarded* pour pouvoir effacer un fichier.
|
Deuxième étape : Implémenter une fonction bien *molly-guarded* pour pouvoir
|
||||||
|
effacer un fichier sans le moindre risque d'erreur.
|
||||||
|
|
||||||
|
Troisième étape : Ajouter un controle du volume sonore, ce qui implique
|
||||||
|
de replonger dans `alsa` ou la doc de la libao...
|
||||||
|
|
||||||
tTh.
|
tTh.
|
||||||
|
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
|
|
||||||
4 Feb 2005 : this is a new project. I want a console player for ogg/wav
|
|
||||||
audiofiles, and may be ogg & speex.
|
|
||||||
who suit my needs: standalone, lowcost, easytouse.
|
|
||||||
|
|
||||||
You need libsndfile and libao installed.
|
|
||||||
|
|
||||||
I DON'T know the technic for playing .ogg files :(
|
|
||||||
|
|
||||||
---------------------------------------------------------------------------
|
|
||||||
TODO:
|
|
||||||
- build the ogg player *now*
|
|
||||||
- rename some files, because the 'info displayer' go in the
|
|
||||||
same file as the player.
|
|
||||||
- write a better english.
|
|
||||||
- build a function for detecting sound file with a bad .EXT
|
|
||||||
|
|
||||||
---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
- Thierry 'tTh' Boudet -
|
|
||||||
@@ -8,11 +8,12 @@
|
|||||||
#
|
#
|
||||||
#----------------------------------------------------------------
|
#----------------------------------------------------------------
|
||||||
|
|
||||||
VERSION=0.0038
|
VERSION=0.0040
|
||||||
|
|
||||||
TEKFLAG= -DDEBUG_LEVEL=0 -g
|
TEKFLAG = -DDEBUG_LEVEL=1 -g
|
||||||
CFLAGS=-Wall -Wextra -ansi $(TEKFLAG) -DVERSION=\"$(VERSION)\"
|
CFLAGS = -std=c11 -Wall -Wextra -ansi -Wlogical-op \
|
||||||
BIBS=-lncurses -lao -lsndfile -logg
|
$(TEKFLAG) -DVERSION=\"$(VERSION)\"
|
||||||
|
BIBS = -lncurses -lao -lsndfile -logg
|
||||||
|
|
||||||
#---------------------------------------------------------
|
#---------------------------------------------------------
|
||||||
|
|
||||||
@@ -33,12 +34,13 @@ playau.o: playau.c ecoute.h Makefile
|
|||||||
playogg.o: playogg.c ecoute.h Makefile
|
playogg.o: playogg.c ecoute.h Makefile
|
||||||
playspeex.o: playspeex.c ecoute.h Makefile
|
playspeex.o: playspeex.c ecoute.h Makefile
|
||||||
playflac.o: playflac.c ecoute.h Makefile
|
playflac.o: playflac.c ecoute.h Makefile
|
||||||
|
rmfile.o: rmfile.c ecoute.h Makefile
|
||||||
|
|
||||||
OBJ=main.o ecran.o playnote.o playwav.o playogg.o fonctions.o interactive.o \
|
OBJ=main.o ecran.o playnote.o playwav.o playogg.o fonctions.o interactive.o \
|
||||||
dump.o playau.o playspeex.o playflac.o magic.o ifao.o
|
dump.o playau.o playspeex.o playflac.o magic.o ifao.o rmfile.o
|
||||||
|
|
||||||
ecoute: $(OBJ)
|
ecoute: $(OBJ)
|
||||||
gcc $(TEKFLAG) $(OBJ) $(BIBS) -o ecoute
|
gcc $(CFLAGS) $(OBJ) $(BIBS) -o ecoute
|
||||||
|
|
||||||
#---------------------------------------------------------
|
#---------------------------------------------------------
|
||||||
# services targets
|
# services targets
|
||||||
13
Ecoute/src/README.md
Normal file
13
Ecoute/src/README.md
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
## dump.c
|
||||||
|
## ecran.c
|
||||||
|
## fonctions.c
|
||||||
|
## ifao.c
|
||||||
|
## interactive.c
|
||||||
|
## magic.c
|
||||||
|
## main.c
|
||||||
|
## playau.c
|
||||||
|
## playflac.c
|
||||||
|
## playnote.c
|
||||||
|
## playogg.c
|
||||||
|
## playspeex.c
|
||||||
|
## playwav.c
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
/*==------------------------------------------------------------------==*/
|
/*==------------------------------------------------------------------==*/
|
||||||
#define T_BUFF_HEX (16*16)
|
#define T_BUFF_HEX (16*16)
|
||||||
|
|
||||||
int hexadump(char *fname, WINDOW *w)
|
static int hexadump(char *fname, WINDOW *w)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
unsigned char buffer[T_BUFF_HEX];
|
unsigned char buffer[T_BUFF_HEX];
|
||||||
@@ -25,24 +25,20 @@ char chaine[10], lettre;
|
|||||||
fprintf(stderr, "hexadump of %s\n", fname);
|
fprintf(stderr, "hexadump of %s\n", fname);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ( (fd=open(fname, O_RDONLY)) < 0 )
|
if ( (fd=open(fname, O_RDONLY)) < 0 ) {
|
||||||
{
|
|
||||||
mvwaddstr(w, 2, 2, "err open"); wrefresh(w);
|
mvwaddstr(w, 2, 2, "err open"); wrefresh(w);
|
||||||
getch();
|
getch();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( T_BUFF_HEX != read(fd, buffer, T_BUFF_HEX) )
|
if ( T_BUFF_HEX != read(fd, buffer, T_BUFF_HEX) ) {
|
||||||
{
|
|
||||||
mvwaddstr(w, 2, 2, "err read"); wrefresh(w);
|
mvwaddstr(w, 2, 2, "err read"); wrefresh(w);
|
||||||
getch();
|
getch();
|
||||||
}
|
}
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
for (lig=0; lig<16; lig++)
|
for (lig=0; lig<16; lig++) {
|
||||||
{
|
for (col=0; col<16; col++) {
|
||||||
for (col=0; col<16; col++)
|
|
||||||
{
|
|
||||||
idx = (lig*16) + col;
|
idx = (lig*16) + col;
|
||||||
sprintf(chaine, "%02x", buffer[idx]);
|
sprintf(chaine, "%02x", buffer[idx]);
|
||||||
mvwaddstr(w, lig+1, (col*3)+1, chaine);
|
mvwaddstr(w, lig+1, (col*3)+1, chaine);
|
||||||
@@ -64,7 +60,6 @@ return 0;
|
|||||||
int dump_this_file(char *fname, int flag)
|
int dump_this_file(char *fname, int flag)
|
||||||
{
|
{
|
||||||
WINDOW *popup;
|
WINDOW *popup;
|
||||||
int foo;
|
|
||||||
|
|
||||||
#if DEBUG_LEVEL
|
#if DEBUG_LEVEL
|
||||||
fprintf(stderr, ">> dump_this_file ( '%s' %d )\n", fname, flag);
|
fprintf(stderr, ">> dump_this_file ( '%s' %d )\n", fname, flag);
|
||||||
@@ -73,11 +68,11 @@ fprintf(stderr, ">> dump_this_file ( '%s' %d )\n", fname, flag);
|
|||||||
popup = newwin(18, 68, L_POPUP, C_POPUP);
|
popup = newwin(18, 68, L_POPUP, C_POPUP);
|
||||||
bordure(popup, 1);
|
bordure(popup, 1);
|
||||||
mvwaddstr(popup, 0, 2, "{ dump of ");
|
mvwaddstr(popup, 0, 2, "{ dump of ");
|
||||||
mvwaddstr(popup, 0, 13, fname);
|
mvwaddstr(popup, 0, 12, fname);
|
||||||
mvwaddstr(popup, 0, 13+strlen(fname), " }");
|
mvwaddstr(popup, 0, 12+strlen(fname), " }");
|
||||||
wrefresh(popup);
|
wrefresh(popup);
|
||||||
|
|
||||||
foo = hexadump(fname, popup);
|
(void)hexadump(fname, popup);
|
||||||
|
|
||||||
wrefresh(popup);
|
wrefresh(popup);
|
||||||
getch();
|
getch();
|
||||||
@@ -43,6 +43,8 @@ int fileselector(void);
|
|||||||
#define SON_OGG 20
|
#define SON_OGG 20
|
||||||
#define SON_SPEEX 21
|
#define SON_SPEEX 21
|
||||||
#define SON_FLAC 22
|
#define SON_FLAC 22
|
||||||
|
#define SON_OPUS 23
|
||||||
|
#define SON_MP3 24
|
||||||
#define SON_AU 128
|
#define SON_AU 128
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -95,6 +97,6 @@ int start_sound_output(int k);
|
|||||||
int stop_sound_output(int k);
|
int stop_sound_output(int k);
|
||||||
int infos_sound_output(char *title);
|
int infos_sound_output(char *title);
|
||||||
|
|
||||||
void infos_driver_son(void);
|
void infos_techniques(void);
|
||||||
|
|
||||||
/*==------------------------------------------------------------------==*/
|
/*==------------------------------------------------------------------==*/
|
||||||
@@ -6,9 +6,14 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define _POSIX_C_SOURCE 600L /* for fileno(3) */
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include <sys/select.h>
|
||||||
|
|
||||||
#include "ecoute.h"
|
#include "ecoute.h"
|
||||||
|
|
||||||
/*==------------------------------------------------------------------==*/
|
/*==------------------------------------------------------------------==*/
|
||||||
@@ -19,10 +24,8 @@ int couleur = 0;
|
|||||||
/*==------------------------------------------------------------------==*/
|
/*==------------------------------------------------------------------==*/
|
||||||
void bordure(WINDOW * w, int flag)
|
void bordure(WINDOW * w, int flag)
|
||||||
{
|
{
|
||||||
if (flag)
|
if (flag) box(w, 0, 0);
|
||||||
box(w, 0, 0);
|
else wborder(w, '|', '|', '-', '-', '+', '+', '+', '+');
|
||||||
else
|
|
||||||
wborder(w, '|', '|', '-', '-', '+', '+', '+', '+');
|
|
||||||
}
|
}
|
||||||
/*==------------------------------------------------------------------==*/
|
/*==------------------------------------------------------------------==*/
|
||||||
int alerte(char *texte, int flag)
|
int alerte(char *texte, int flag)
|
||||||
@@ -63,12 +66,16 @@ fprintf(stderr, "maxval %ld val %ld largeur %d curseur %d\n",
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
chaine[0] = '[', chaine[largeur] = ']', chaine[largeur+1] = '\0';
|
chaine[0] = '[', chaine[largeur] = ']', chaine[largeur+1] = '\0';
|
||||||
for (foo=1; foo<largeur; foo++)
|
for (foo=1; foo<largeur; foo++) {
|
||||||
{
|
if (type) {
|
||||||
if (foo<curseur)
|
if (foo<curseur) chaine[foo] = 'o';
|
||||||
chaine[foo] = 'o';
|
else chaine[foo] = '-';
|
||||||
else
|
}
|
||||||
chaine[foo] = '-';
|
else {
|
||||||
|
if (foo<curseur) chaine[foo] = '*';
|
||||||
|
else chaine[foo] = '.';
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
mvwaddstr(win, haut_win-3, 2, chaine);
|
mvwaddstr(win, haut_win-3, 2, chaine);
|
||||||
wrefresh(win);
|
wrefresh(win);
|
||||||
@@ -77,6 +84,42 @@ foo = 42;
|
|||||||
return foo;
|
return foo;
|
||||||
}
|
}
|
||||||
/*==------------------------------------------------------------------==*/
|
/*==------------------------------------------------------------------==*/
|
||||||
|
/*
|
||||||
|
* detection de la frappe d'une touche clavier -- remember kbhit() ?
|
||||||
|
*/
|
||||||
|
int is_a_key_hitted(void)
|
||||||
|
{
|
||||||
|
int fd,retv;
|
||||||
|
fd_set in_fds;
|
||||||
|
struct timeval tv;
|
||||||
|
|
||||||
|
fd = fileno(stdin);
|
||||||
|
#if DEBUG_LEVEL
|
||||||
|
fprintf(stderr, "%s: fileno -> %d\n", __func__, fd);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
FD_ZERO(&in_fds); FD_SET(fd, &in_fds);
|
||||||
|
tv.tv_sec = tv.tv_usec = 0;
|
||||||
|
|
||||||
|
retv = select(1, &in_fds, NULL, NULL, &tv);
|
||||||
|
#if DEBUG_LEVEL
|
||||||
|
fprintf(stderr, "%s: select -> %d\n", __func__, retv);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (-1 == retv) {
|
||||||
|
perror("select()");
|
||||||
|
}
|
||||||
|
else if (0 == retv) {
|
||||||
|
/* no key hit */
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
/* got a keypress */
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
/*==------------------------------------------------------------------==*/
|
||||||
void termine_ecran(void)
|
void termine_ecran(void)
|
||||||
{
|
{
|
||||||
endwin(); exit(0);
|
endwin(); exit(0);
|
||||||
@@ -91,8 +134,7 @@ fprintf(stderr, ">>> %s ( )\n", __func__);
|
|||||||
|
|
||||||
initscr();
|
initscr();
|
||||||
|
|
||||||
if (has_colors())
|
if (has_colors()) {
|
||||||
{
|
|
||||||
use_default_colors();
|
use_default_colors();
|
||||||
couleur = 1;
|
couleur = 1;
|
||||||
}
|
}
|
||||||
@@ -15,6 +15,7 @@ long taille_fichier(int fd)
|
|||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
int foo;
|
int foo;
|
||||||
|
|
||||||
foo = fstat(fd, &st);
|
foo = fstat(fd, &st);
|
||||||
if (foo) {
|
if (foo) {
|
||||||
perror("fonctions.c:18 fstat");
|
perror("fonctions.c:18 fstat");
|
||||||
@@ -27,14 +28,15 @@ struct un_type_de_fichier {
|
|||||||
char *extension;
|
char *extension;
|
||||||
int numtype;
|
int numtype;
|
||||||
char *descr;
|
char *descr;
|
||||||
} types_de_fichiers[] =
|
} types_de_fichiers[] = {
|
||||||
{
|
|
||||||
{ ".note", SON_NOTE, "tTh .note files" },
|
{ ".note", SON_NOTE, "tTh .note files" },
|
||||||
{ ".wav", SON_WAV, "Microsoft Wave" },
|
{ ".wav", SON_WAV, "Microsoft Wave" },
|
||||||
{ ".ogg", SON_OGG, "Xiph Ogg/Vorbis" },
|
{ ".ogg", SON_OGG, "Xiph Ogg/Vorbis" },
|
||||||
{ ".speex", SON_SPEEX, "Xiph Compressed speach" },
|
{ ".speex", SON_SPEEX, "Xiph Compressed speach" },
|
||||||
{ ".au", SON_AU, "Sun/NeXT audio data" },
|
{ ".au", SON_AU, "Sun/NeXT audio data" },
|
||||||
{ ".flac", SON_FLAC, "Free Lossless Audio Codec" },
|
{ ".flac", SON_FLAC, "Free Lossless Audio Codec" },
|
||||||
|
{ ".opus", SON_OPUS, "OPUS" },
|
||||||
|
{ ".mp3", SON_MP3, "mp3" },
|
||||||
};
|
};
|
||||||
#define NBR_TYPES \
|
#define NBR_TYPES \
|
||||||
(sizeof(types_de_fichiers)/sizeof(struct un_type_de_fichier))
|
(sizeof(types_de_fichiers)/sizeof(struct un_type_de_fichier))
|
||||||
@@ -55,12 +57,10 @@ int foo, len_nom, len_ext;
|
|||||||
fprintf(stderr, "type_du_fichier(%s)\n", nom);
|
fprintf(stderr, "type_du_fichier(%s)\n", nom);
|
||||||
#endif
|
#endif
|
||||||
len_nom = strlen(nom);
|
len_nom = strlen(nom);
|
||||||
for (foo=0; foo<NBR_TYPES; foo++)
|
for (foo=0; foo<(int)NBR_TYPES; foo++) {
|
||||||
{
|
|
||||||
len_ext = strlen(types_de_fichiers[foo].extension);
|
len_ext = strlen(types_de_fichiers[foo].extension);
|
||||||
if ( (len_nom > len_ext) &&
|
if ( (len_nom > len_ext) &&
|
||||||
!strcmp(nom+(len_nom-len_ext), types_de_fichiers[foo].extension) )
|
!strcmp(nom+(len_nom-len_ext), types_de_fichiers[foo].extension) ) {
|
||||||
{
|
|
||||||
#if DEBUG_LEVEL > 1
|
#if DEBUG_LEVEL > 1
|
||||||
fprintf(stderr, " found %s\n", types_de_fichiers[foo].descr);
|
fprintf(stderr, " found %s\n", types_de_fichiers[foo].descr);
|
||||||
#endif
|
#endif
|
||||||
@@ -78,11 +78,9 @@ char *type2ext(int type)
|
|||||||
{
|
{
|
||||||
int foo;
|
int foo;
|
||||||
|
|
||||||
if (type == SON_UNKNOW)
|
if (type == SON_UNKNOW) return "unknow";
|
||||||
return "unknow";
|
|
||||||
|
|
||||||
for (foo=0; foo<NBR_TYPES; foo++)
|
for (foo=0; foo<(int)NBR_TYPES; foo++) {
|
||||||
{
|
|
||||||
if (type==types_de_fichiers[foo].numtype)
|
if (type==types_de_fichiers[foo].numtype)
|
||||||
return (types_de_fichiers[foo].extension)+1;
|
return (types_de_fichiers[foo].extension)+1;
|
||||||
}
|
}
|
||||||
@@ -93,11 +91,9 @@ char *type2descr(int type)
|
|||||||
{
|
{
|
||||||
int foo;
|
int foo;
|
||||||
|
|
||||||
if (type == SON_UNKNOW)
|
if (type == SON_UNKNOW) return "unknow";
|
||||||
return "unknow";
|
|
||||||
|
|
||||||
for (foo=0; foo<NBR_TYPES; foo++)
|
for (foo=0; foo<(int)NBR_TYPES; foo++) {
|
||||||
{
|
|
||||||
if (type==types_de_fichiers[foo].numtype)
|
if (type==types_de_fichiers[foo].numtype)
|
||||||
return (types_de_fichiers[foo].descr);
|
return (types_de_fichiers[foo].descr);
|
||||||
}
|
}
|
||||||
@@ -179,7 +175,6 @@ int foo;
|
|||||||
WINDOW *popup;
|
WINDOW *popup;
|
||||||
char chaine[100];
|
char chaine[100];
|
||||||
struct stat st;
|
struct stat st;
|
||||||
long magicbits;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ncurses initial stuff
|
* ncurses initial stuff
|
||||||
@@ -197,27 +192,25 @@ wrefresh(popup);
|
|||||||
* filesystem infos
|
* filesystem infos
|
||||||
*/
|
*/
|
||||||
foo = stat(nom, &st);
|
foo = stat(nom, &st);
|
||||||
if (foo != 0)
|
if (foo != 0) {
|
||||||
{
|
mvwaddstr(popup, 2, 2, "hu ho, stat failed ?");
|
||||||
mvwaddstr(popup, 3, 2, "hu ho, stat failed ?");
|
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
sprintf(chaine, "owned by: user id %d, group id %d",
|
sprintf(chaine, "owned by: user id %d, group id %d",
|
||||||
st.st_uid, st.st_gid);
|
st.st_uid, st.st_gid);
|
||||||
mvwaddstr(popup, 3, 2, chaine);
|
mvwaddstr(popup, 2, 2, chaine);
|
||||||
sprintf(chaine, "size: %ld bytes or %ld MB.",
|
sprintf(chaine, "size: %ld bytes or %ld MB.",
|
||||||
st.st_size,
|
st.st_size,
|
||||||
1 + (st.st_size / (1024*1024)) );
|
1 + (st.st_size / (1024*1024)) );
|
||||||
mvwaddstr(popup, 4, 2, chaine);
|
mvwaddstr(popup, 3, 2, chaine);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* internals infos
|
* internals infos
|
||||||
*/
|
*/
|
||||||
sprintf(chaine, "magic_detect: %4d / ", type);
|
sprintf(chaine, "magic_detect: %4d / ", type);
|
||||||
mvwaddstr(popup, 8, 2, chaine);
|
mvwaddstr(popup, 6, 2, chaine);
|
||||||
mvwaddstr(popup, 8, 25, type2descr(type));
|
mvwaddstr(popup, 6, 25, type2descr(type));
|
||||||
wrefresh(popup);
|
wrefresh(popup);
|
||||||
getch();
|
getch();
|
||||||
|
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ao/ao.h>
|
#include <ao/ao.h>
|
||||||
|
#include <sndfile.h>
|
||||||
#include "ecoute.h"
|
#include "ecoute.h"
|
||||||
|
|
||||||
/*==------------------------------------------------------------------==*/
|
/*==------------------------------------------------------------------==*/
|
||||||
@@ -98,39 +98,24 @@ fprintf(stderr, " | is active ? %s\n", isactive ? "yes" : "no");
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
/*==------------------------------------------------------------------==*/
|
/*==------------------------------------------------------------------==*/
|
||||||
void infos_driver_son(void)
|
void infos_techniques(void)
|
||||||
{
|
{
|
||||||
int foo;
|
int foo;
|
||||||
WINDOW *popup;
|
WINDOW *popup;
|
||||||
|
char *cptr;
|
||||||
|
|
||||||
#if DEBUG_LEVEL
|
#if DEBUG_LEVEL
|
||||||
fprintf(stderr, ">>> %s ( )\n", __func__);
|
fprintf(stderr, ">>> %s ( )\n", __func__);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define VID_INV 0
|
|
||||||
|
|
||||||
popup = newwin(12, 60, L_POPUP, C_POPUP);
|
popup = newwin(12, 60, L_POPUP, C_POPUP);
|
||||||
bordure(popup, 1);
|
bordure(popup, 1);
|
||||||
#if VID_INV
|
mvwaddstr(popup, 0, 2, "{ Technical infos }");
|
||||||
wstandout(popup);
|
|
||||||
#endif
|
|
||||||
mvwaddstr(popup, 0, 2, "{{ sound driver }}");
|
|
||||||
#if VID_INV
|
|
||||||
wstandend(popup);
|
|
||||||
#endif
|
|
||||||
wrefresh(popup);
|
|
||||||
|
|
||||||
foo = start_sound_output(0);
|
cptr = sf_version_string();
|
||||||
if (foo) {
|
mvwaddstr(popup, 2, 3, cptr);
|
||||||
fprintf(stderr, " %s: start_sound_output -> %d\n", __func__, foo);
|
|
||||||
}
|
|
||||||
foo = stop_sound_output(0);
|
|
||||||
if (foo) {
|
|
||||||
fprintf(stderr, " %s: stop_sound_output -> %d\n", __func__, foo);
|
|
||||||
}
|
|
||||||
|
|
||||||
mvwaddstr(popup, 4, 9, "* function not implemented *");
|
/* mvwaddstr(popup, 11, 2, "* hit any key to reboot *"); */
|
||||||
mvwaddstr(popup, 11, 2, "{{ hit any key to reboot }}");
|
|
||||||
wrefresh(popup);
|
wrefresh(popup);
|
||||||
getch();
|
getch();
|
||||||
delwin(popup);
|
delwin(popup);
|
||||||
@@ -44,6 +44,11 @@ static int nombre; /* nbre d'entr
|
|||||||
int teste_fichier(char *nom, struct stat *stb, int flag)
|
int teste_fichier(char *nom, struct stat *stb, int flag)
|
||||||
{
|
{
|
||||||
int foo;
|
int foo;
|
||||||
|
|
||||||
|
if (flag) {
|
||||||
|
fprintf(stderr, "in %s, flag must be 0, was %d\n", __func__, flag);
|
||||||
|
}
|
||||||
|
|
||||||
foo = stat(nom, stb);
|
foo = stat(nom, stb);
|
||||||
if (foo) {
|
if (foo) {
|
||||||
fprintf(stderr, "in %s stat -> %d\n", __func__, errno);
|
fprintf(stderr, "in %s stat -> %d\n", __func__, errno);
|
||||||
@@ -83,8 +88,7 @@ int trier_la_liste(int mode)
|
|||||||
#if DEBUG_LEVEL
|
#if DEBUG_LEVEL
|
||||||
fprintf(stderr, "tri de la liste, mode=%d\n", mode);
|
fprintf(stderr, "tri de la liste, mode=%d\n", mode);
|
||||||
#endif
|
#endif
|
||||||
switch(mode)
|
switch(mode) {
|
||||||
{
|
|
||||||
case 1:
|
case 1:
|
||||||
qsort(liste, nombre, sizeof(FICH), cmp_name_asc);
|
qsort(liste, nombre, sizeof(FICH), cmp_name_asc);
|
||||||
break;
|
break;
|
||||||
@@ -117,8 +121,7 @@ int foo, type;
|
|||||||
int devine;
|
int devine;
|
||||||
long magicbits;
|
long magicbits;
|
||||||
|
|
||||||
if ( NULL == (liste = malloc(TCHONK*sizeof(FICH))) )
|
if ( NULL == (liste = malloc(TCHONK*sizeof(FICH))) ) {
|
||||||
{
|
|
||||||
fprintf(stderr, "\nno memory in file-listing\n");
|
fprintf(stderr, "\nno memory in file-listing\n");
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
@@ -127,17 +130,12 @@ dir = opendir(".");
|
|||||||
if (dir == NULL) { abort(); } /* XXX hard failure */
|
if (dir == NULL) { abort(); } /* XXX hard failure */
|
||||||
|
|
||||||
nombre = 0;
|
nombre = 0;
|
||||||
while ( (de=readdir(dir)) != NULL)
|
while ( (de=readdir(dir)) != NULL) {
|
||||||
{
|
if ( ! teste_fichier(de->d_name, &statbuf, 0) ) {
|
||||||
#if DEBUG_LEVEL
|
|
||||||
#endif
|
|
||||||
if ( ! teste_fichier(de->d_name, &statbuf, 0) )
|
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
type = type_du_fichier(de->d_name);
|
type = type_du_fichier(de->d_name);
|
||||||
if (type < 0)
|
if (type < 0) {
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,8 +157,7 @@ while ( (de=readdir(dir)) != NULL)
|
|||||||
#endif
|
#endif
|
||||||
nombre++;
|
nombre++;
|
||||||
/* if needed, increase the size of the list */
|
/* if needed, increase the size of the list */
|
||||||
if (nombre >= taille)
|
if (nombre >= taille) {
|
||||||
{
|
|
||||||
liste = realloc(liste, sizeof(FICH)*(taille+TCHONK));
|
liste = realloc(liste, sizeof(FICH)*(taille+TCHONK));
|
||||||
taille += TCHONK;
|
taille += TCHONK;
|
||||||
}
|
}
|
||||||
@@ -177,7 +174,7 @@ int ln;
|
|||||||
|
|
||||||
ln = strlen(liste[number].nom);
|
ln = strlen(liste[number].nom);
|
||||||
|
|
||||||
mvwprintw(w, line, 2, "%3d %-40s %9d ",
|
mvwprintw(w, line, 2, " %3d %-50s %9d ",
|
||||||
liste[number].idx,
|
liste[number].idx,
|
||||||
liste[number].nom,
|
liste[number].nom,
|
||||||
liste[number].taille);
|
liste[number].taille);
|
||||||
@@ -197,7 +194,9 @@ fprintf(stderr, ">>> %s ( )\n", __func__);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
foo = faire_la_liste();
|
foo = faire_la_liste();
|
||||||
|
if (0 == foo) {
|
||||||
|
/* XXX ERROR MESSAGE AND QUIT ? */
|
||||||
|
}
|
||||||
affh = LINES-7;
|
affh = LINES-7;
|
||||||
/*
|
/*
|
||||||
* create a subwindow for list of files
|
* create a subwindow for list of files
|
||||||
@@ -215,16 +214,14 @@ flag_exit = 0;
|
|||||||
fprintf(stderr, " %s enter interactive\n", __func__);
|
fprintf(stderr, " %s enter interactive\n", __func__);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
do
|
do {
|
||||||
{
|
|
||||||
#if DEBUG_LEVEL > 1
|
#if DEBUG_LEVEL > 1
|
||||||
sprintf(chaine, "nombre:%3d first:%3d curseur:%3d",
|
sprintf(chaine, "nombre:%3d first:%3d curseur:%3d",
|
||||||
nombre, first, curseur);
|
nombre, first, curseur);
|
||||||
mvwaddstr(wfs, 0, 50, chaine);
|
mvwaddstr(wfs, 0, 50, chaine);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (foo=0; foo<affh; foo++)
|
for (foo=0; foo<affh; foo++) {
|
||||||
{
|
|
||||||
idx = foo+first;
|
idx = foo+first;
|
||||||
if (idx >= nombre) break;
|
if (idx >= nombre) break;
|
||||||
|
|
||||||
@@ -241,8 +238,7 @@ do
|
|||||||
/*
|
/*
|
||||||
* ici il faudrait effacer le curseur ?
|
* ici il faudrait effacer le curseur ?
|
||||||
*/
|
*/
|
||||||
switch (key)
|
switch (key) {
|
||||||
{
|
|
||||||
case KEY_UP:
|
case KEY_UP:
|
||||||
if (curseur) curseur--;
|
if (curseur) curseur--;
|
||||||
else if (first>0) first--;
|
else if (first>0) first--;
|
||||||
@@ -262,21 +258,24 @@ do
|
|||||||
case '\r': case 'p':
|
case '\r': case 'p':
|
||||||
idx = curseur+first; /* ??? */
|
idx = curseur+first; /* ??? */
|
||||||
foo = play_this_file(liste[idx].nom, liste[idx].son.type, 0);
|
foo = play_this_file(liste[idx].nom, liste[idx].son.type, 0);
|
||||||
|
#if DEBUG_LEVEL
|
||||||
fprintf(stderr, "play '%s' => %d\n",liste[idx].nom, foo);
|
fprintf(stderr, "play '%s' => %d\n",liste[idx].nom, foo);
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'D': case 'd':
|
case 'D': case 'd':
|
||||||
idx = curseur+first; /* ??? FIXME */
|
idx = curseur+first;
|
||||||
|
/* second parameter is ignored */
|
||||||
dump_this_file(liste[idx].nom, 0);
|
dump_this_file(liste[idx].nom, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'I': case 'i':
|
case 'I': case 'i':
|
||||||
idx = curseur+first; /* ??? FIXME */
|
idx = curseur+first;
|
||||||
info_about_this_file(liste[idx].nom,
|
info_about_this_file(liste[idx].nom,
|
||||||
liste[idx].son.type);
|
liste[idx].son.type);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'A': case 'a': about(); break;
|
case 'A': case 'a': about(); break;
|
||||||
case 'H': case 'h': case '?': help(); break;
|
case 'H': case 'h': case '?': help(); break;
|
||||||
|
|
||||||
case 'n': trier_la_liste(1); break;
|
case 'n': trier_la_liste(1); break;
|
||||||
@@ -286,9 +285,9 @@ do
|
|||||||
case 'u': trier_la_liste(10); break;
|
case 'u': trier_la_liste(10); break;
|
||||||
case 'U': trier_la_liste(11); break;
|
case 'U': trier_la_liste(11); break;
|
||||||
|
|
||||||
case '$': infos_driver_son(); break;
|
case '$': infos_techniques(); break;
|
||||||
|
|
||||||
case 'Q': case 'q':
|
case 'Q':
|
||||||
flag_exit = 1;
|
flag_exit = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -20,13 +20,11 @@ int magic_detect(char *fname, long *pbits)
|
|||||||
int fd;
|
int fd;
|
||||||
char buffer[T_BUFF_MAGIC];
|
char buffer[T_BUFF_MAGIC];
|
||||||
|
|
||||||
if ( (fd=open(fname, O_RDONLY)) < 0 )
|
if ( (fd=open(fname, O_RDONLY)) < 0 ) {
|
||||||
{
|
|
||||||
perror(fname);
|
perror(fname);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if ( T_BUFF_MAGIC != read(fd, buffer, T_BUFF_MAGIC) )
|
if ( T_BUFF_MAGIC != read(fd, buffer, T_BUFF_MAGIC) ) {
|
||||||
{
|
|
||||||
close(fd);
|
close(fd);
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
@@ -69,4 +67,3 @@ if (0 == strncmp(buffer, "OggS", 4))
|
|||||||
return SON_UNKNOW;
|
return SON_UNKNOW;
|
||||||
}
|
}
|
||||||
/*==------------------------------------------------------------------==*/
|
/*==------------------------------------------------------------------==*/
|
||||||
/*==------------------------------------------------------------------==*/
|
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
/*==------------------------------------------------------------------==*/
|
/*==------------------------------------------------------------------==*/
|
||||||
static char *about_texte[] =
|
static char *about_texte[] =
|
||||||
{
|
{
|
||||||
"{{ About... }}",
|
"{ About... }",
|
||||||
"Ecoute, a sound player - version " VERSION,
|
"Ecoute, a sound player - version " VERSION,
|
||||||
"Another ugly software made by tontonTh",
|
"Another ugly software made by tontonTh",
|
||||||
"",
|
"",
|
||||||
@@ -38,7 +38,7 @@ static char *help_texte[] =
|
|||||||
"tT Sort by file time",
|
"tT Sort by file time",
|
||||||
"uU Sort by order (unsort)",
|
"uU Sort by order (unsort)",
|
||||||
"I Infos about this file",
|
"I Infos about this file",
|
||||||
"$ What is the sound driver ?",
|
"$ Technical infos",
|
||||||
"",
|
"",
|
||||||
"Q Quit",
|
"Q Quit",
|
||||||
NULL
|
NULL
|
||||||
@@ -52,8 +52,7 @@ char **ptr;
|
|||||||
|
|
||||||
nblignes = largmax = 0;
|
nblignes = largmax = 0;
|
||||||
ptr = lignes+1;
|
ptr = lignes+1;
|
||||||
while ( *ptr != NULL )
|
while ( *ptr != NULL ) {
|
||||||
{
|
|
||||||
#if DEBUG_LEVEL > 1
|
#if DEBUG_LEVEL > 1
|
||||||
fprintf(stderr, "%p %s\n", ptr, *ptr);
|
fprintf(stderr, "%p %s\n", ptr, *ptr);
|
||||||
#endif
|
#endif
|
||||||
@@ -63,12 +62,11 @@ while ( *ptr != NULL )
|
|||||||
ptr++;
|
ptr++;
|
||||||
}
|
}
|
||||||
|
|
||||||
popup = newwin((nblignes)+5, largmax+6, L_POPUP, C_POPUP);
|
popup = newwin((nblignes)+4, largmax+7, L_POPUP, C_POPUP);
|
||||||
bordure(popup, 1);
|
bordure(popup, 1);
|
||||||
wrefresh(popup);
|
wrefresh(popup);
|
||||||
|
|
||||||
for (foo=1; foo<=nblignes; foo++)
|
for (foo=1; foo<=nblignes; foo++) {
|
||||||
{
|
|
||||||
mvwaddstr(popup, (foo)+1, 3, lignes[foo]);
|
mvwaddstr(popup, (foo)+1, 3, lignes[foo]);
|
||||||
#if DEBUG_LEVEL > 1
|
#if DEBUG_LEVEL > 1
|
||||||
fprintf(stderr, "%4d %s\n", foo, lignes[foo]);
|
fprintf(stderr, "%4d %s\n", foo, lignes[foo]);
|
||||||
@@ -118,6 +116,10 @@ int foo;
|
|||||||
char *audiodevice = "none";
|
char *audiodevice = "none";
|
||||||
char *newdir = NULL;
|
char *newdir = NULL;
|
||||||
|
|
||||||
|
#if DEBUG_LEVEL
|
||||||
|
fprintf(stderr, "\n\tE C O U T E %d\n\n", getpid());
|
||||||
|
#endif
|
||||||
|
|
||||||
while ((opt = getopt(argc, argv, "d:hs:x")) != -1) {
|
while ((opt = getopt(argc, argv, "d:hs:x")) != -1) {
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case 'd':
|
case 'd':
|
||||||
@@ -27,7 +27,7 @@ int driver;
|
|||||||
char chaine[100];
|
char chaine[100];
|
||||||
short * samples;
|
short * samples;
|
||||||
long total_lu;
|
long total_lu;
|
||||||
int lu;
|
int foo, bar, lu;
|
||||||
int maxsample;
|
int maxsample;
|
||||||
|
|
||||||
#if DEBUG_LEVEL
|
#if DEBUG_LEVEL
|
||||||
@@ -40,8 +40,7 @@ fprintf(stderr, ">>> %s ( '%s' %p )\n", __func__, fname, popup);
|
|||||||
memset(&sfinfo, 0, sizeof(sfinfo));
|
memset(&sfinfo, 0, sizeof(sfinfo));
|
||||||
|
|
||||||
sndf = sf_open(fname, SFM_READ, &sfinfo);
|
sndf = sf_open(fname, SFM_READ, &sfinfo);
|
||||||
if (sndf==NULL)
|
if (NULL == sndf) {
|
||||||
{
|
|
||||||
mvwaddstr(popup, 4, 4, "Invalid file ?");
|
mvwaddstr(popup, 4, 4, "Invalid file ?");
|
||||||
wrefresh(popup);
|
wrefresh(popup);
|
||||||
getch();
|
getch();
|
||||||
@@ -58,34 +57,41 @@ sprintf(chaine, "channels %d", sfinfo.channels);
|
|||||||
mvwaddstr(popup, 4, 5, chaine);
|
mvwaddstr(popup, 4, 5, chaine);
|
||||||
sprintf(chaine, "format %x", sfinfo.format);
|
sprintf(chaine, "format %x", sfinfo.format);
|
||||||
mvwaddstr(popup, 5, 5, chaine);
|
mvwaddstr(popup, 5, 5, chaine);
|
||||||
|
|
||||||
wrefresh(popup);
|
wrefresh(popup);
|
||||||
#if DEBUG_LEVEL
|
|
||||||
getch();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* memory allocation
|
* memory allocation
|
||||||
* warning, we can get multiples channels.
|
* warning, we can get multiples channels.
|
||||||
*/
|
*/
|
||||||
if ( NULL == (samples = malloc(T_BUFFER*sizeof(short))) )
|
if ( NULL == (samples = malloc(T_BUFFER*sizeof(short)))) {
|
||||||
{
|
perror("no memory in AU player\n");
|
||||||
perror("\n no memory in AU player");
|
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* configuration of the sound output
|
* configuration of the sound output
|
||||||
*/
|
*/
|
||||||
ao_initialize();
|
ao_initialize();
|
||||||
|
#if DEBUG_LEVEL
|
||||||
|
fprintf(stderr, "%s: ao ititialised\n", __func__);
|
||||||
|
#endif
|
||||||
|
|
||||||
driver = ao_default_driver_id();
|
driver = ao_default_driver_id();
|
||||||
|
#if DEBUG_LEVEL
|
||||||
|
fprintf(stderr, "%s: ao default driver = %d\n", __func__, driver);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
memset(&format, 0, sizeof(format));
|
||||||
format.bits = 16; /* ? */
|
format.bits = 16; /* ? */
|
||||||
format.channels = sfinfo.channels;
|
format.channels = sfinfo.channels;
|
||||||
format.rate = sfinfo.samplerate;
|
format.rate = sfinfo.samplerate;
|
||||||
format.byte_format = AO_FMT_LITTLE; /* XXX ??? */
|
format.byte_format = AO_FMT_LITTLE; /* XXX ??? */
|
||||||
|
|
||||||
|
fprintf(stderr, "%s: going to open ao\n", __func__);
|
||||||
|
|
||||||
device = ao_open_live(driver, &format, NULL);
|
device = ao_open_live(driver, &format, NULL);
|
||||||
if (device == NULL)
|
fprintf(stderr, "%s: open live -> %p\n", __func__, device);
|
||||||
{
|
if (NULL == device) {
|
||||||
fprintf(stderr, "\nEcoute: Error open device\n");
|
fprintf(stderr, "\nEcoute: Error open device\n");
|
||||||
/*
|
/*
|
||||||
* comment connaitre la cause de l'erreur ?
|
* comment connaitre la cause de l'erreur ?
|
||||||
@@ -99,32 +105,31 @@ if (device == NULL)
|
|||||||
*/
|
*/
|
||||||
total_lu = 0L;
|
total_lu = 0L;
|
||||||
maxsample = 0;
|
maxsample = 0;
|
||||||
while ( (lu=sf_read_short(sndf, samples, T_BUFFER)) > 0 )
|
|
||||||
{
|
#if DEBUG_LEVEL
|
||||||
|
fprintf(stderr, "%s: enter loop\n", __func__);
|
||||||
|
#endif
|
||||||
|
while ( (lu=sf_read_short(sndf, samples, T_BUFFER)) > 0 ) {
|
||||||
ao_play(device, (char *)samples, lu*2);
|
ao_play(device, (char *)samples, lu*2);
|
||||||
|
for (foo=0; foo<lu; foo++) {
|
||||||
/* WHY IS THIS CODE COMMENTED-OUT ?
|
bar = abs(samples[foo]);
|
||||||
|
if (bar > maxsample) {
|
||||||
for (foo=0; foo<lu; foo++)
|
sprintf(chaine, "%9ld max %6d", total_lu, bar);
|
||||||
{
|
|
||||||
bar = samples[foo];
|
|
||||||
if (bar > maxsample)
|
|
||||||
{
|
|
||||||
sprintf(chaine, "%9ld %6d", total_lu, bar);
|
|
||||||
mvwaddstr(popup, 7, 1, chaine);
|
mvwaddstr(popup, 7, 1, chaine);
|
||||||
wrefresh(popup);
|
wrefresh(popup);
|
||||||
maxsample = bar;
|
maxsample = bar;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
maxsample = 0;
|
maxsample = 0;
|
||||||
*/
|
|
||||||
|
|
||||||
total_lu += (long)lu;
|
total_lu += (long)lu;
|
||||||
progress_bar(popup, total_lu/sfinfo.channels, sfinfo.frames, 0);
|
progress_bar(popup, total_lu/sfinfo.channels, sfinfo.frames, 1);
|
||||||
wrefresh(popup);
|
wrefresh(popup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if DEBUG_LEVEL
|
||||||
fprintf(stderr, "maxsample = %d\n", maxsample);
|
fprintf(stderr, "maxsample = %d\n", maxsample);
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* some cleanup...
|
* some cleanup...
|
||||||
@@ -83,6 +83,7 @@ while ( (lu=read(fd, samples, T_BUFFER)) > 0 )
|
|||||||
/*
|
/*
|
||||||
* this is the end, my friends...
|
* this is the end, my friends...
|
||||||
*/
|
*/
|
||||||
|
free(samples);
|
||||||
ao_close(device);
|
ao_close(device);
|
||||||
ao_shutdown(); /* must be paired with ao_initialise */
|
ao_shutdown(); /* must be paired with ao_initialise */
|
||||||
|
|
||||||
@@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <string.h>
|
||||||
#include <ogg/ogg.h>
|
#include <ogg/ogg.h>
|
||||||
#include <ao/ao.h> /* for the sound output */
|
#include <ao/ao.h> /* for the sound output */
|
||||||
|
|
||||||
@@ -21,10 +22,11 @@ ogg_sync_state oy;
|
|||||||
char *oggbuff;
|
char *oggbuff;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
mvwaddstr(popup, 1, 2, "Ogg playing: work in progress...");
|
mvwaddstr(popup, 5, 2, fname);
|
||||||
|
mvwaddstr(popup, 3, 2, "Ogg playing: work in progress...");
|
||||||
wrefresh(popup); sleep(1);
|
wrefresh(popup); sleep(1);
|
||||||
|
|
||||||
mvwaddstr(popup, 6, 6, "*** COREDUMPING ***");
|
/* mvwaddstr(popup, 6, 6, "*** COREDUMPING ***"); */
|
||||||
wrefresh(popup); getch();
|
wrefresh(popup); getch();
|
||||||
|
|
||||||
return -42; /* XXX */
|
return -42; /* XXX */
|
||||||
@@ -32,6 +34,7 @@ return -42; /* XXX */
|
|||||||
/*
|
/*
|
||||||
* preparation
|
* preparation
|
||||||
*/
|
*/
|
||||||
|
memset(&oy, 0, sizeof(oy));
|
||||||
ret = ogg_sync_init(&oy);
|
ret = ogg_sync_init(&oy);
|
||||||
mvwprintw(popup, 2, 2, "ogg_sync_init -> %d", ret);
|
mvwprintw(popup, 2, 2, "ogg_sync_init -> %d", ret);
|
||||||
|
|
||||||
@@ -40,6 +43,10 @@ mvwprintw(popup, 3, 2, "ogg_sync_buffer -> %p", oggbuff);
|
|||||||
wrefresh(popup);
|
wrefresh(popup);
|
||||||
getch();
|
getch();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* action !
|
||||||
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* termination
|
* termination
|
||||||
*/
|
*/
|
||||||
@@ -20,7 +20,7 @@ ao_sample_format format;
|
|||||||
ao_device * device;
|
ao_device * device;
|
||||||
char chaine[120];
|
char chaine[120];
|
||||||
short * samples;
|
short * samples;
|
||||||
int lu;
|
int lu, key;
|
||||||
long total_lu;
|
long total_lu;
|
||||||
|
|
||||||
#if DEBUG_LEVEL
|
#if DEBUG_LEVEL
|
||||||
@@ -31,9 +31,8 @@ fprintf(stderr, ">>> %s ( '%s' %p )\n", __func__, fname, popup);
|
|||||||
* get help from 'sndfile' for getting datas
|
* get help from 'sndfile' for getting datas
|
||||||
*/
|
*/
|
||||||
memset(&sfinfo, 0, sizeof(sfinfo));
|
memset(&sfinfo, 0, sizeof(sfinfo));
|
||||||
|
|
||||||
sndf = sf_open(fname, SFM_READ, &sfinfo);
|
sndf = sf_open(fname, SFM_READ, &sfinfo);
|
||||||
if (sndf==NULL)
|
if (NULL==sndf)
|
||||||
{
|
{
|
||||||
mvwaddstr(popup, 4, 4, "Invalid file ?");
|
mvwaddstr(popup, 4, 4, "Invalid file ?");
|
||||||
wrefresh(popup);
|
wrefresh(popup);
|
||||||
@@ -53,7 +52,6 @@ sprintf(chaine, "format 0x%x", sfinfo.format);
|
|||||||
mvwaddstr(popup, 5, 5, chaine);
|
mvwaddstr(popup, 5, 5, chaine);
|
||||||
sprintf(chaine, "sections %d", sfinfo.sections);
|
sprintf(chaine, "sections %d", sfinfo.sections);
|
||||||
mvwaddstr(popup, 6, 5, chaine);
|
mvwaddstr(popup, 6, 5, chaine);
|
||||||
|
|
||||||
wrefresh(popup);
|
wrefresh(popup);
|
||||||
|
|
||||||
#if DEBUG_LEVEL > 1
|
#if DEBUG_LEVEL > 1
|
||||||
@@ -82,7 +80,7 @@ format.channels = sfinfo.channels;
|
|||||||
format.rate = sfinfo.samplerate;
|
format.rate = sfinfo.samplerate;
|
||||||
format.byte_format = AO_FMT_LITTLE; /* XXX ??? */
|
format.byte_format = AO_FMT_LITTLE; /* XXX ??? */
|
||||||
device = ao_open_live(driver, &format, NULL);
|
device = ao_open_live(driver, &format, NULL);
|
||||||
if (device == NULL)
|
if (NULL==device)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "\nEcoute: Error open device\n");
|
fprintf(stderr, "\nEcoute: Error open device\n");
|
||||||
/*
|
/*
|
||||||
@@ -105,7 +103,13 @@ while ( (lu=sf_read_short(sndf, samples, T_BUFFER)) > 0 )
|
|||||||
wrefresh(popup);
|
wrefresh(popup);
|
||||||
|
|
||||||
/* HERE WE HAVE TO DETECT A 'STOP LISTEN' FUNCTION. */
|
/* HERE WE HAVE TO DETECT A 'STOP LISTEN' FUNCTION. */
|
||||||
|
if (is_a_key_hitted()) {
|
||||||
|
key = getch();
|
||||||
|
fprintf(stderr, "%s key pressed 0x%X\n", __func__, key);
|
||||||
|
if ('X' == key) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -125,7 +125,7 @@ char buffer[200];
|
|||||||
|
|
||||||
barre_inverse(' ', 0);
|
barre_inverse(' ', 0);
|
||||||
standout();
|
standout();
|
||||||
mvaddstr(0, 2, " Visuel HexDiff v " VERSION " by tTh 2023 ");
|
mvaddstr(0, 2, " Visuel HexDiff v " VERSION " by tTh 2024 ");
|
||||||
#if TRACE
|
#if TRACE
|
||||||
sprintf(buffer, " screen size %dx%d ", COLS, LINES);
|
sprintf(buffer, " screen size %dx%d ", COLS, LINES);
|
||||||
foo = strlen(buffer);
|
foo = strlen(buffer);
|
||||||
@@ -211,7 +211,7 @@ delwin(popup);
|
|||||||
static char *about_texte[] =
|
static char *about_texte[] =
|
||||||
{
|
{
|
||||||
"Visuel Hexdiff - version " VERSION,
|
"Visuel Hexdiff - version " VERSION,
|
||||||
"(c) 2023 by Thierry [tTh] Boudet",
|
"(c) 2024 by Thierry [tTh] Boudet",
|
||||||
"http://tboudet.free.fr/hexdiff/",
|
"http://tboudet.free.fr/hexdiff/",
|
||||||
"https://git.tetalab.org/tTh/KlugyTools/",
|
"https://git.tetalab.org/tTh/KlugyTools/",
|
||||||
"send bugs reports: tontonth@free.fr",
|
"send bugs reports: tontonth@free.fr",
|
||||||
@@ -319,7 +319,7 @@ return -1;
|
|||||||
/*----------------------------------------------------------------*/
|
/*----------------------------------------------------------------*/
|
||||||
void version(void)
|
void version(void)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "\nThis is 'hexdiff' v "VERSION", made by tTh in 2023\n");
|
fprintf(stderr, "\nThis is 'hexdiff' v "VERSION", made by tTh in 2024\n");
|
||||||
/* fprintf(stderr, "homepage: http://tboudet.free.fr/hexdiff/\n"); */
|
/* fprintf(stderr, "homepage: http://tboudet.free.fr/hexdiff/\n"); */
|
||||||
fprintf(stderr, "homepage: https://git.tetalab.org/tTh/KlugyTools/\n");
|
fprintf(stderr, "homepage: https://git.tetalab.org/tTh/KlugyTools/\n");
|
||||||
#if TRACE
|
#if TRACE
|
||||||
|
|||||||
57
README.md
57
README.md
@@ -2,27 +2,66 @@
|
|||||||
|
|
||||||
Divers outils pour faire des choses diverses...
|
Divers outils pour faire des choses diverses...
|
||||||
|
|
||||||
Beaucoup de choses anciennes que je traine de systèmes en systèmes, et qui ont
|
Beaucoup de choses anciennes que je traine de systèmes en systèmes, et qui ont parfois une utilité limitée.
|
||||||
parfois une utilité limitée. Du code qui a presque vingt ans.
|
Du code qui a parfois presque vingt ans, et qui
|
||||||
|
nécessite donc un peu de nettoyage.
|
||||||
|
|
||||||
## DumpGDBM
|
## DumpGDBM
|
||||||
|
|
||||||
Pour le debug des fichiers `key/data` géres par GDBM. Ligne de commande
|
Pour le [debug](DumpGDBM) des fichiers `key/data` géres par GDBM.
|
||||||
aver une interface _readline_.
|
Ligne de commande avec une interface _readline_.
|
||||||
|
|
||||||
|
```
|
||||||
|
tth@redlady:~/Devel/KlugyTools/DumpGDBM$ ./dumpgdbm -i exemple.gdbm
|
||||||
|
working on [exemple.gdbm]
|
||||||
|
dumpgdbm > ?
|
||||||
|
----------------( Help me Obi Wan ! )---------------
|
||||||
|
q ZZ :q :q! exit quit bye x hex hexa a ascii o octal h help ? f first
|
||||||
|
m maxoctets maxbytes n next p print ks keysearch ds datasearch empty 7
|
||||||
|
8 V version commands listcom sux
|
||||||
|
-----------( use '? command' for details )----------
|
||||||
|
dumpgdbm > p
|
||||||
|
K: rtkit.
|
||||||
|
D: RealtimeKit,,,.
|
||||||
|
|
||||||
|
dumpgdbm > n
|
||||||
|
K: lightdm.
|
||||||
|
D: Light Display Manager.
|
||||||
|
|
||||||
|
dumpgdbm > hex
|
||||||
|
dumpgdbm > p
|
||||||
|
K: 6c 69 67 68 74 64 6d 00
|
||||||
|
D: 4c 69 67 68 74 20 44 69 73 70 6c 61 79 20 4d 61 6e 61 67 65 72 00
|
||||||
|
```
|
||||||
|
|
||||||
## Hexdiff
|
## Hexdiff
|
||||||
|
|
||||||
Pour comparer visuellement deux fichiers binaires. Interface `ncurses` trop
|
Pour comparer visuellement deux fichiers binaires.
|
||||||
choupie. Devrait peut-être un jour (mais flemme) passer à la couleur.
|
Interface `ncurses` trop choupie.
|
||||||
|
Devrait peut-être un jour (mais flemme) passer à la couleur.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|
||||||
## Checkresolv
|
## Checkresolv
|
||||||
|
|
||||||
Vieux truc rudimentaire pour fouiller dans la résolution de nom.
|
Vieux truc rudimentaire pour [fouiller](CheckResolv) dans la résolution de nom.
|
||||||
L'adaptation à `IPv6` est à l'étude.
|
L'adaptation à `IPv6` est à l'étude.
|
||||||
|
Contrairement à d'autres outils similaires, il utilise les
|
||||||
|
fonctions de résolution de la `libc` au lieu de s'adresser directement
|
||||||
|
au serveur de noms.
|
||||||
|
|
||||||
|
```
|
||||||
|
tth@redlady:~/Devel/KlugyTools/CheckResolv$ ./checkresolv -r tetalab.org
|
||||||
|
------------( tetalab.org
|
||||||
|
h_name: tetalab.org
|
||||||
|
ip: 89.234.156.223
|
||||||
|
reverse 89.234.156.223 -> bobby.tetalab.org
|
||||||
|
```
|
||||||
|
|
||||||
|
## Ecoute
|
||||||
|
|
||||||
|
Un [joueur](Ecoute) de fichiers musicaux surgi d'un lointain passé,
|
||||||
|
qui va prendre un coup de jeune pour gérer les formats modernes.
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user