Skip to content

Commit

Permalink
fixed for scaling type ASCII strings
Browse files Browse the repository at this point in the history
  • Loading branch information
dnewman-gpsw committed Aug 20, 2020
1 parent 5b0be4f commit 7d12173
Showing 1 changed file with 28 additions and 26 deletions.
54 changes: 28 additions & 26 deletions demo/GPMF_demo.c
Original file line number Diff line number Diff line change
Expand Up @@ -333,39 +333,41 @@ int main(int argc, char* argv[])
}

//GPMF_FormattedData(ms, tmpbuffer, buffersize, 0, samples); // Output data in LittleEnd, but no scale
GPMF_ScaledData(ms, tmpbuffer, buffersize, 0, samples, GPMF_TYPE_DOUBLE); //Output scaled data as floats

ptr = tmpbuffer;
int pos = 0;
for (i = 0; i < samples; i++)
if (GPMF_OK == GPMF_ScaledData(ms, tmpbuffer, buffersize, 0, samples, GPMF_TYPE_DOUBLE))//Output scaled data as floats
{
printf(" %c%c%c%c ", PRINTF_4CC(key));

for (j = 0; j < elements; j++)
ptr = tmpbuffer;
int pos = 0;
for (i = 0; i < samples; i++)
{
if (type == GPMF_TYPE_STRING_ASCII)
{
printf("%c", rawdata[pos]);
pos++;
ptr++;
}
else if (type_samples == 0) //no TYPE structure
printf("%.3f%s, ", *ptr++, units[j % unit_samples]);
else if (complextype[j] != 'F')
{
printf("%.3f%s, ", *ptr++, units[j % unit_samples]);
pos += GPMF_SizeofType((GPMF_SampleType)complextype[j]);
}
else if (type_samples && complextype[j] == GPMF_TYPE_FOURCC)
printf(" %c%c%c%c ", PRINTF_4CC(key));

for (j = 0; j < elements; j++)
{
ptr++;
printf("%c%c%c%c, ", rawdata[pos], rawdata[pos + 1], rawdata[pos + 2], rawdata[pos + 3]);
pos += GPMF_SizeofType((GPMF_SampleType)complextype[j]);
if (type == GPMF_TYPE_STRING_ASCII)
{
printf("%c", rawdata[pos]);
pos++;
ptr++;
}
else if (type_samples == 0) //no TYPE structure
printf("%.3f%s, ", *ptr++, units[j % unit_samples]);
else if (complextype[j] != 'F')
{
printf("%.3f%s, ", *ptr++, units[j % unit_samples]);
pos += GPMF_SizeofType((GPMF_SampleType)complextype[j]);
}
else if (type_samples && complextype[j] == GPMF_TYPE_FOURCC)
{
ptr++;
printf("%c%c%c%c, ", rawdata[pos], rawdata[pos + 1], rawdata[pos + 2], rawdata[pos + 3]);
pos += GPMF_SizeofType((GPMF_SampleType)complextype[j]);
}
}
}


printf("\n");
printf("\n");
}
}
free(tmpbuffer);
}
Expand Down

0 comments on commit 7d12173

Please sign in to comment.