Skip to content

Commit

Permalink
rename start/end sample variables back to 0.7.2 names, to avoid break…
Browse files Browse the repository at this point in the history
…ing API
  • Loading branch information
wdlkmpx authored and Oleksiy-Yakovenko committed Dec 5, 2017
1 parent 779ac7a commit 4324136
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions deadbeef.h
Expand Up @@ -245,8 +245,8 @@ enum {
// playlist item
// these are "public" fields, available to plugins
typedef struct DB_playItem_s {
int32_t startsample32; // start sample of track, or -1 for auto
int32_t endsample32; // end sample of track, or -1 for auto
int32_t startsample; // start sample of track, or -1 for auto
int32_t endsample; // end sample of track, or -1 for auto
int32_t shufflerating; // sort order for shuffle mode
} ddb_playItem_t;

Expand Down
20 changes: 10 additions & 10 deletions playlist.c
Expand Up @@ -1514,8 +1514,8 @@ pl_insert_item (playItem_t *after, playItem_t *it) {
void
pl_item_copy (playItem_t *out, playItem_t *it) {
LOCK;
out->startsample32 = it->startsample32;
out->endsample32 = it->endsample32;
out->startsample = it->startsample;
out->endsample = it->endsample;
out->startsample64 = it->startsample64;
out->endsample64 = it->endsample64;
out->shufflerating = it->shufflerating;
Expand Down Expand Up @@ -1724,10 +1724,10 @@ plt_save (playlist_t *plt, playItem_t *first, playItem_t *last, const char *fnam
goto save_fail;
}
#endif
if (fwrite (&it->startsample32, 1, 4, fp) != 4) {
if (fwrite (&it->startsample, 1, 4, fp) != 4) {
goto save_fail;
}
if (fwrite (&it->endsample32, 1, 4, fp) != 4) {
if (fwrite (&it->endsample, 1, 4, fp) != 4) {
goto save_fail;
}
if (fwrite (&it->_duration, 1, 4, fp) != 4) {
Expand Down Expand Up @@ -2031,11 +2031,11 @@ plt_load_int (int visibility, playlist_t *plt, playItem_t *after, const char *fn
pl_set_meta_int (it, ":TRACKNUM", tracknum);
}
// startsample
if (fread (&it->startsample32, 1, 4, fp) != 4) {
if (fread (&it->startsample, 1, 4, fp) != 4) {
goto load_fail;
}
// endsample
if (fread (&it->endsample32, 1, 4, fp) != 4) {
if (fread (&it->endsample, 1, 4, fp) != 4) {
goto load_fail;
}
// duration
Expand Down Expand Up @@ -3792,31 +3792,31 @@ pl_configchanged (void) {
int64_t
pl_item_get_startsample (playItem_t *it) {
if (!it->has_startsample64) {
return it->startsample32;
return it->startsample;
}
return it->startsample64;
}

int64_t
pl_item_get_endsample (playItem_t *it) {
if (!it->has_endsample64) {
return it->endsample32;
return it->endsample;
}
return it->endsample64;
}

void
pl_item_set_startsample (playItem_t *it, int64_t sample) {
it->startsample64 = sample;
it->startsample32 = sample >= 0x7fffffff ? 0x7fffffff : (int32_t)sample;
it->startsample = sample >= 0x7fffffff ? 0x7fffffff : (int32_t)sample;
it->has_startsample64 = 1;
pl_set_meta_int64 (it, ":STARTSAMPLE", sample);
}

void
pl_item_set_endsample (playItem_t *it, int64_t sample) {
it->endsample64 = sample;
it->endsample32 = sample >= 0x7fffffff ? 0x7fffffff : (int32_t)sample;
it->endsample = sample >= 0x7fffffff ? 0x7fffffff : (int32_t)sample;
it->has_endsample64 = 1;
pl_set_meta_int64 (it, ":ENDSAMPLE", sample);
}
Expand Down
4 changes: 2 additions & 2 deletions playlist.h
Expand Up @@ -41,8 +41,8 @@
// :DURATION - length in seconds

typedef struct playItem_s {
int32_t startsample32;
int32_t endsample32;
int32_t startsample;
int32_t endsample;
int32_t shufflerating; // sort order for shuffle mode

int64_t startsample64;
Expand Down

0 comments on commit 4324136

Please sign in to comment.