Mercurial > audlegacy-plugins
comparison src/vorbis/fileinfo.c @ 1978:fa9f85cebade
s/vfs_/aud_vfs_/g
author | William Pitcock <nenolod@atheme.org> |
---|---|
date | Sun, 07 Oct 2007 00:25:33 -0500 |
parents | 6acf1bda788b |
children | 2ffc6a69fcd1 |
comparison
equal
deleted
inserted
replaced
1977:5a6b60ceaa0f | 1978:fa9f85cebade |
---|---|
357 } | 357 } |
358 | 358 |
359 static gint | 359 static gint |
360 init_files(vcedit_state * state) | 360 init_files(vcedit_state * state) |
361 { | 361 { |
362 if ((vte.in = vfs_fopen(vte.filename, "rb")) == NULL) { | 362 if ((vte.in = aud_vfs_fopen(vte.filename, "rb")) == NULL) { |
363 #ifdef DEBUG | 363 #ifdef DEBUG |
364 g_message("fileinfo.c: couldn't open file %s", vte.filename); | 364 g_message("fileinfo.c: couldn't open file %s", vte.filename); |
365 #endif | 365 #endif |
366 return -1; | 366 return -1; |
367 } | 367 } |
369 if (vcedit_open(state, vte.in) < 0) { | 369 if (vcedit_open(state, vte.in) < 0) { |
370 #ifdef DEBUG | 370 #ifdef DEBUG |
371 g_message("fileinfo.c: couldn't open file for editing %s", | 371 g_message("fileinfo.c: couldn't open file for editing %s", |
372 vte.filename); | 372 vte.filename); |
373 #endif | 373 #endif |
374 vfs_fclose(vte.in); | 374 aud_vfs_fclose(vte.in); |
375 return -1; | 375 return -1; |
376 } | 376 } |
377 | 377 |
378 #ifdef DEBUG | 378 #ifdef DEBUG |
379 g_message("fileinfo.c: file successfully opened for editing %s", | 379 g_message("fileinfo.c: file successfully opened for editing %s", |
392 | 392 |
393 tmpfn = g_strdup_printf("%s.XXXXXX", vte.filename); | 393 tmpfn = g_strdup_printf("%s.XXXXXX", vte.filename); |
394 | 394 |
395 if ((ofh = mkstemp(tmpfn)) < 0) { | 395 if ((ofh = mkstemp(tmpfn)) < 0) { |
396 g_free(tmpfn); | 396 g_free(tmpfn); |
397 vfs_fclose(vte.in); | 397 aud_vfs_fclose(vte.in); |
398 #ifdef DEBUG | 398 #ifdef DEBUG |
399 g_critical("fileinfo.c: couldn't create temp file"); | 399 g_critical("fileinfo.c: couldn't create temp file"); |
400 #endif | 400 #endif |
401 return -1; | 401 return -1; |
402 } | 402 } |
404 #ifdef DEBUG | 404 #ifdef DEBUG |
405 g_message("fileinfo.c: created temp file %s", tmpfn); | 405 g_message("fileinfo.c: created temp file %s", tmpfn); |
406 #endif | 406 #endif |
407 } | 407 } |
408 | 408 |
409 if ((out = vfs_fopen(tmpfn, "wb")) == NULL) { | 409 if ((out = aud_vfs_fopen(tmpfn, "wb")) == NULL) { |
410 close(ofh); | 410 close(ofh); |
411 remove(tmpfn); | 411 remove(tmpfn); |
412 g_free(tmpfn); | 412 g_free(tmpfn); |
413 vfs_fclose(vte.in); | 413 aud_vfs_fclose(vte.in); |
414 #ifdef DEBUG | 414 #ifdef DEBUG |
415 g_critical("fileinfo.c: couldn't open temp file"); | 415 g_critical("fileinfo.c: couldn't open temp file"); |
416 #endif | 416 #endif |
417 return -1; | 417 return -1; |
418 } | 418 } |
427 g_warning("vcedit_write: %s", state->lasterror); | 427 g_warning("vcedit_write: %s", state->lasterror); |
428 #endif | 428 #endif |
429 retval = -1; | 429 retval = -1; |
430 } | 430 } |
431 | 431 |
432 vfs_fclose(vte.in); | 432 aud_vfs_fclose(vte.in); |
433 | 433 |
434 if (vfs_fclose(out) != 0) { | 434 if (aud_vfs_fclose(out) != 0) { |
435 #ifdef DEBUG | 435 #ifdef DEBUG |
436 g_critical("fileinfo.c: couldn't close out file"); | 436 g_critical("fileinfo.c: couldn't close out file"); |
437 #endif | 437 #endif |
438 retval = -1; | 438 retval = -1; |
439 } | 439 } |
925 gtk_label_set_text(GTK_LABEL(length_label_val), _("N/A")); | 925 gtk_label_set_text(GTK_LABEL(length_label_val), _("N/A")); |
926 | 926 |
927 gtk_label_set_text(GTK_LABEL(filesize_label), _("File size:")); | 927 gtk_label_set_text(GTK_LABEL(filesize_label), _("File size:")); |
928 gtk_label_set_text(GTK_LABEL(filesize_label_val), _("N/A")); | 928 gtk_label_set_text(GTK_LABEL(filesize_label_val), _("N/A")); |
929 | 929 |
930 if ((fh->fd = vfs_fopen(vte.filename, "r")) != NULL) { | 930 if ((fh->fd = aud_vfs_fopen(vte.filename, "r")) != NULL) { |
931 g_mutex_lock(vf_mutex); | 931 g_mutex_lock(vf_mutex); |
932 | 932 |
933 if (ov_open_callbacks(fh, &vf, NULL, 0, vorbis_callbacks) == 0) { | 933 if (ov_open_callbacks(fh, &vf, NULL, 0, vorbis_callbacks) == 0) { |
934 comment = ov_comment(&vf, -1); | 934 comment = ov_comment(&vf, -1); |
935 if ((vi = ov_info(&vf, 0)) != NULL) { | 935 if ((vi = ov_info(&vf, 0)) != NULL) { |
949 } | 949 } |
950 | 950 |
951 time = ov_time_total(&vf, -1); | 951 time = ov_time_total(&vf, -1); |
952 minutes = time / 60; | 952 minutes = time / 60; |
953 seconds = time % 60; | 953 seconds = time % 60; |
954 vfs_fseek(fh->fd, 0, SEEK_END); | 954 aud_vfs_fseek(fh->fd, 0, SEEK_END); |
955 filesize = vfs_ftell(fh->fd); | 955 filesize = aud_vfs_ftell(fh->fd); |
956 | 956 |
957 label_set_text(GTK_LABEL(bitrate_label_val), | 957 label_set_text(GTK_LABEL(bitrate_label_val), |
958 _("%d KBit/s (nominal)"), bitrate); | 958 _("%d KBit/s (nominal)"), bitrate); |
959 label_set_text(GTK_LABEL(rate_label_val), _("%d Hz"), rate); | 959 label_set_text(GTK_LABEL(rate_label_val), _("%d Hz"), rate); |
960 label_set_text(GTK_LABEL(channel_label_val), _("%d"), channels); | 960 label_set_text(GTK_LABEL(channel_label_val), _("%d"), channels); |
963 label_set_text(GTK_LABEL(filesize_label_val), | 963 label_set_text(GTK_LABEL(filesize_label_val), |
964 _("%d Bytes"), filesize); | 964 _("%d Bytes"), filesize); |
965 | 965 |
966 } | 966 } |
967 else | 967 else |
968 vfs_fclose(fh->fd); | 968 aud_vfs_fclose(fh->fd); |
969 } | 969 } |
970 | 970 |
971 rg_track_gain = get_comment(comment, "replaygain_track_gain"); | 971 rg_track_gain = get_comment(comment, "replaygain_track_gain"); |
972 if (*rg_track_gain == '\0') | 972 if (*rg_track_gain == '\0') |
973 rg_track_gain = get_comment(comment, "rg_radio"); /* Old */ | 973 rg_track_gain = get_comment(comment, "rg_radio"); /* Old */ |
1046 /* ov_clear closes the file */ | 1046 /* ov_clear closes the file */ |
1047 if (clear_vf) ov_clear(&vf); | 1047 if (clear_vf) ov_clear(&vf); |
1048 g_mutex_unlock(vf_mutex); | 1048 g_mutex_unlock(vf_mutex); |
1049 | 1049 |
1050 | 1050 |
1051 gtk_widget_set_sensitive(tag_frame, vfs_is_writeable(vte.filename)); | 1051 gtk_widget_set_sensitive(tag_frame, aud_vfs_is_writeable(vte.filename)); |
1052 | 1052 |
1053 g_signal_connect_swapped(title_entry, "changed", change_buttons, | 1053 g_signal_connect_swapped(title_entry, "changed", change_buttons, |
1054 save_button); | 1054 save_button); |
1055 g_signal_connect_swapped(performer_entry, "changed", change_buttons, | 1055 g_signal_connect_swapped(performer_entry, "changed", change_buttons, |
1056 save_button); | 1056 save_button); |