static uint32_t aac_afh_read_cb(void *user_data, void *dest, uint32_t want)
{
struct aac_afh_context *c = user_data;
- uint32_t have, rv;
+ size_t have, rv;
if (want == 0 || c->fpos >= c->mapsize)
return 0;
have = c->mapsize - c->fpos;
- rv = PARA_MIN(have, want);
- PARA_DEBUG_LOG("reading %u bytes @%zu\n", rv, c->fpos);
+ rv = PARA_MIN(have, (size_t)want);
+ PARA_DEBUG_LOG("reading %zu bytes @%zu\n", rv, c->fpos);
memcpy(dest, c->map + c->fpos, rv);
c->fpos += rv;
return rv;
*/
int32_t mp4ff_set_sample_position(mp4ff_t *f, const int32_t track, const int32_t sample);
-static int aac_afh_get_chunk(long unsigned chunk_num, void *afh_context,
- const char **buf, size_t *len)
+static int aac_afh_get_chunk(uint32_t chunk_num, void *afh_context,
+ const char **buf, uint32_t *len)
{
struct aac_afh_context *c = afh_context;
int32_t ss;
struct aac_afh_context *c;
int64_t tmp;
const char *buf;
- size_t sz;
- uint32_t n;
+ uint32_t n, len;
ret = aac_afh_open(map, numbytes, (void **)&c);
if (ret < 0)
afhi->chunks_total = rv;
afhi->max_chunk_size = 0;
for (n = 0; n < afhi->chunks_total; n++) {
- if (aac_afh_get_chunk(n, c, &buf, &sz) < 0)
+ if (aac_afh_get_chunk(n, c, &buf, &len) < 0)
break;
- afhi->max_chunk_size = PARA_MAX((size_t)afhi->max_chunk_size, sz);
+ afhi->max_chunk_size = PARA_MAX(afhi->max_chunk_size, len);
}
tmp = c->masc.sbr_present_flag == 1? 2048 : 1024;
afhi->seconds_total = tmp * afhi->chunks_total / afhi->frequency;
ms2tv(1000 * tmp / afhi->frequency, &afhi->chunk_tv);
- if (aac_afh_get_chunk(0, c, &buf, &sz) >= 0)
+ if (aac_afh_get_chunk(0, c, &buf, &len) >= 0)
numbytes -= buf - map;
afhi->bitrate = 8 * numbytes / afhi->seconds_total / 1000;
_aac_afh_get_taginfo(c->mp4ff, &afhi->tags);
struct timeval tv;
long unsigned from, to;
const char *buf;
- size_t len;
+ uint32_t len;
tv_scale(i, &afhi->chunk_tv, &tv);
from = tv2ms(&tv);
tv_scale(i + 1, &afhi->chunk_tv, &tv);
printf("%td - %td", buf - (const char *)map,
buf + len - (const char *)map);
if (!OPT_GIVEN(PARSER_FRIENDLY))
- printf(" (%zu)", len);
+ printf(" (%u)", len);
printf("\n");
}
afh_close(ctx, audio_format_id);
* portion of the memory mapped audio file. The caller must not call
* free() on it.
*/
- int (*get_chunk)(long unsigned chunk_num, void *afh_context,
- const char **buf, size_t *len);
+ int (*get_chunk)(uint32_t chunk_num, void *afh_context,
+ const char **buf, uint32_t *len);
/** Deallocate the resources occupied by ->open(). */
void (*close)(void *afh_context);
/**
const char *audio_format_name(int);
__must_check int afh_get_chunk(long unsigned chunk_num, struct afh_info *afhi,
uint8_t audio_format_id, const void *map, size_t mapsize,
- const char **buf, size_t *len, void **afh_context);
+ const char **buf, uint32_t *len, void **afh_context);
void afh_close(void *afh_context, uint8_t audio_format_id);
int32_t afh_get_start_chunk(int32_t approx_chunk_num,
const struct afh_info *afhi, uint8_t audio_format_id);
free(afhi->tags.comment);
}
-static inline size_t get_chunk_len(long unsigned chunk_num,
+static inline uint32_t get_chunk_len(long unsigned chunk_num,
const struct afh_info *afhi)
{
return afhi->chunk_table[chunk_num + 1] - afhi->chunk_table[chunk_num];
*/
__must_check int afh_get_chunk(long unsigned chunk_num, struct afh_info *afhi,
uint8_t audio_format_id, const void *map, size_t mapsize,
- const char **buf, size_t *len, void **afh_context)
+ const char **buf, uint32_t *len, void **afh_context)
{
struct audio_format_handler *afh = afl[audio_format_id];
char *buf;
const char *start;
size_t size;
+ uint32_t len;
struct timeval chunk_time;
unsigned j_given = RECV_CMD_OPT_GIVEN(AFH, JUST_IN_TIME, lpr);
unsigned H_given = RECV_CMD_OPT_GIVEN(AFH, NO_HEADER, lpr);
long unsigned n;
for (n = pard->first_chunk; n < pard->last_chunk; n++) {
ret = afh_get_chunk(n, afhi, pard->audio_format_num,
- pard->map, pard->map_size, &start, &size,
+ pard->map, pard->map_size, &start, &len,
&pard->afh_context);
if (ret < 0)
goto out;
- PARA_DEBUG_LOG("adding %zu bytes\n", size);
- btr_add_output_dont_free(start, size, btrn);
+ PARA_DEBUG_LOG("adding %u bytes\n", len);
+ btr_add_output_dont_free(start, len, btrn);
}
ret = -E_RECV_EOF;
goto out;
}
ret = afh_get_chunk(pard->current_chunk, afhi,
pard->audio_format_num, pard->map,
- pard->map_size, &start, &size,
+ pard->map_size, &start, &len,
&pard->afh_context);
if (ret < 0)
goto out;
PARA_DEBUG_LOG("adding chunk %u\n", pard->current_chunk);
- btr_add_output_dont_free(start, size, btrn);
+ btr_add_output_dont_free(start, len, btrn);
if (pard->current_chunk >= pard->last_chunk) {
ret = -E_RECV_EOF;
goto out;
}
static int vss_get_chunk(int chunk_num, struct vss_task *vsst,
- char **buf, size_t *sz)
+ char **buf, uint32_t *len)
{
int ret;
if (chunk_num == 0 && vsst->header_len > 0) {
assert(vsst->header_buf);
*buf = vsst->header_buf; /* stripped header */
- *sz = vsst->header_len;
+ *len = vsst->header_len;
return 0;
}
ret = afh_get_chunk(chunk_num, &mmd->afd.afhi,
mmd->afd.audio_format_id, vsst->map, vsst->mapsize,
- (const char **)buf, sz, &vsst->afh_context);
+ (const char **)buf, len, &vsst->afh_context);
if (ret < 0) {
*buf = NULL;
- *sz = 0;
+ *len = 0;
}
return ret;
}
int max_bytes)
{
char *buf;
- size_t len;
+ uint32_t len;
int ret, i, max_chunks = PARA_MAX(1LU, 150 / tv2ms(vss_chunk_time()));
if (g->first_chunk == 0) {
slice_copied = 0;
for (c = g->first_chunk; c < g->first_chunk + g->num_chunks; c++) {
char *buf;
- size_t src_len;
+ uint32_t src_len;
ret = vss_get_chunk(c, vsst, &buf, &src_len);
if (ret < 0)
return ret;
struct timeval due;
struct fec_client *fc, *tmp_fc;
char *buf;
- size_t len;
+ uint32_t len;
if (!vsst->map || !vss_playing())
return;