/* resync the stream on the next media packet with specified properties  */
static int64_t gxf_resync_media(AVFormatContext *s, uint64_t max_interval, int track, int timestamp)
/* resync the stream on the next media packet with specified properties  */
static int64_t gxf_resync_media(AVFormatContext *s, uint64_t max_interval, int track, int timestamp)
{
        url_fseek(pb, last_pos, SEEK_SET);
        goto start;
    }
    get_byte(pb);
    cur_track = get_byte(pb);
    cur_timestamp = get_be32(pb);
    last_found_pos = url_ftell(pb) - 16 - 6;
    if ((track >= 0 && track != cur_track) || (timestamp >= 0 && timestamp > cur_timestamp)) {
        url_fseek(pb, last_pos, SEEK_SET);
        goto start;
    }
out:
    if (last_found_pos)
        url_fseek(pb, last_found_pos, SEEK_SET);
    return cur_timestamp;
}