Lines Matching defs:index
420 uint32_t index = av_bswap32(atom.type); // BE number has been read as LE
421 if (index < c->meta_keys_count && index > 0) {
422 key = c->meta_keys[index];
425 "The index of 'data' is out of range: %"PRId32" < 1 or >= %d.\n",
426 index, c->meta_keys_count);
1240 int index,
1246 if (index < 0 || index >= frag_index->nb_items)
1248 item = &frag_index->item[index];
1328 int index, int track_id)
1335 frag_stream_info = get_frag_stream_info(frag_index, index, track_id);
1343 for (i = 0; i < frag_index->item[index].nb_stream_info; i++) {
1344 frag_stream_info = &frag_index->item[index].stream_info[i];
1388 int index, i;
1392 // If moof_offset already exists in frag_index, return index to it
1393 index = search_frag_moof_offset(&c->frag_index, offset);
1394 if (index < c->frag_index.nb_items &&
1395 c->frag_index.item[index].moof_offset == offset)
1396 return index;
1398 // offset is not yet in frag index.
1399 // Insert new item at index (sorted by moof offset)
1414 // Avoid building frag index if streams lack track id.
1429 if (index < c->frag_index.nb_items)
1430 memmove(c->frag_index.item + index + 1, c->frag_index.item + index,
1431 (c->frag_index.nb_items - index) * sizeof(*c->frag_index.item));
1433 item = &c->frag_index.item[index];
1441 return index;
1444 static void fix_frag_index_entries(MOVFragmentIndex *frag_index, int index,
1450 if (index < 0)
1452 for (i = index; i < frag_index->nb_items; i++) {
2923 static inline int mov_stsc_index_valid(unsigned int index, unsigned int count)
2925 return index < count - 1;
2928 /* Compute the samples value for the stsc entry at the given index. */
2929 static inline int64_t mov_get_stsc_samples(MOVStreamContext *sc, unsigned int index)
2933 if (mov_stsc_index_valid(index, sc->stsc_count))
2934 chunk_count = sc->stsc_data[index + 1].first - sc->stsc_data[index].first;
2937 av_assert0(sc->stsc_data[index].first <= sc->chunk_count);
2938 chunk_count = sc->chunk_count - (sc->stsc_data[index].first - 1);
2941 return sc->stsc_data[index].count * (int64_t)chunk_count;
3177 sample_duration, i, sample_count, st->index);
3456 table[i].index = avio_rb32(pb); /* group_description_index */
3500 * Find the closest previous frame to the timestamp_pts, in e_old index
3508 * the timestamp of index entries are considered to be decoding timestamps.
3511 * Places the found index corresponding output arg.
3525 int64_t* index,
3536 av_assert0(index);
3538 // If dts_shift > 0, then all the index timestamps will have to be offset by
3540 // Hence we decrement the searched timestamp_pts by dts_shift to find the closest index element.
3547 *index = av_index_search_timestamp(st, timestamp_pts, flag | AVSEEK_FLAG_BACKWARD);
3549 // Keep going backwards in the index entries until the timestamp is the same.
3550 if (*index >= 0) {
3551 for (i = *index; i > 0 && e_old[i].timestamp == e_old[i - 1].timestamp;
3555 *index = i - 1;
3561 // computed by adding corresponding CTTS durations to index timestamps.
3562 if (ctts_data && *index >= 0) {
3568 for (index_ctts_count = 0; index_ctts_count < *index; index_ctts_count++) {
3578 while (*index >= 0 && (*ctts_index) >= 0 && (*ctts_index) < ctts_count) {
3582 if ((e_old[*index].timestamp + ctts_data[*ctts_index].duration) <= timestamp_pts &&
3583 (e_old[*index].flags & AVINDEX_KEYFRAME)) {
3587 (*index)--;
3601 return *index >= 0 ? 0 : -1;
3605 * Add index entry with the given values, to the end of ffstream(st)->index_entries.
3609 * except that here we are always unconditionally adding an index entry to
3620 int64_t index = -1;
3641 index = sti->nb_index_entries++;
3642 ie= &entries[index];
3649 return index;
3653 * Rewrite timestamps of index entries in the range [end_index - frame_duration_buffer_size, end_index)
3752 st->codecpar->video_delay, st->index);
3805 * Also fixes the timestamps of the index entries to match the timeline
3830 int64_t index;
3847 // allocate the index ranges array
3850 av_log(mov->fc, AV_LOG_ERROR, "Cannot allocate index ranges buffer\n");
3856 // Clean AVStream from traces of old index
3883 st->index, edit_list_index, edit_list_media_time, edit_list_duration);
3907 // While reordering frame index according to edit list we must handle properly
3909 // We find closest previous key frame and preserve it and consequent frames in index.
3920 &index, &ctts_index_old, &ctts_sample_old) < 0) {
3923 st->index, edit_list_index, search_timestamp);
3925 &index, &ctts_index_old, &ctts_sample_old) < 0) {
3927 "st: %d edit list %"PRId64" Cannot find an index entry before timestamp: %"PRId64".\n",
3928 st->index, edit_list_index, search_timestamp);
3929 index = 0;
3934 current = e_old + index;
3937 // Iterate over index and arrange it according to edit list
3940 for (; current < e_old_end; current++, index++) {
3981 // Shift the index entry timestamp by packet_skip_samples to be correct.
3997 av_log(mov->fc, AV_LOG_DEBUG, "drop a frame at curr_cts: %"PRId64" @ %"PRId64"\n", curr_cts, index);
4036 av_log(mov->fc, AV_LOG_ERROR, "Cannot add index entry\n");
4040 // Update the index ranges array
4041 if (current_index_range < msc->index_ranges || index != current_index_range->end) {
4043 current_index_range->start = index;
4045 current_index_range->end = index + 1;
4083 // If the minimum pts turns out to be greater than zero after fixing the index, then we subtract the
4099 // Free the old index and the old CTTS structures
4104 // Null terminate the index ranges array
4129 /* Build an unrolled index of the samples */
4154 if (sc->sync_group[i].index == cra_index) {
4166 if (sg->index == cra_index)
4329 if (sc->rap_group[rap_group_index].index > 0)
4365 "size %u, distance %u, keyframe %d\n", st->index, current_sample,
4431 // populate index
4479 "size %u, duration %u\n", st->index, i, current_offset, current_dts,
4490 // Fix index according to edit lists.
4634 sc->ffindex = st->index;
4635 c->trak_index = st->index;
4654 st->index);
4659 st->index);
4676 st->index, dref->path, dref->dir, dref->filename,
4684 st->index, dref->path, dref->dir, dref->filename,
5194 // Find the next frag_index index that has a valid index_entry for
5199 // New index entries will be inserted before the index_entry found.
5273 // realloc space for new index entries
5276 av_log(c->fc, AV_LOG_ERROR, "Failed to add index entry\n");
5385 "size %u, distance %d, keyframe %d\n", st->index,
5518 int index;
5529 index = update_frag_index(c, offset);
5530 frag_stream_info = get_frag_stream_info(&c->frag_index, index, track_id);
5564 // Find first entry in fragment index that came from an sidx.
6382 // If this stream isn't encrypted, don't create the index.
6400 // If this stream isn't encrypted, don't create the index.
7629 st->index,
7806 sc->ffindex = st->index;
7807 c->trak_index = st->index;
8445 static void mov_free_encryption_index(MOVEncryptionIndex **index) {
8447 if (!index || !*index) return;
8448 for (i = 0; i < (*index)->nb_encrypted_samples; i++) {
8449 av_encryption_info_free((*index)->encrypted_samples[i]);
8451 av_freep(&(*index)->encrypted_samples);
8452 av_freep(&(*index)->auxiliary_info_sizes);
8453 av_freep(&(*index)->auxiliary_offsets);
8454 av_freep(index);
8608 int index;
8626 index = update_frag_index(mov, offset);
8627 frag_stream_info = get_frag_stream_info(&mov->frag_index, index, track_id);
8935 static int mov_switch_root(AVFormatContext *s, int64_t target, int index)
8940 if (index >= 0 && index < mov->frag_index.nb_items)
8941 target = mov->frag_index.item[index].moof_offset;
8948 if (index < 0 || index >= mov->frag_index.nb_items)
8949 index = search_frag_moof_offset(&mov->frag_index, target);
8950 if (index < mov->frag_index.nb_items &&
8951 mov->frag_index.item[index].moof_offset == target) {
8952 if (index + 1 < mov->frag_index.nb_items)
8953 mov->next_root_atom = mov->frag_index.item[index + 1].moof_offset;
8954 if (mov->frag_index.item[index].headers_read)
8956 mov->frag_index.item[index].headers_read = 1;
8976 /* Save the current index. */
9176 /* Update the stsc index for the next sample */
9199 int index;
9204 index = search_frag_timestamp(&mov->frag_index, st, timestamp);
9205 if (index < 0)
9206 index = 0;
9207 if (!mov->frag_index.item[index].headers_read)
9208 return mov_switch_root(s, -1, index);
9209 if (index + 1 < mov->frag_index.nb_items)
9210 mov->next_root_atom = mov->frag_index.item[index + 1].moof_offset;
9275 av_log(s, AV_LOG_TRACE, "stream %d, timestamp %"PRId64", sample %d\n", st->index, timestamp, sample);
9287 av_log(s, AV_LOG_TRACE, "stream %d, found sample %d\n", st->index, sc->current_sample);
9288 /* adjust ctts index */
9302 /* adjust stsd index */