~blackskad/gnomeradio/dev-vol-button

« back to all changes in this revision

Viewing changes to src/rec_tech.c

  • Committer: mfcn
  • Date: 2005-04-09 22:48:49 UTC
  • Revision ID: svn-v3-trunk0:ba97a3d1-ec25-0410-b1c6-e06ad936ea6c:trunk:86
OneĀ smallĀ speedup

Show diffs side-by-side

added added

removed removed

Lines of Context:
89
89
 * These functions handle recording
90
90
 */
91
91
 
92
 
static int
93
 
executable_exists(const char *name)
94
 
{
95
 
        GIOChannel *ioc;
96
 
        GError *err = NULL;
97
 
        int n, retval;
98
 
        char *buffer;
99
 
        pid_t pid;
100
 
        
101
 
        ioc = execute_command(&pid, name, NULL);
102
 
        if (!ioc)
103
 
                return 0;
104
 
        
105
 
        if (g_io_channel_read_to_end(ioc, &buffer, &n, &err) != G_IO_STATUS_NORMAL)
106
 
        {
107
 
                g_print("%s\n", err->message);
108
 
                g_error_free(err); 
109
 
                return 0;
110
 
        }
111
 
 
112
 
        if (strstr(buffer, "wrzlbrmft"))
113
 
                retval = 0;
114
 
        else
115
 
                retval = 1;
116
 
        g_io_channel_shutdown(ioc, TRUE, NULL);
117
 
        
118
 
        waitpid(pid, NULL, 0);
119
 
        
120
 
        return retval;
121
 
}       
122
 
 
123
92
GList* 
124
93
get_installed_encoders(void)
125
94
{
128
97
        GList *result = NULL;
129
98
        
130
99
        for (i=0; encoders[i]; i++) {
131
 
                if (executable_exists(encoders[i])) result = g_list_append(result, g_strdup(encoders[i]));
 
100
                gchar *path = g_find_program_in_path(encoders[i]);              
 
101
                if (path) { 
 
102
                        result = g_list_append(result, g_strdup(encoders[i]));
 
103
                        g_free(path);
 
104
                }
132
105
        }
133
106
 
134
107
        return result;
137
110
int 
138
111
check_sox_installation(void)
139
112
{
140
 
        if (executable_exists("sox")) return 1;
 
113
        gchar *path = g_find_program_in_path("sox"); 
 
114
        if (path) {
 
115
                g_free(path);
 
116
                return 1;
 
117
        }
141
118
        return 0;
142
119
}
143
120