View | Details | Raw Unified | Return to bug 54
Collapse All | Expand All

(-)a/README (-1 / +1 lines)
Lines 42-48 To compile from source you may need the -dev or -devel versions of GTK and libcd Link Here
42
42
43
Compiling
43
Compiling
44
=========
44
=========
45
First install all the dependencies. LAME, Vorbis-Tools, FLAC, and Wavpack don't have to be installed to compile. They are only needed at runtime if you choose to encode in those formats.
45
First install all the dependencies. LAME, Vorbis-Tools, FLAC, FDK-AAC and Wavpack don't have to be installed to compile. They are only needed at runtime if you choose to encode in those formats.
46
46
47
mpcenc, neroAacEnc, and mac are also not required and may be difficult to install on your distribution. If you really want them, you probably already have them.
47
mpcenc, neroAacEnc, and mac are also not required and may be difficult to install on your distribution. If you really want them, you probably already have them.
48
48
(-)a/config.h.in (+8 lines)
Lines 9-14 Link Here
9
/* Define to 1 if you have the `bind_textdomain_codeset' function. */
9
/* Define to 1 if you have the `bind_textdomain_codeset' function. */
10
#undef HAVE_BIND_TEXTDOMAIN_CODESET
10
#undef HAVE_BIND_TEXTDOMAIN_CODESET
11
11
12
/* Define to 1 if you have the Mac OS X function CFLocaleCopyCurrent in the
13
   CoreFoundation framework. */
14
#undef HAVE_CFLOCALECOPYCURRENT
15
16
/* Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in
17
   the CoreFoundation framework. */
18
#undef HAVE_CFPREFERENCESCOPYAPPVALUE
19
12
/* Define to 1 if you have the `dcgettext' function. */
20
/* Define to 1 if you have the `dcgettext' function. */
13
#undef HAVE_DCGETTEXT
21
#undef HAVE_DCGETTEXT
14
22
(-)a/src/callbacks.c (+35 lines)
Lines 262-267 on_mp3bitrate_value_changed (GtkRange *range, Link Here
262
    gtk_label_set_text(GTK_LABEL(lookup_widget(win_prefs, "bitrate_lbl_2")), bitrate);
262
    gtk_label_set_text(GTK_LABEL(lookup_widget(win_prefs, "bitrate_lbl_2")), bitrate);
263
}
263
}
264
264
265
void
266
on_fdkaac_bitrate_value_changed            (GtkRange        *range,
267
                                        gpointer         user_data)
268
{
269
    char bitrate[8];    
270
    snprintf(bitrate, 8, _("%dKbps"), int_to_bitrate((int)gtk_range_get_value(range), 0));
271
    gtk_label_set_text(GTK_LABEL(lookup_widget(win_prefs, "fdkaac_bitrate_lbl_2")), bitrate);
272
}
273
265
void
274
void
266
on_opusrate_value_changed           (GtkRange   *range,
275
on_opusrate_value_changed           (GtkRange   *range,
267
                                     gpointer   user_data)
276
                                     gpointer   user_data)
Lines 592-597 on_rip_mp3_toggled (GtkToggleButton *togglebutton, Link Here
592
        enable_mp3_widgets();
601
        enable_mp3_widgets();
593
}
602
}
594
603
604
void
605
on_rip_fdkaac_toggled                     (GtkToggleButton *togglebutton,
606
                                        gpointer         user_data)
607
{
608
    if (gtk_toggle_button_get_active(togglebutton) && !program_exists("fdkaac"))
609
    {
610
        GtkWidget * dialog;
611
        
612
        dialog = gtk_message_dialog_new(GTK_WINDOW(win_main), 
613
                                        GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, 
614
                                        _("%s was not found in your path. Asunder requires it to create %s files. "
615
                                        "All %s functionality is disabled."),
616
                                        "'fdkaac'", "AAC", "AAC");
617
        gtk_dialog_run(GTK_DIALOG(dialog));
618
        gtk_widget_destroy(dialog);
619
620
        global_prefs->rip_fdkaac = 0;
621
        gtk_toggle_button_set_active(togglebutton, global_prefs->rip_fdkaac);
622
    }
623
    
624
    if (!gtk_toggle_button_get_active(togglebutton))
625
        disable_fdkaac_widgets();
626
    else
627
        enable_fdkaac_widgets();
628
}
629
595
void
630
void
596
on_rip_flac_toggled                    (GtkToggleButton *togglebutton,
631
on_rip_flac_toggled                    (GtkToggleButton *togglebutton,
597
                                        gpointer         user_data)
632
                                        gpointer         user_data)
(-)a/src/callbacks.h (+8 lines)
Lines 90-95 void Link Here
90
on_mp3bitrate_value_changed            (GtkRange        *range,
90
on_mp3bitrate_value_changed            (GtkRange        *range,
91
                                        gpointer         user_data);
91
                                        gpointer         user_data);
92
92
93
void
94
on_fdkaac_bitrate_value_changed            (GtkRange        *range,
95
                                        gpointer         user_data);
96
93
void
97
void
94
on_opusrate_value_changed               (GtkRange       *range,
98
on_opusrate_value_changed               (GtkRange       *range,
95
                                         gpointer        user_data);
99
                                         gpointer        user_data);
Lines 152-157 on_rip_flac_toggled (GtkToggleButton *togglebutton, Link Here
152
void
156
void
153
on_rip_mp3_toggled                     (GtkToggleButton *togglebutton,
157
on_rip_mp3_toggled                     (GtkToggleButton *togglebutton,
154
                                        gpointer         user_data);
158
                                        gpointer         user_data);
159
160
void
161
on_rip_fdkaac_toggled                     (GtkToggleButton *togglebutton,
162
                                        gpointer         user_data);
155
                                        
163
                                        
156
void
164
void
157
on_rip_wavpack_toggled                 (GtkToggleButton *togglebutton,
165
on_rip_wavpack_toggled                 (GtkToggleButton *togglebutton,
(-)a/src/interface.c (-1 / +73 lines)
Lines 9-15 the GNU General Public Licence as published by the Free Software Link Here
9
Foundation; version 2 of the licence.
9
Foundation; version 2 of the licence.
10
10
11
*/
11
*/
12
13
#ifdef HAVE_CONFIG_H
12
#ifdef HAVE_CONFIG_H
14
#    include <config.h>
13
#    include <config.h>
15
#endif
14
#endif
Lines 340-345 create_prefs (void) Link Here
340
    GtkWidget *mp3_vbr;
339
    GtkWidget *mp3_vbr;
341
    GtkWidget *hbox9;
340
    GtkWidget *hbox9;
342
    GtkWidget *rip_mp3;
341
    GtkWidget *rip_mp3;
342
    GtkWidget *vbox2X;
343
    GtkWidget *frame3X;
344
    GtkWidget *alignment8X;
345
    GtkWidget *hbox9X;
346
    GtkWidget *rip_fdkaac;
343
    GtkWidget *frame4;
347
    GtkWidget *frame4;
344
    GtkWidget *alignment9;
348
    GtkWidget *alignment9;
345
    GtkWidget *hbox10;
349
    GtkWidget *hbox10;
Lines 520-525 create_prefs (void) Link Here
520
    
524
    
521
    /* ENCODE tab */
525
    /* ENCODE tab */
522
    GtkWidget *mp3bitrate;
526
    GtkWidget *mp3bitrate;
527
    GtkWidget *fdkaac_bitrate;
523
    GtkWidget *oggLbl;
528
    GtkWidget *oggLbl;
524
    GtkWidget *oggquality;
529
    GtkWidget *oggquality;
525
    GtkWidget *rip_ogg;
530
    GtkWidget *rip_ogg;
Lines 612-617 create_prefs (void) Link Here
612
                                        G_CALLBACK (on_rip_mp3_toggled),
617
                                        G_CALLBACK (on_rip_mp3_toggled),
613
                                        NULL);
618
                                        NULL);
614
    /* END MP3 */
619
    /* END MP3 */
620
621
    /* FDK-AAC  */
622
    frame3X = gtk_frame_new (NULL);
623
    gtk_frame_set_shadow_type(GTK_FRAME(frame3X), GTK_SHADOW_IN);
624
    gtk_widget_show (frame3X);
625
    gtk_box_pack_start (GTK_BOX (vbox), frame3X, FALSE, FALSE, 0);
626
627
    alignment8X = gtk_alignment_new (0.5, 0.5, 1, 1);
628
    gtk_widget_show (alignment8X);
629
    gtk_container_add (GTK_CONTAINER (frame3X), alignment8X);
630
    gtk_alignment_set_padding (GTK_ALIGNMENT (alignment8X), 2, 2, 12, 2);
631
    
632
    vbox2X = gtk_vbox_new (FALSE, 0);
633
    gtk_widget_show (vbox2X);
634
    gtk_container_add (GTK_CONTAINER (alignment8X), vbox2X);
635
636
    hbox9X = gtk_hbox_new (FALSE, 0);
637
    gtk_widget_show (hbox9X);
638
    gtk_box_pack_start (GTK_BOX (vbox2X), hbox9X, TRUE, TRUE, 0);    
639
640
    label = gtk_label_new (_("Bitrate"));
641
    gtk_widget_show (label);
642
    gtk_box_pack_start (GTK_BOX (hbox9X), label, FALSE, FALSE, 0);
643
    GLADE_HOOKUP_OBJECT (prefs, label, "fdkaac_bitrate_lbl");
644
    
645
    fdkaac_bitrate = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, 14, 1, 1, 1)));
646
    gtk_widget_show (fdkaac_bitrate);
647
    gtk_box_pack_start (GTK_BOX (hbox9X), fdkaac_bitrate, TRUE, TRUE, 5);
648
    gtk_scale_set_draw_value (GTK_SCALE (fdkaac_bitrate), FALSE);
649
    gtk_scale_set_digits (GTK_SCALE (fdkaac_bitrate), 0);
650
    g_signal_connect ((gpointer) fdkaac_bitrate, "value_changed",
651
                                        G_CALLBACK (on_fdkaac_bitrate_value_changed),
652
                                        NULL);
653
    
654
    tooltips = gtk_tooltips_new ();
655
    gtk_tooltips_set_tip (tooltips, fdkaac_bitrate, _("Higher bitrate is better quality but also bigger file. Most people use 128Kbps."), NULL);
656
    
657
    char kbps_textX[10];
658
    snprintf(kbps_textX, 10, _("%dKbps"), 32);
659
    label = gtk_label_new (kbps_textX);
660
    gtk_widget_show (label);
661
    gtk_box_pack_start (GTK_BOX (hbox9X), label, FALSE, FALSE, 0);
662
    GLADE_HOOKUP_OBJECT (prefs, label, "fdkaac_bitrate_lbl_2");
663
    
664
    rip_fdkaac = gtk_check_button_new_with_mnemonic (_("AAC (lossy compression with FDK-AAC)"));
665
    gtk_widget_show (rip_fdkaac);
666
    gtk_frame_set_label_widget (GTK_FRAME (frame3X), rip_fdkaac);
667
    g_signal_connect ((gpointer) rip_fdkaac, "toggled",
668
                                        G_CALLBACK (on_rip_fdkaac_toggled),
669
                                        NULL);
670
    /* END FDK-AAC */
615
    
671
    
616
    /* OGG */
672
    /* OGG */
617
    frame4 = gtk_frame_new (NULL);
673
    frame4 = gtk_frame_new (NULL);
Lines 1165-1170 create_prefs (void) Link Here
1165
    GLADE_HOOKUP_OBJECT (prefs, oggLbl, "ogg_lbl");
1221
    GLADE_HOOKUP_OBJECT (prefs, oggLbl, "ogg_lbl");
1166
    GLADE_HOOKUP_OBJECT (prefs, oggquality, "oggquality");
1222
    GLADE_HOOKUP_OBJECT (prefs, oggquality, "oggquality");
1167
    GLADE_HOOKUP_OBJECT (prefs, rip_ogg, "rip_ogg");
1223
    GLADE_HOOKUP_OBJECT (prefs, rip_ogg, "rip_ogg");
1224
    GLADE_HOOKUP_OBJECT (prefs, rip_fdkaac, "rip_fdkaac");
1225
    GLADE_HOOKUP_OBJECT (prefs, fdkaac_bitrate, "fdkaac_bitrate");
1168
    GLADE_HOOKUP_OBJECT (prefs, flacLbl, "flac_lbl");
1226
    GLADE_HOOKUP_OBJECT (prefs, flacLbl, "flac_lbl");
1169
    GLADE_HOOKUP_OBJECT (prefs, flaccompression, "flaccompression");
1227
    GLADE_HOOKUP_OBJECT (prefs, flaccompression, "flaccompression");
1170
    GLADE_HOOKUP_OBJECT (prefs, rip_flac, "rip_flac");
1228
    GLADE_HOOKUP_OBJECT (prefs, rip_flac, "rip_flac");
Lines 1324-1329 void enable_mp3_widgets(void) Link Here
1324
    gtk_widget_set_sensitive(lookup_widget(win_prefs, "bitrate_lbl_2"), TRUE);
1382
    gtk_widget_set_sensitive(lookup_widget(win_prefs, "bitrate_lbl_2"), TRUE);
1325
}
1383
}
1326
1384
1385
void disable_fdkaac_widgets(void)
1386
{
1387
    gtk_widget_set_sensitive(lookup_widget(win_prefs, "fdkaac_bitrate_lbl"), FALSE);
1388
    gtk_widget_set_sensitive(lookup_widget(win_prefs, "fdkaac_bitrate"), FALSE);
1389
    gtk_widget_set_sensitive(lookup_widget(win_prefs, "fdkaac_bitrate_lbl_2"), FALSE);
1390
}
1391
1392
void enable_fdkaac_widgets(void)
1393
{
1394
    gtk_widget_set_sensitive(lookup_widget(win_prefs, "fdkaac_bitrate_lbl"), TRUE);
1395
    gtk_widget_set_sensitive(lookup_widget(win_prefs, "fdkaac_bitrate"), TRUE);
1396
    gtk_widget_set_sensitive(lookup_widget(win_prefs, "fdkaac_bitrate_lbl_2"), TRUE);
1397
}
1398
1327
void disable_ogg_widgets(void)
1399
void disable_ogg_widgets(void)
1328
{
1400
{
1329
    gtk_widget_set_sensitive(lookup_widget(win_prefs, "ogg_lbl"), FALSE);
1401
    gtk_widget_set_sensitive(lookup_widget(win_prefs, "ogg_lbl"), FALSE);
(-)a/src/interface.h (+2 lines)
Lines 21-25 void disable_aac_widgets(void); Link Here
21
void enable_aac_widgets(void);
21
void enable_aac_widgets(void);
22
void disable_musepack_widgets(void);
22
void disable_musepack_widgets(void);
23
void enable_musepack_widgets(void);
23
void enable_musepack_widgets(void);
24
void disable_fdkaac_widgets(void);
25
void enable_fdkaac_widgets(void);
24
void show_aboutbox (void);
26
void show_aboutbox (void);
25
void show_completed_dialog(int numOk, int numFailed);
27
void show_completed_dialog(int numOk, int numFailed);
(-)a/src/prefs.c (-1 / +30 lines)
Lines 129-134 prefs * get_default_prefs() Link Here
129
    p->monkey_compression = 2;
129
    p->monkey_compression = 2;
130
    p->rip_aac = 0;
130
    p->rip_aac = 0;
131
    p->aac_quality = 60;
131
    p->aac_quality = 60;
132
    p->rip_fdkaac = 0;
133
    p->fdkaac_bitrate = 10;
132
    p->rip_musepack = 0;
134
    p->rip_musepack = 0;
133
    p->musepack_bitrate = 2;
135
    p->musepack_bitrate = 2;
134
    p->rip_opus = 0;
136
    p->rip_opus = 0;
Lines 195-200 void set_widgets_from_prefs(prefs * p) Link Here
195
    gtk_range_set_value(GTK_RANGE(lookup_widget(win_prefs, "monkey_compression_slider")), p->monkey_compression);
197
    gtk_range_set_value(GTK_RANGE(lookup_widget(win_prefs, "monkey_compression_slider")), p->monkey_compression);
196
    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(win_prefs, "rip_aac")), p->rip_aac);
198
    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(win_prefs, "rip_aac")), p->rip_aac);
197
    gtk_range_set_value(GTK_RANGE(lookup_widget(win_prefs, "aac_quality_slider")), p->aac_quality);
199
    gtk_range_set_value(GTK_RANGE(lookup_widget(win_prefs, "aac_quality_slider")), p->aac_quality);
200
    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(win_prefs, "rip_fdkaac")), p->rip_fdkaac);
201
    gtk_range_set_value(GTK_RANGE(lookup_widget(win_prefs, "fdkaac_bitrate")), p->fdkaac_bitrate);
198
    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(win_prefs, "rip_musepack")), p->rip_musepack);
202
    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(win_prefs, "rip_musepack")), p->rip_musepack);
199
    gtk_range_set_value(GTK_RANGE(lookup_widget(win_prefs, "musepack_bitrate_slider")), p->musepack_bitrate);
203
    gtk_range_set_value(GTK_RANGE(lookup_widget(win_prefs, "musepack_bitrate_slider")), p->musepack_bitrate);
200
    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(win_prefs, "rip_opus")), p->rip_opus);
204
    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(win_prefs, "rip_opus")), p->rip_opus);
Lines 229-234 void set_widgets_from_prefs(prefs * p) Link Here
229
        disable_monkey_widgets();
233
        disable_monkey_widgets();
230
    if( !(p->rip_aac) )
234
    if( !(p->rip_aac) )
231
        disable_aac_widgets();
235
        disable_aac_widgets();
236
    if( !(p->rip_fdkaac) )
237
        disable_fdkaac_widgets();
232
    if( !(p->rip_musepack) )
238
    if( !(p->rip_musepack) )
233
        disable_musepack_widgets();
239
        disable_musepack_widgets();
234
    if (!(p->rip_opus))
240
    if (!(p->rip_opus))
Lines 291-296 void get_prefs_from_widgets(prefs * p) Link Here
291
    p->monkey_compression = (int)gtk_range_get_value(GTK_RANGE(lookup_widget(win_prefs, "monkey_compression_slider")));
297
    p->monkey_compression = (int)gtk_range_get_value(GTK_RANGE(lookup_widget(win_prefs, "monkey_compression_slider")));
292
    p->rip_aac = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(win_prefs, "rip_aac")));
298
    p->rip_aac = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(win_prefs, "rip_aac")));
293
    p->aac_quality = (int)gtk_range_get_value(GTK_RANGE(lookup_widget(win_prefs, "aac_quality_slider")));
299
    p->aac_quality = (int)gtk_range_get_value(GTK_RANGE(lookup_widget(win_prefs, "aac_quality_slider")));
300
    p->rip_fdkaac = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(win_prefs, "rip_fdkaac")));
301
    p->fdkaac_bitrate = (int)gtk_range_get_value(GTK_RANGE(lookup_widget(win_prefs, "fdkaac_bitrate")));
294
    p->rip_musepack = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(win_prefs, "rip_musepack")));
302
    p->rip_musepack = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(win_prefs, "rip_musepack")));
295
    p->musepack_bitrate = (int)gtk_range_get_value(GTK_RANGE(lookup_widget(win_prefs, "musepack_bitrate_slider")));
303
    p->musepack_bitrate = (int)gtk_range_get_value(GTK_RANGE(lookup_widget(win_prefs, "musepack_bitrate_slider")));
296
    p->rip_opus = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(win_prefs, "rip_opus")));
304
    p->rip_opus = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(win_prefs, "rip_opus")));
Lines 448-453 void save_prefs(prefs * p) Link Here
448
        fprintf(config, "%d\n", p->rip_opus);
456
        fprintf(config, "%d\n", p->rip_opus);
449
        fprintf(config, "%d\n", p->opus_bitrate);
457
        fprintf(config, "%d\n", p->opus_bitrate);
450
        fprintf(config, "%d\n", p->do_fast_rip);
458
        fprintf(config, "%d\n", p->do_fast_rip);
459
        fprintf(config, "%d\n", p->rip_fdkaac);
460
        fprintf(config, "%d\n", p->fdkaac_bitrate);
451
        
461
        
452
        fclose(config);
462
        fclose(config);
453
    } else {
463
    } else {
Lines 640-645 void load_prefs(prefs * p) Link Here
640
        
650
        
641
        // this one can be 0
651
        // this one can be 0
642
        p->do_fast_rip = read_line_num(fd);
652
        p->do_fast_rip = read_line_num(fd);
653
654
        // this one can be 0
655
        p->rip_fdkaac = read_line_num(fd);
656
        
657
        // this one can be 0
658
        p->fdkaac_bitrate = read_line_num(fd);
643
        
659
        
644
        close(fd);
660
        close(fd);
645
    } else {
661
    } else {
Lines 772-778 bool prefs_are_valid(void) Link Here
772
        gtk_widget_destroy(warningDialog);
788
        gtk_widget_destroy(warningDialog);
773
        somethingWrong = true;
789
        somethingWrong = true;
774
    }
790
    }
775
    
791
792
    // Can't enable both AAC encoders  
793
    if (
794
        gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(win_prefs, "rip_fdkaac"))) &&
795
        gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(win_prefs, "rip_aac")))
796
        ) {
797
        warningDialog = gtk_message_dialog_new(GTK_WINDOW(win_main), GTK_DIALOG_DESTROY_WITH_PARENT,
798
                                               GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, 
799
                                               _("Can't enable both FDK-AAC and neroAAC encoders."));
800
        gtk_dialog_run(GTK_DIALOG(warningDialog));
801
        gtk_widget_destroy(warningDialog);
802
        somethingWrong = true;        
803
    }
804
776
    if(somethingWrong)
805
    if(somethingWrong)
777
        return false;
806
        return false;
778
    else
807
    else
(-)a/src/prefs.h (+2 lines)
Lines 36-41 typedef struct _prefs Link Here
36
    int monkey_compression;
36
    int monkey_compression;
37
    int rip_aac;
37
    int rip_aac;
38
    int aac_quality;
38
    int aac_quality;
39
    int rip_fdkaac;
40
    int fdkaac_bitrate;
39
    int rip_musepack;
41
    int rip_musepack;
40
    int musepack_bitrate;
42
    int musepack_bitrate;
41
    int more_formats_expanded;
43
    int more_formats_expanded;
(-)a/src/threads.c (-7 / +16 lines)
Lines 178-184 void dorip() Link Here
178
    // make sure there's at least one format to rip to
178
    // make sure there's at least one format to rip to
179
    if (!global_prefs->rip_wav && !global_prefs->rip_mp3 && !global_prefs->rip_ogg && !global_prefs->rip_opus &&
179
    if (!global_prefs->rip_wav && !global_prefs->rip_mp3 && !global_prefs->rip_ogg && !global_prefs->rip_opus &&
180
        !global_prefs->rip_flac && !global_prefs->rip_wavpack && !global_prefs->rip_monkey &&
180
        !global_prefs->rip_flac && !global_prefs->rip_wavpack && !global_prefs->rip_monkey &&
181
        !global_prefs->rip_musepack && !global_prefs->rip_aac)
181
        !global_prefs->rip_musepack && !global_prefs->rip_aac && !global_prefs->rip_fdkaac)
182
    {
182
    {
183
        GtkWidget * dialog;
183
        GtkWidget * dialog;
184
        dialog = gtk_message_dialog_new(GTK_WINDOW(win_main), 
184
        dialog = gtk_message_dialog_new(GTK_WINDOW(win_main), 
Lines 327-333 void dorip() Link Here
327
            
327
            
328
            free(filename);
328
            free(filename);
329
        }
329
        }
330
        if (global_prefs->rip_aac)
330
        if (global_prefs->rip_aac || global_prefs->rip_fdkaac)
331
        {
331
        {
332
            char * filename = make_filename(prefs_get_music_dir(global_prefs), albumdir, playlist, "m4a.m3u");
332
            char * filename = make_filename(prefs_get_music_dir(global_prefs), albumdir, playlist, "m4a.m3u");
333
            
333
            
Lines 1088-1094 gpointer encode(gpointer data) Link Here
1088
                }
1088
                }
1089
                free(musepackfilename);
1089
                free(musepackfilename);
1090
            }
1090
            }
1091
            if (global_prefs->rip_aac)
1091
            if (global_prefs->rip_aac || global_prefs->rip_fdkaac)
1092
            {
1092
            {
1093
                if (aborted)
1093
                if (aborted)
1094
                {
1094
                {
Lines 1133-1142 gpointer encode(gpointer data) Link Here
1133
                
1133
                
1134
                if(doEncode)
1134
                if(doEncode)
1135
                {
1135
                {
1136
                    aac(tracknum, trackartist, album_title, tracktitle, album_genre, album_year,
1136
                    if (global_prefs->rip_fdkaac) {
1137
                        wavfilename, aacfilename,
1137
                        fdkaac(tracknum, trackartist, album_title, tracktitle, album_genre, album_year,
1138
                        global_prefs->aac_quality, 
1138
                            wavfilename, aacfilename,
1139
                        &aac_percent);
1139
                            global_prefs->fdkaac_bitrate,
1140
                            &aac_percent);
1141
                    } else {
1142
                        aac(tracknum, trackartist, album_title, tracktitle, album_genre, album_year,
1143
                            wavfilename, aacfilename,
1144
                            global_prefs->aac_quality,
1145
                            &aac_percent);
1146
                    }
1140
                }
1147
                }
1141
                
1148
                
1142
                if (playlist_aac)
1149
                if (playlist_aac)
Lines 1271-1276 gpointer track(gpointer data) Link Here
1271
        parts++;
1278
        parts++;
1272
    if(global_prefs->rip_aac) 
1279
    if(global_prefs->rip_aac) 
1273
        parts++;
1280
        parts++;
1281
    if(global_prefs->rip_fdkaac)
1282
        parts++;
1274
    
1283
    
1275
    gdk_threads_enter();
1284
    gdk_threads_enter();
1276
        GtkProgressBar * progress_total = GTK_PROGRESS_BAR(lookup_widget(win_ripping, "progress_total"));
1285
        GtkProgressBar * progress_total = GTK_PROGRESS_BAR(lookup_widget(win_ripping, "progress_total"));
(-)a/src/wrappers.c (+136 lines)
Lines 38-43 pid_t wavpack_pid; Link Here
38
pid_t monkey_pid;
38
pid_t monkey_pid;
39
pid_t musepack_pid;
39
pid_t musepack_pid;
40
pid_t aac_pid;
40
pid_t aac_pid;
41
pid_t fdkaac_pid;
41
42
42
int numCdparanoiaFailed;
43
int numCdparanoiaFailed;
43
int numLameFailed;
44
int numLameFailed;
Lines 96-101 extern pid_t wavpack_pid; Link Here
96
extern pid_t monkey_pid;
97
extern pid_t monkey_pid;
97
extern pid_t musepack_pid;
98
extern pid_t musepack_pid;
98
extern pid_t aac_pid;
99
extern pid_t aac_pid;
100
extern pid_t fdkaac_pid;
99
101
100
// Signal handler to find out when our child has exited.
102
// Signal handler to find out when our child has exited.
101
// Do not pot any printf or syslog into here, it causes a deadlock.
103
// Do not pot any printf or syslog into here, it causes a deadlock.
Lines 159-164 void sigchld(int signum) Link Here
159
            aac_pid = 0;
161
            aac_pid = 0;
160
            numAacFailed++;
162
            numAacFailed++;
161
        }
163
        }
164
        else if (pid == fdkaac_pid)
165
        {
166
            fdkaac_pid = 0;
167
            numAacFailed++;
168
        }
162
    }
169
    }
163
    else
170
    else
164
    {
171
    {
Lines 208-213 void sigchld(int signum) Link Here
208
            aac_pid = 0;
215
            aac_pid = 0;
209
            numAacOk++;
216
            numAacOk++;
210
        }
217
        }
218
        else if (pid == fdkaac_pid)
219
        {
220
            fdkaac_pid = 0;
221
            numAacOk++;
222
        }
211
    }
223
    }
212
}
224
}
213
225
Lines 1460-1462 void aac(int tracknum, Link Here
1460
    }
1472
    }
1461
    *progress = 1;
1473
    *progress = 1;
1462
}
1474
}
1475
1476
void fdkaac(int tracknum,
1477
         const char * artist,
1478
         const char * album,
1479
         const char * title,
1480
         const char * genre,
1481
         const char * year,
1482
         const char* wavfilename,
1483
         const char* aacfilename,
1484
         int bitrate,
1485
         double* progress)
1486
{
1487
    const char* args[21];
1488
    char bitrate_text[4];
1489
    int fd;
1490
    int pos;
1491
1492
    pos = 0;
1493
    args[pos++] = "fdkaac";
1494
1495
    /* fdkaac has a VBR option but it's unsupported */
1496
    args[pos++] = "-m";
1497
    args[pos++] = "0";
1498
    args[pos++] = "-b";
1499
    snprintf(bitrate_text, 4, "%d", int_to_bitrate(bitrate, 0));
1500
    args[pos++] = bitrate_text;
1501
1502
1503
    char track[4];
1504
    if (tracknum > 0 && tracknum < 100)
1505
    {
1506
        snprintf(track, 4, "%d", tracknum);
1507
        args[pos++] = "--track";
1508
        args[pos++] = track;
1509
    }
1510
1511
    if ((title != NULL) && (strlen(title) > 0))
1512
    {
1513
        args[pos++] = "--title";
1514
        args[pos++] = title;
1515
    }
1516
1517
    if ((artist != NULL) && (strlen(artist) > 0))
1518
    {
1519
        args[pos++] = "--artist";
1520
        args[pos++] = artist;
1521
    }
1522
1523
    if ((album != NULL) && (strlen(album) > 0))
1524
    {
1525
        args[pos++] = "--album";
1526
        args[pos++] = album;
1527
    }
1528
1529
    if ((genre != NULL) && (strlen(genre) > 0))
1530
    {
1531
        args[pos++] = "--genre";
1532
        args[pos++] = genre;
1533
    }
1534
1535
    if ((year != NULL) && (strlen(year) > 0))
1536
    {
1537
        args[pos++] = "--date";
1538
        args[pos++] = year;
1539
    }
1540
1541
    args[pos++] = "-o";
1542
    args[pos++] = aacfilename;
1543
1544
    args[pos++] = wavfilename;
1545
1546
    args[pos++] = NULL;
1547
1548
    fd = exec_with_output(args, STDERR_FILENO, &fdkaac_pid, NULL);
1549
1550
    int size;
1551
    char buf[256];
1552
1553
    do
1554
    {
1555
        pos = -1;
1556
        bool interrupted;
1557
        do
1558
        {
1559
            interrupted = FALSE;
1560
1561
            pos++;
1562
            size = read(fd, &buf[pos], 1);
1563
1564
            if (size == -1 && errno == EINTR)
1565
            /* signal interrupted read(), try again */
1566
            {
1567
                pos--;
1568
                debugLog("fdkaac() interrupted");
1569
                interrupted = TRUE;
1570
            }
1571
1572
        } while ((size > 0 && pos < 255 && buf[pos] != '\r' && buf[pos] != '\n') || interrupted);
1573
1574
        buf[pos] = '\0';
1575
1576
        /* We get lines like this:
1577
            [28%] 00:14.037/00:49.771 (22x), ETA 00:01.599
1578
        */
1579
        if ((pos >= 4) && (buf[0] == '[')) {
1580
            int percent = 0;
1581
            if (sscanf(buf, "[%d%%]", &percent) == 1)
1582
            {
1583
                *progress = (double) percent / 100.0;
1584
            }
1585
        }
1586
    } while (size > 0);
1587
1588
    close(fd);
1589
1590
    /* don't go on until the signal for the previous call is handled */
1591
    while (fdkaac_pid != 0)
1592
    {
1593
        debugLog("w12\n");
1594
        usleep(100000);
1595
    }
1596
1597
    *progress = 1;
1598
}
(-)a/src/wrappers.h (+12 lines)
Lines 10-15 extern pid_t wavpack_pid; Link Here
10
extern pid_t monkey_pid;
10
extern pid_t monkey_pid;
11
extern pid_t musepack_pid;
11
extern pid_t musepack_pid;
12
extern pid_t aac_pid;
12
extern pid_t aac_pid;
13
extern pid_t fdkaac_pid;
13
14
14
extern int numCdparanoiaFailed;
15
extern int numCdparanoiaFailed;
15
extern int numLameFailed;
16
extern int numLameFailed;
Lines 206-208 void aac(int tracknum, Link Here
206
         const char* aacfilename,
207
         const char* aacfilename,
207
         int quality,
208
         int quality,
208
         double* progress);
209
         double* progress);
210
211
void fdkaac(int tracknum,
212
         const char * artist,
213
         const char * album,
214
         const char * title,
215
         const char * genre,
216
         const char * year,
217
         const char* wavfilename,
218
         const char* aacfilename,
219
         int bitrate,
220
         double* progress);

Return to bug 54