Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
DISCONTINUED:openSUSE:11.1:Update
grip
grip-flac-progress.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File grip-flac-progress.patch of Package grip
- fix progress display when encoding using flac The first hunk is actally not related to flac encoding but to ripping in general: - Allow for 1.5 seconds for CD-ROM drive spinup until speed and progress metering starts, avoids starting with very low speed indication. The remaining 3 hunks apply to encoding to a .flac file, Using a value which is too low causes the progress bar to reach 100% a while before encoding is actually finished. Tests with many CDs show that a value of 980 kbits is safe. The changes are specifically only for progress display, evaluation of %b (bitrate) is not changed. - fix for precision problems at start of ripping: The fix is to do this: - elapsed = (gfloat)now - (gfloat)ginfo->rip_started; + elapsed = now - ginfo->rip_started; now and rip_started are two time_t values (seconds since epoch), so they are signed long int's on x86_64, so it's not a good idea to cast two such time values which differ only by a few bits to a single-precision float before substracting the who floats in order to get the difference between these seconds, and assuming that the result would be difference between these values. Unfortunately, with this data conversion loss, the result of the calculation has only 128 second precision and not 1 second precision as it should be. Removed also a previous approach which was supposed to help but is obsoleted by this fix. - use the same fix also for calculating the progress of encoding, there, the same cast flaw was present and it had the same result. - added hunk to remove warnings because of 4 unused variables --- grip/src/rip.c +++ grip/src/rip.c @@ -805,7 +805,7 @@ gtk_progress_bar_update(GTK_PROGRESS_BAR(uinfo->ripprogbar),percent); now = time(NULL); - elapsed = (gfloat)now - (gfloat)ginfo->rip_started; + elapsed = now - ginfo->rip_started; /* 1x is 44100*2*2 = 176400 bytes/sec */ if(elapsed < 0.1f) /* 1/10 sec. */ @@ -935,7 +935,7 @@ percent); now = time(NULL); - elapsed = (gfloat)now - (gfloat)ginfo->mp3_started[mycpu]; + elapsed = now - ginfo->mp3_started[mycpu]; if(elapsed < 0.1f) /* 1/10 sec. */ speed=0.0f; @@ -939,6 +939,12 @@ if(elapsed < 0.1f) /* 1/10 sec. */ speed=0.0f; +#define FLAC_BITRATE 980 + // Quick fix until we can add per-encoder bitrates: + else if (!strcmp(ginfo->mp3extension, "flac") + && ginfo->kbits_per_sec < FLAC_BITRATE) + speed=(gfloat)mystat.st_size/ + (FLAC_BITRATE * 128.0f * elapsed); else speed=(gfloat)mystat.st_size/ ((gfloat)ginfo->kbits_per_sec * 128.0f * elapsed); @@ -1100,8 +1100,6 @@ { static char res[PATH_MAX]; EncodeTrack *enc_track; - gchar *conv_str,*st; - gsize rb,wb; enc_track=(EncodeTrack *)data; @@ -1711,6 +1724,13 @@ unlink(ginfo->mp3file[cpu]); + // Quick fix until we can add per-encoder bitrates + if (!strcmp(ginfo->mp3extension, "flac") + && ginfo->kbits_per_sec < FLAC_BITRATE) + ginfo->mp3size[cpu]= + (int)((gfloat)((enc_track->end_frame-enc_track->start_frame)+1)* + (gfloat)(FLAC_BITRATE*1024)/600.0); + else ginfo->mp3size[cpu]= (int)((gfloat)((enc_track->end_frame-enc_track->start_frame)+1)* (gfloat)(ginfo->kbits_per_sec*1024)/600.0); @@ -1811,6 +1831,13 @@ static size_t CalculateEncSize(GripInfo *ginfo, int track) { double tmp_encsize=0.0; + // Quick fix until we can add per-encoder bitrates: + if (!strcmp(ginfo->mp3extension, "flac") + && ginfo->kbits_per_sec < FLAC_BITRATE) + tmp_encsize=(double)((ginfo->disc.track[track].length.mins*60+ + ginfo->disc.track[track].length.secs-2)* + FLAC_BITRATE*1024/8); + else /* It's not the best way, but i couldn't find anything better */ tmp_encsize=(double)((ginfo->disc.track[track].length.mins*60+ ginfo->disc.track[track].length.secs-2)*
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor