pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkg/29036: audio/cmp3 upgraded to 2.0pre6



>Number:         29036
>Category:       pkg
>Synopsis:       audio/cmp3 upgraded to 2.0pre6
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Fri Jan 21 14:36:00 +0000 2005
>Originator:     Rui-Xiang Guo
>Release:        NetBSD 2.99.14
>Organization:
        
>Environment:
        
        
System: NetBSD bee 2.99.14 NetBSD 2.99.14 (BEE) #0: Tue Jan 18 22:40:06 CST 
2005 rxg@bee:/usr/obj/sys/arch/i386/compile/BEE i386
Architecture: i386
Machine: i386
>Description:
        audio/cmp3 upgraded to 2.0pre6. it support .ogg file format now.
>How-To-Repeat:
                1. use this patch to fix Makefile:
--- Makefile.orig    2004-10-28 01:23:45.000000000 +0800
+++ Makefile    2005-01-21 14:55:35.000000000 +0800
@@ -1,19 +1,20 @@
 # $NetBSD: Makefile,v 1.19 2004/10/27 17:23:45 wiz Exp $
 #

-DISTNAME=      cmp3-2.0pre5  
-PKGNAME=       cmp3-2.0.p5
+DISTNAME=      cmp3-2.0pre6
+PKGNAME=       cmp3-2.0.p6
 PKGREVISION=   1
 CATEGORIES=    audio
 MASTER_SITES=  ${MASTER_SITE_SOURCEFORGE:=cmp3/}

-MAINTAINER=    rxg%ms25.url.com.tw@localhost
+MAINTAINER=    rxg%NetBSD.org@localhost
 HOMEPAGE=      http://cmp3.sourceforge.net/
 COMMENT=       Curses based frontend to mpg123

 DEPENDS+=      mpg123-[0-9]*:../../audio/mpg123
+DEPENDS+=      vorbis-tools-[0-9]*:../../audio/vorbis-tools

-WRKSRC=                        ${WRKDIR}/cmp3
+WRKSRC=                        ${WRKDIR}/cmp3-kenrevs
 USE_BUILDLINK3=                YES
 USE_GNU_TOOLS+=                make
 INCOMPAT_CURSES=       NetBSD-1.5* NetBSD-1.6[-_.]*

        2. replace these three patches:
patch-aa
$NetBSD$

--- Makefile.orig       2001-07-29 13:43:49.000000000 +0800
+++ Makefile
@@ -4,25 +4,25 @@
 #  Set these variables
 #
 #  initial_directory is now set in the config file
-mpg123_location   := "mpg123"
-ogg123_location   := "ogg123"
-install_directory := "$(HOME)/bin"
+mpg123_location   := "$(LOCALBASE)/bin/mpg123"
+ogg123_location   := "$(LOCALBASE)/bin/ogg123"
+install_directory := "$(PREFIX)/bin"

 #
 #  Location of config file - Please edit this file before installing
 #
-config_file       := "$(HOME)/.cmp3rc"
+#config_file       := "$(HOME)/.cmp3rc"

 #
 #  Uncomment and set if desired
 #

 ## An ass repository is a nice thing to have. See README
-ass_repository := "$(HOME)/.cmp3ass"
+#ass_repository := "$(HOME)/.cmp3ass"

 ## Define this for bufferring or add other parameters to mpg123 and ogg123
-mpg123_params := -b 320
-ogg123_params := -d oss
+#mpg123_params := -b 320
+#ogg123_params := -d oss

 # You need debugging info? Uncomment this and check /tmp/cmp3log
 #debugging := 1
@@ -42,9 +42,9 @@ RNMP3PARAMS= -DVERSION="\$(VERSION)\"
 # Something for me and my cd changer, you definately don't want it as it
 # stands. Change the code to do something else you want it to do...
 #PARAMS +=-DMY_CD
-LIBS= -lform -lncurses
-CFLAGS= -g -O -Inevlib
-CC= gcc
+LIBS= $(LDFLAGS) -lform -lncurses
+CFLAGS+= -Inevlib
+CC?= gcc
 OBJS= cmp3common.o cmp3fileio.o cmp3manager.o cmp3curses.o \
       cmp3llist.o cmp3main.o cmp3listfiles.o cmp3playlist.o cmp3volume.o \
       cmp3general.o cmp3id3.o
@@ -60,6 +60,7 @@ PARAMS += -DEXEC_PARAMS="$(foreach token
 PARAMS += -DOGG_PARAMS="$(foreach token, $(ogg123_params),\"$(token)\",)"
 else
 PARAMS += -DEXEC_PARAMS=\"\",
+PARAMS += -DOGG_PARAMS=\"\",
 endif
 ifdef filespacing
 RNMP3PARAMS += -DSPACEIT
@@ -87,7 +88,7 @@ cmp3: lib $(OBJS)
        $(CC) $(CFLAGS) $(OBJS) nevlib/libnev.a $(LIBS) -o cmp3

 lib:
-       @$(MAKE) -C nevlib lib
+       @$(MAKE) CC="$(CC)" CFLAGS="$(CFLAGS)" -C nevlib lib

 cleanlib:
        @$(MAKE) -C nevlib clean

patch-ab:
$NetBSD$

--- cmp3.h.orig 2001-07-01 12:38:08.000000000 +0800
+++ cmp3.h
@@ -1,7 +1,7 @@
 #ifndef _CMP3_H
 #define _CMP3_H

-#if defined(__FreeBSD__)
+#if defined(__FreeBSD__) || defined(__NetBSD__)
 #include <ncurses.h>
 #include <termios.h>
 #else
@@ -9,9 +9,6 @@
 #endif


-#ifndef NCURSES_VERSION
-  #error "This program requires ncurses to function"
-#endif

 #include <signal.h>
 #include <dirent.h>

patch-ac:
$NetBSD$

--- cmp3volume.c.orig   2001-07-01 12:38:08.000000000 +0800
+++ cmp3volume.c
@@ -5,6 +5,8 @@
 #include "cmp3funcs.h"
 #if defined(__FreeBSD__)
 #include <machine/soundcard.h>
+#elif defined(__NetBSD__)
+#include <sys/audioio.h>
 #else
 #include<sys/soundcard.h>
 #endif
@@ -16,6 +18,63 @@ static int mixernum,
  *  Initialize volume control
  *  Returns: nothing
  ****************************************************************************/ 
+#if defined(__NetBSD__)
+
+int device_id;
+mixer_ctrl_t *m, *values;
+
+extern void initvol()
+{
+    int i, ndev;
+    char *mixer_device;
+    mixer_devinfo_t dinfo, *infos;
+
+    mixer_device = getenv("MIXERDEVICE");
+    if (mixer_device == NULL)
+        mixer_device = "/dev/mixer0";
+
+    if ((mixernum=open(mixer_device, O_RDWR)) < 0) {
+        fprintf(stderr, "open mixer device: %s", strerror(errno));
+        enditall(SIGSEGV);
+    }
+
+    for (ndev = 0; ; ndev++) {
+        dinfo.index = ndev;
+        if (ioctl(mixernum, AUDIO_MIXER_DEVINFO, &dinfo) < 0)
+            break;
+    }
+    infos = calloc(ndev, sizeof *infos);
+    values = calloc(ndev, sizeof *values);
+
+    for (i = 0; i < ndev; i++) {
+        infos[i].index = i;
+        ioctl(mixernum, AUDIO_MIXER_DEVINFO, &infos[i]);
+    }
+
+    for (i = 0; i < ndev; i++) {
+        if (infos[i].type == AUDIO_MIXER_VALUE) {
+            values[i].dev = i;
+            values[i].type = infos[i].type;
+        }
+        if (strcmp(infos[i].label.name, AudioNdac) == 0) {
+            device_id = i;
+            break;
+        }
+    }
+
+    values[device_id].un.value.num_channels = 2;
+
+    m = &values[device_id];
+    ioctl(mixernum, AUDIO_MIXER_READ, m);
+    vol = m->un.value.level[0] * 100 / AUDIO_MAX_GAIN;
+    mvprintw(3,COLS/2-1,"-");
+    mvprintw(LINES-7,COLS/2-1,"-");
+    mvprintw((LINES-8)-(vol*(LINES-12)/100),COLS/2-1,"*");
+    return;
+}
+
+#else
+
 extern void initvol()
 {
     if ((mixernum=open("/dev/mixer", O_RDWR)) < 0) {
@@ -30,6 +89,8 @@ extern void initvol()
     return;
 }

+#endif
+
 extern void endvol()
 {
     close(mixernum);
@@ -61,6 +122,23 @@ extern void volclean()
  *  Although I hate users in general, we should probably do it.
  *  Returns: nothing
  ****************************************************************************/ 
+#if defined(__NetBSD__)
+
+extern void volup()
+{
+    mvprintw((LINES-8)-(vol*(LINES-12)/100),COLS/2-1," ");
+    vol += 3;
+    if (vol > 100)
+        vol = 100;
+    m = &values[device_id];
+    ioctl(mixernum, AUDIO_MIXER_WRITE, m);
+    m->un.value.level[0] = m->un.value.level[1] = vol * AUDIO_MAX_GAIN / 100;  
+    mvprintw((LINES-8)-(vol*(LINES-12)/100), COLS/2-1, "*");
+    return;
+}
+
+#else
+
 extern void volup()
 {
     int i;
@@ -75,10 +153,29 @@ extern void volup()
     return;
 }

+#endif
+
 /****************************************************************************  
  *  It's too loud junior, turn it down!
  *  Returns: nothing
  ****************************************************************************/ 
+#if defined(__NetBSD__)
+
+extern void voldown()
+{
+    mvprintw((LINES-8)-(vol*(LINES-12)/100),COLS/2-1," ");
+    vol -= 3;
+    if (vol < 0)
+        vol = 0;
+    m = &values[device_id];
+    ioctl(mixernum, AUDIO_MIXER_WRITE, m);
+    m->un.value.level[0] = m->un.value.level[1] = vol * AUDIO_MAX_GAIN / 100;  
+    mvprintw((LINES-8)-(vol*(LINES-12)/100), COLS/2-1, "*");
+    return;
+}
+
+#else
+
 extern void voldown()
 {
     int i;
@@ -93,4 +190,6 @@ extern void voldown()
     return;
 }

+#endif
+
 /* EOF */

        3. make makepatchsum && make install
        p.s. i also feedback the patches to the author.

>Fix:
        

>Unformatted:
        
        



Home | Main Index | Thread Index | Old Index